Skip to content

Commit b2d4f67

Browse files
committed
Add test to verify return code from llvm-foreach run tool is retained
1 parent 5e59a29 commit b2d4f67

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// REQUIRES: system-linux
2+
// Test that the return value from the called tool is retained.
3+
// Runs a script within a script so we can retain the return code without
4+
// the testing infrastructure getting in the way.
5+
6+
// RUN: echo 'Content of first file' > %t1.tgt
7+
// RUN: echo 'Content of second file' > %t2.tgt
8+
// RUN: echo "%t1.tgt" > %t.list
9+
// RUN: echo "%t2.tgt" >> %t.list
10+
11+
// RUN: echo "#!/bin/sh" > %t.sh
12+
// RUN: echo "cat \$1" >> %t.sh
13+
// RUN: echo "exit 21" >> %t.sh
14+
// RUN: chmod 777 %t.sh
15+
// RUN: echo "#!/bin/sh" > %t2.sh
16+
// RUN: echo "llvm-foreach --in-replace=\"{}\" --in-file-list=%t.list -- %t.sh \"{}\" > %t.res" >> %t2.sh
17+
// RUN: echo "echo \$? >> %t.res" >> %t2.sh
18+
// RUN: chmod 777 %t2.sh
19+
// RUN: %t2.sh
20+
// RUN: FileCheck < %t.res %s
21+
// CHECK: Content of first file
22+
// CHECK: Content of second file
23+
// CHECK: 21

0 commit comments

Comments
 (0)