diff --git a/test/Reduce/remove-args.ll b/test/Reduce/remove-args.ll index 4823f751923..161a6fd3731 100644 --- a/test/Reduce/remove-args.ll +++ b/test/Reduce/remove-args.ll @@ -1,16 +1,7 @@ ; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls. ; -; RUN: rm -rf %t -; RUN: mkdir %t -; get the python path from lit -; RUN: echo "#!" %python > %t/test.py -; then include the rest of the test script -; RUN: cat %p/Inputs/remove-args.py >> %t/test.py -; RUN: chmod +x %t/test.py - -; RUN: llvm-reduce --test %t/test.py %s -o %t/out.ll -; RUN: cat %t/out.ll | FileCheck -implicit-check-not=uninteresting %s -; REQUIRES: shell +; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-args.py %s -o %t +; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s ; CHECK: @interesting(i32 %interesting) define void @interesting(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2) { diff --git a/test/Reduce/remove-funcs.ll b/test/Reduce/remove-funcs.ll index 6b3c86bea87..59ffd849193 100644 --- a/test/Reduce/remove-funcs.ll +++ b/test/Reduce/remove-funcs.ll @@ -1,17 +1,8 @@ ; Test that llvm-reduce can remove uninteresting functions as well as ; their InstCalls. ; -; RUN: rm -rf %t -; RUN: mkdir %t -; get the python path from lit -; RUN: echo "#!" %python > %t/test.py -; then include the rest of the test script -; RUN: cat %p/Inputs/remove-funcs.py >> %t/test.py -; RUN: chmod +x %t/test.py - -; RUN: llvm-reduce --test %t/test.py %s -o %t/out.ll -; RUN: cat %t/out.ll | FileCheck -implicit-check-not=uninteresting %s -; REQUIRES: shell +; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-funcs.py %s -o %t +; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s define i32 @uninteresting1() { entry: diff --git a/test/Reduce/remove-global-vars.ll b/test/Reduce/remove-global-vars.ll index 900774762c1..b876acd1b8f 100644 --- a/test/Reduce/remove-global-vars.ll +++ b/test/Reduce/remove-global-vars.ll @@ -1,17 +1,8 @@ ; Test that llvm-reduce can remove uninteresting Global Variables as well as ; their direct uses (which in turn are replaced with 'undef'). ; -; RUN: rm -rf %t -; RUN: mkdir %t -; get the python path from lit -; RUN: echo "#!" %python > %t/test.py -; then include the rest of the test script -; RUN: cat %p/Inputs/remove-global-vars.py >> %t/test.py -; RUN: chmod +x %t/test.py - -; RUN: llvm-reduce --test %t/test.py %s -o %t/out.ll -; RUN: cat %t/out.ll | FileCheck -implicit-check-not=uninteresting %s -; REQUIRES: shell +; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-global-vars.py %s -o %t +; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s ; CHECK: @interesting = global @interesting = global i32 0, align 4 diff --git a/test/Reduce/remove-metadata.ll b/test/Reduce/remove-metadata.ll index b887737f3b3..51a50ca20a9 100644 --- a/test/Reduce/remove-metadata.ll +++ b/test/Reduce/remove-metadata.ll @@ -1,17 +1,8 @@ ; Test that llvm-reduce can remove uninteresting metadata from an IR file. ; The Metadata pass erases named & unnamed metadata nodes. ; -; RUN: rm -rf %t -; RUN: mkdir %t -; get the python path from lit -; RUN: echo "#!" %python > %t/test.py -; then include the rest of the test script -; RUN: cat %p/Inputs/remove-metadata.py >> %t/test.py -; RUN: chmod +x %t/test.py - -; RUN: llvm-reduce --test %t/test.py %s -o %t/out.ll -; RUN: cat %t/out.ll | FileCheck -implicit-check-not=! %s -; REQUIRES: shell +; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-metadata.py %s -o %t +; RUN: cat %t | FileCheck -implicit-check-not=! %s @global = global i32 0, !dbg !0 diff --git a/tools/llvm-reduce/TestRunner.cpp b/tools/llvm-reduce/TestRunner.cpp index 50b277b6f0e..62600392527 100644 --- a/tools/llvm-reduce/TestRunner.cpp +++ b/tools/llvm-reduce/TestRunner.cpp @@ -36,16 +36,16 @@ TestRunner::TestRunner(StringRef TestName, std::vector TestArgs) int TestRunner::run(StringRef Filename) { std::vector ProgramArgs; ProgramArgs.push_back(TestName); + + for (const auto &Arg : TestArgs) + ProgramArgs.push_back(Arg); + ProgramArgs.push_back(Filename); - for (auto Arg : TestArgs) - ProgramArgs.push_back(Arg.c_str()); - - Optional Redirects[3]; // STDIN, STDOUT, STDERR std::string ErrMsg; - int Result = - sys::ExecuteAndWait(TestName, ProgramArgs, None, Redirects, - /*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg); + int Result = sys::ExecuteAndWait( + TestName, ProgramArgs, /*Env=*/None, /*Redirects=*/None, + /*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg); if (Result < 0) { Error E = make_error("Error running interesting-ness test: " +