[llvm] r372049 - llvm-reduce: Make tests shell-independent by passing the interpreter on the command line rather than using #! in the test file
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 16:41:19 PDT 2019
Author: dblaikie
Date: Mon Sep 16 16:41:19 2019
New Revision: 372049
URL: http://llvm.org/viewvc/llvm-project?rev=372049&view=rev
Log:
llvm-reduce: Make tests shell-independent by passing the interpreter on the command line rather than using #! in the test file
Modified:
llvm/trunk/test/Reduce/remove-args.ll
llvm/trunk/test/Reduce/remove-funcs.ll
llvm/trunk/test/Reduce/remove-global-vars.ll
llvm/trunk/test/Reduce/remove-metadata.ll
llvm/trunk/tools/llvm-reduce/TestRunner.cpp
Modified: llvm/trunk/test/Reduce/remove-args.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Reduce/remove-args.ll?rev=372049&r1=372048&r2=372049&view=diff
==============================================================================
--- llvm/trunk/test/Reduce/remove-args.ll (original)
+++ llvm/trunk/test/Reduce/remove-args.ll Mon Sep 16 16:41:19 2019
@@ -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) {
Modified: llvm/trunk/test/Reduce/remove-funcs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Reduce/remove-funcs.ll?rev=372049&r1=372048&r2=372049&view=diff
==============================================================================
--- llvm/trunk/test/Reduce/remove-funcs.ll (original)
+++ llvm/trunk/test/Reduce/remove-funcs.ll Mon Sep 16 16:41:19 2019
@@ -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:
Modified: llvm/trunk/test/Reduce/remove-global-vars.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Reduce/remove-global-vars.ll?rev=372049&r1=372048&r2=372049&view=diff
==============================================================================
--- llvm/trunk/test/Reduce/remove-global-vars.ll (original)
+++ llvm/trunk/test/Reduce/remove-global-vars.ll Mon Sep 16 16:41:19 2019
@@ -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
Modified: llvm/trunk/test/Reduce/remove-metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Reduce/remove-metadata.ll?rev=372049&r1=372048&r2=372049&view=diff
==============================================================================
--- llvm/trunk/test/Reduce/remove-metadata.ll (original)
+++ llvm/trunk/test/Reduce/remove-metadata.ll Mon Sep 16 16:41:19 2019
@@ -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
Modified: llvm/trunk/tools/llvm-reduce/TestRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-reduce/TestRunner.cpp?rev=372049&r1=372048&r2=372049&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-reduce/TestRunner.cpp (original)
+++ llvm/trunk/tools/llvm-reduce/TestRunner.cpp Mon Sep 16 16:41:19 2019
@@ -36,16 +36,16 @@ TestRunner::TestRunner(StringRef TestNam
int TestRunner::run(StringRef Filename) {
std::vector<StringRef> ProgramArgs;
ProgramArgs.push_back(TestName);
- ProgramArgs.push_back(Filename);
- for (auto Arg : TestArgs)
- ProgramArgs.push_back(Arg.c_str());
+ for (const auto &Arg : TestArgs)
+ ProgramArgs.push_back(Arg);
+
+ ProgramArgs.push_back(Filename);
- Optional<StringRef> 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<StringError>("Error running interesting-ness test: " +
More information about the llvm-commits
mailing list