12 main(int argc
, char const *argv
[])
14 // The program writes its output to the following file:
16 // o "output1.txt" for test_pass_host_env_vars() test case
17 // o "output2.txt" for test_run_args_and_env_vars_with_dsym() test case
18 // o "output2.txt" for test_run_args_and_env_vars_with_dwarf() test case
19 std::ofstream outfile
;
21 outfile
.open("output1.txt");
23 outfile
.open("output2.txt");
25 for (unsigned i
= 0; i
< argc
; ++i
) {
26 std::string
theArg(argv
[i
]);
27 if (i
== 1 && "A" == theArg
)
28 outfile
<< "argv[1] matches\n";
30 if (i
== 2 && "B" == theArg
)
31 outfile
<< "argv[2] matches\n";
33 if (i
== 3 && "C" == theArg
)
34 outfile
<< "argv[3] matches\n";
37 // For passing environment vars from the debugger to the launched process.
38 if (::getenv("MY_ENV_VAR")) {
39 std::string
MY_ENV_VAR(getenv("MY_ENV_VAR"));
40 if ("YES" == MY_ENV_VAR
) {
41 outfile
<< "Environment variable 'MY_ENV_VAR' successfully passed.\n";
46 // For passing host environment vars to the launched process.
47 if (::getenv("MY_HOST_ENV_VAR1")) {
48 std::string
MY_HOST_ENV_VAR1(getenv("MY_HOST_ENV_VAR1"));
49 if ("VAR1" == MY_HOST_ENV_VAR1
) {
50 outfile
<< "The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.\n";
54 if (::getenv("MY_HOST_ENV_VAR2")) {
55 std::string
MY_HOST_ENV_VAR2(getenv("MY_HOST_ENV_VAR2"));
56 if ("VAR2" == MY_HOST_ENV_VAR2
) {
57 outfile
<< "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed.\n";
61 std::cerr
<< "This message should go to standard error.\n";
62 std::cout
<< "This message should go to standard out.\n";