1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// XFAIL: LIBCXX-FREEBSD-FIXME
10
11// Make sure that test-executables can appear in RUN lines and be executed
12// effectively. This somewhat difficult-to-understand test checks that when
13// we run with a remote executor, test-executables are copied to the remote
14// host and their path is fixed up (directly in the command-line) to their
15// path on the remote host instead of the local host.
16//
17// We also check that the path of test-executables is replaced whether they
18// appear first in the command-line or not.
19
20// UNSUPPORTED: executor-has-no-bash
21// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe
22// RUN: %{exec} %t.exe 0
23// RUN: %{exec} bash -c '! %t.exe 1'
24
25#include <cassert>
26#include <cstdlib>
27
28int main(int argc, char** argv) {
29 assert(argc == 2);
30 int ret = std::atoi(nptr: argv[1]);
31 return ret;
32}
33

source code of libcxx/test/libcxx/selftest/remote-substitutions.sh.cpp