Skip to content

Commit e49cd60

Browse files
committed
[NFC] Make sure that tests use %t
As per https://llvm.org/docs/CommandGuide/lit.html#substitutions, %t is a common substitution used for temporary file name unique to the test. Make sure that all tests use %t instead of some arbitrary names. This is important as otherwise tests might be re-using files generated by other tests.
1 parent d6f98b6 commit e49cd60

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

test/DuplicateBB_MergeBB_exec.ll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
; RUN: %clang -S -emit-llvm %S/../inputs/input_for_mba.c -o - \
22
; RUN: | opt -load %shlibdir/libRIV%shlibext -load %shlibdir/libDuplicateBB%shlibext -legacy-duplicate-bb -S -o - \
3-
; RUN: | opt -load %shlibdir/libMergeBB%shlibext -legacy-merge-bb -S -o %instrumented.ll
4-
; RUN: %clang %instrumented.ll -o %instrumented.bin
3+
; RUN: | opt -load %shlibdir/libMergeBB%shlibext -legacy-merge-bb -S -o %t.ll
4+
; RUN: %clang %t.ll -o %t.bin
55

66
; Verify that after applying DuplicaateBB + MergeBB the output generated by the
77
; input module (input_for_mba.c) doesn't change.
88

99
; The program implemented in input_for_mba.c takes for inputs and adds them up,
1010
; and returns the result. So if they add up to 0, then the binary returns `0`
1111
; (aka success). Verify that the obfuscation didn't violate this invariant.
12-
; RUN: ./%instrumented.bin 0 0 0 0
13-
; RUN: ./%instrumented.bin 1 2 3 -6
14-
; RUN: ./%instrumented.bin -13 13 -13 13
15-
; RUN: ./%instrumented.bin -11100 100 1000 10000
12+
; RUN: %t.bin 0 0 0 0
13+
; RUN: %t.bin 1 2 3 -6
14+
; RUN: %t.bin -13 13 -13 13
15+
; RUN: %t.bin -11100 100 1000 10000
1616

1717
; If the input values don't add up to 0, then the result shouldn't add to `0`.
1818
; Use `not` to negate the result so that we still test for `success`.
19-
; RUN: not ./%instrumented.bin 0 0 0 1
20-
; RUN: not ./%instrumented.bin 1 2 3 -7
21-
; RUN: not ./%instrumented.bin 13 13 -13 13
22-
; RUN: not ./%instrumented.bin -11101 100 1000 10000
19+
; RUN: not %t.bin 0 0 0 1
20+
; RUN: not %t.bin 1 2 3 -7
21+
; RUN: not %t.bin 13 13 -13 13
22+
; RUN: not %t.bin -11101 100 1000 10000

test/DuplicateBB_exec.ll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
; RUN: %clang -S -emit-llvm %S/../inputs/input_for_mba.c -o - \
2-
; RUN: | opt -load %shlibdir/libRIV%shlibext -load %shlibdir/libDuplicateBB%shlibext -legacy-duplicate-bb -S -o %instrumented.ll
3-
; RUN: %clang %instrumented.ll -o %instrumented.bin
2+
; RUN: | opt -load %shlibdir/libRIV%shlibext -load %shlibdir/libDuplicateBB%shlibext -legacy-duplicate-bb -S -o %t.ll
3+
; RUN: %clang %t.ll -o %t.bin
44

55
; Verify that after applying DuplicateBB the output generated by the input
66
; module (input_for_mba.c) doesn't change.
77

88
; The program implemented in input_for_mba.c takes for inputs and adds them up,
99
; and returns the result. So if they add up to 0, then the binary returns `0`
1010
; (aka success). Verify that the obfuscation didn't violate this invariant.
11-
; RUN: ./%instrumented.bin 0 0 0 0
12-
; RUN: ./%instrumented.bin 1 2 3 -6
13-
; RUN: ./%instrumented.bin -13 13 -13 13
14-
; RUN: ./%instrumented.bin -11100 100 1000 10000
11+
; RUN: %t.bin 0 0 0 0
12+
; RUN: %t.bin 1 2 3 -6
13+
; RUN: %t.bin -13 13 -13 13
14+
; RUN: %t.bin -11100 100 1000 10000
1515

