@@ -24,15 +24,6 @@ ProgramTestStringArg1("program-test-string-arg1");
24
24
static cl::opt<std::string>
25
25
ProgramTestStringArg2 (" program-test-string-arg2" );
26
26
27
- static void CopyEnvironment (std::vector<const char *> &out) {
28
- // environ appears to be pretty portable.
29
- char **envp = environ;
30
- while (*envp != 0 ) {
31
- out.push_back (*envp);
32
- ++envp;
33
- }
34
- }
35
-
36
27
TEST (ProgramTest, CreateProcessTrailingSlash) {
37
28
if (getenv (" LLVM_PROGRAM_TEST_CHILD" )) {
38
29
if (ProgramTestStringArg1 == " has\\\\ trailing\\ " &&
@@ -52,13 +43,7 @@ TEST(ProgramTest, CreateProcessTrailingSlash) {
52
43
" -program-test-string-arg2" , " has\\\\ trailing\\ " ,
53
44
0
54
45
};
55
-
56
- // Add LLVM_PROGRAM_TEST_CHILD to the environment of the child.
57
- std::vector<const char *> envp;
58
- CopyEnvironment (envp);
59
- envp.push_back (" LLVM_PROGRAM_TEST_CHILD=1" );
60
- envp.push_back (0 );
61
-
46
+ const char *envp[] = { " LLVM_PROGRAM_TEST_CHILD=1" , 0 };
62
47
std::string error;
63
48
bool ExecutionFailed;
64
49
// Redirect stdout and stdin to NUL, but let stderr through.
@@ -68,7 +53,7 @@ TEST(ProgramTest, CreateProcessTrailingSlash) {
68
53
Path nul (" /dev/null" );
69
54
#endif
70
55
const Path *redirects[] = { &nul, &nul, 0 };
71
- int rc = Program::ExecuteAndWait (my_exe, argv, & envp[ 0 ] , redirects,
56
+ int rc = Program::ExecuteAndWait (my_exe, argv, envp, redirects,
72
57
/* secondsToWait=*/ 10 , /* memoryLimit=*/ 0 ,
73
58
&error, &ExecutionFailed);
74
59
EXPECT_FALSE (ExecutionFailed) << error;
0 commit comments