1616
; If the input values don't add up to 0, then the result shouldn't add to `0`.
1717
; Use `not` to negate the result so that we still test for `success`.
18-
; RUN: not ./%instrumented.bin 0 0 0 1
19-
; RUN: not ./%instrumented.bin 1 2 3 -7
20-
; RUN: not ./%instrumented.bin 13 13 -13 13
21-
; RUN: not ./%instrumented.bin -11101 100 1000 10000
18+
; RUN: not %t.bin 0 0 0 1
19+
; RUN: not %t.bin 1 2 3 -7
20+
; RUN: not %t.bin 13 13 -13 13
21+
; RUN: not %t.bin -11101 100 1000 10000

test/DynamicCallCounterTest1.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
; RUN: opt -load %shlibdir/libDynamicCallCounter%shlibext -legacy-dynamic-cc -verify %S/Inputs/CallCounterInput.ll -o instrumented.bin
2-
; RUN: lli ./instrumented.bin | FileCheck %s
3-
; RUN: opt -load-pass-plugin %shlibdir/libDynamicCallCounter%shlibext -passes=dynamic-cc -verify %S/Inputs/CallCounterInput.ll -o instrumented.bin
4-
; RUN: lli ./instrumented.bin | FileCheck %s
1+
; RUN: opt -load %shlibdir/libDynamicCallCounter%shlibext -legacy-dynamic-cc -verify %S/Inputs/CallCounterInput.ll -o %t.bin
2+
; RUN: lli %t.bin | FileCheck %s
3+
; RUN: opt -load-pass-plugin %shlibdir/libDynamicCallCounter%shlibext -passes=dynamic-cc -verify %S/Inputs/CallCounterInput.ll -o %t.bin
4+
; RUN: lli %t.bin | FileCheck %s
55

66
; Instrument this file with DynamicCallCounter, run it and verify that it
77
; generates the expected output.

test/MergeBB_exec.ll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
; RUN: %clang -S -emit-llvm %S/../inputs/input_for_mba.c -o - \
2-
; RUN: | opt -load %shlibdir/libMergeBB%shlibext -legacy-merge-bb -S -o %instrumented.ll
3-
; RUN: %clang %instrumented.ll -o %instrumented.bin
2+
; RUN: | opt -load %shlibdir/libMergeBB%shlibext -legacy-merge-bb -S -o %t.ll
3+
; RUN: %clang %t.ll -o %t.bin
44

55
; Verify that after applying MergeBB the output generated by the input
66
; module (input_for_mba.c) doesn't change.
77

88
; The program implemented in input_for_mba.c takes for inputs and adds them up,
99
; and returns the result. So if they add up to 0, then the binary returns `0`
1010
; (aka success). Verify that the obfuscation didn't violate this invariant.
11-
; RUN: ./%instrumented.bin 0 0 0 0
12-
; RUN: ./%instrumented.bin 1 2 3 -6
13-
; RUN: ./%instrumented.bin -13 13 -13 13
14-
; RUN: ./%instrumented.bin -11100 100 1000 10000
11+
; RUN: %t.bin 0 0 0 0
12+
; RUN: %t.bin 1 2 3 -6
13+
; RUN: %t.bin -13 13 -13 13
14+
; RUN: %t.bin -11100 100 1000 10000
1515

1616
; If the input values don't add up to 0, then the result shouldn't add to `0`.
1717
; Use `not` to negate the result so that we still test for `success`.
18-
; RUN: not ./%instrumented.bin 0 0 0 1
19-
; RUN: not ./%instrumented.bin 1 2 3 -7
20-
; RUN: not ./%instrumented.bin 13 13 -13 13
21-
; RUN: not ./%instrumented.bin -11101 100 1000 10000
18+
; RUN: not %t.bin 0 0 0 1
19+
; RUN: not %t.bin 1 2 3 -7
20+
; RUN: not %t.bin 13 13 -13 13
21+
; RUN: not %t.bin -11101 100 1000 10000

test/inject_func_call_exec.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: %clang -c -emit-llvm %S/../inputs/input_for_hello.c -o - \
2-
; RUN: | opt -load %shlibdir/libInjectFuncCall%shlibext -legacy-inject-func-call -verify -o instrumented.bin
3-
; RUN: not lli ./instrumented.bin | FileCheck %s
2+
; RUN: | opt -load %shlibdir/libInjectFuncCall%shlibext -legacy-inject-func-call -verify -o %t.bin
3+
; RUN: not lli %t.bin | FileCheck %s
44

55
; This test instruments the input file (input_for_inject.c) with InjectFuncCall and runs it via lli.
66
; Below is the expected output.

0 commit comments

Comments
 (0)