Skip to content

Commit 892d2b1

Browse files
committed
Expand diff run lines in profiling tests for lit compatibility
Expanded the `diff` run lines in several profiling test files to avoid using process substitution (`<(...)`), which is not supported by the `lit` internal shell. The updated commands now explicitly redirect the output of `llvm-profdata show` to temporary files before performing the comparison with `diff`. In the `focus-function.test` file, the requirement for `shell` was added because `lit` does not support the `for` loop syntax, which is necessary for the script to run correctly.
1 parent 6f092e5 commit 892d2b1

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

compiler-rt/test/fuzzer/focus-function.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Tests -focus_function
22
#
33
# TODO: don't require linux.
4-
# REQUIRES: linux
4+
# REQUIRES: shell, linux
55
UNSUPPORTED: target=aarch64{{.*}}
66

77
RUN: %cpp_compiler %S/OnlySomeBytesTest.cpp -o %t-exe

compiler-rt/test/profile/Linux/counter_promo_for.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
// RUN: %run %t.nopromo.gen
1313
// RUN: llvm-profdata merge -o %t.nopromo.profdata %t.nopromo.prof/
1414
// RUN: llvm-profdata show --counts --all-functions %t.nopromo.profdata > %t.nopromo.dump
15-
// RUN: diff <(llvm-profdata show %t.promo.profdata) <(llvm-profdata show %t.nopromo.profdata)
15+
// RUN: llvm-profdata show %t.promo.profdata > %t.promo.dump
16+
// RUN: llvm-profdata show %t.nopromo.profdata > %t.nopromo.dump
17+
// RUN: diff %t.promo.dump %t.nopromo.dump
1618

1719
int g;
1820
__attribute__((noinline)) void bar(int i) { g += i; }

compiler-rt/test/profile/Linux/counter_promo_nest.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
// RUN: %run %t.nopromo.gen
1111
// RUN: llvm-profdata merge -o %t.nopromo.profdata %t.nopromo.prof/
1212
// RUN: llvm-profdata show --counts --all-functions %t.nopromo.profdata > %t.nopromo.dump
13-
// RUN: diff <(llvm-profdata show %t.promo.profdata) <(llvm-profdata show %t.nopromo.profdata)
13+
// RUN: llvm-profdata show %t.promo.profdata > %t.promo.dump
14+
// RUN: llvm-profdata show %t.nopromo.profdata > %t.nopromo.dump
15+
// RUN: diff %t.promo.dump %t.nopromo.dump
1416
int g;
1517
__attribute__((noinline)) void bar() {
1618
g++;

compiler-rt/test/profile/Linux/counter_promo_while.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
// RUN: %run %t.nopromo.gen
1313
// RUN: llvm-profdata merge -o %t.nopromo.profdata %t.nopromo.prof/
1414
// RUN: llvm-profdata show --counts --all-functions %t.nopromo.profdata > %t.nopromo.dump
15-
// RUN: diff <(llvm-profdata show %t.promo.profdata) <(llvm-profdata show %t.nopromo.profdata)
15+
// RUN: llvm-profdata show %t.promo.profdata > %t.promo.dump
16+
// RUN: llvm-profdata show %t.nopromo.profdata > %t.nopromo.dump
17+
// RUN: diff %t.promo.dump %t.nopromo.dump
18+
1619
int g;
1720
__attribute__((noinline)) void bar(int i) { g += i; }
1821
__attribute__((noinline)) void foo(int n, int N) {

compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
// RUN: env LLVM_PROFILE_FILE=%t.d4.proflite %run %t.d4
88
// RUN: llvm-profdata merge -o %t.d4.profdata --debug-info=%t.d4 %t.d4.proflite
99

10-
// RUN: diff <(llvm-profdata show --all-functions --counts %t.normal.profdata) <(llvm-profdata show --all-functions --counts %t.d4.profdata)
10+
// RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal.dump
11+
// RUN: llvm-profdata show --all-functions --counts %t.d4.profdata > %t.d4.dump
12+
// RUN: diff %t.normal.dump %t.d4.dump
1113

1214
// RUN: %clang_pgogen -o %t -g -mllvm --debug-info-correlate -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
1315
// RUN: env LLVM_PROFILE_FILE=%t.proflite %run %t
1416
// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.proflite
1517

16-
// RUN: diff <(llvm-profdata show --all-functions --counts %t.normal.profdata) <(llvm-profdata show --all-functions --counts %t.profdata)
18+
// RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal2.dump
19+
// RUN: llvm-profdata show --all-functions --counts %t.profdata > %t.prof.dump
20+
// RUN: diff %t.normal2.dump %t.prof.dump
1721

1822
// RUN: %clang_pgogen -o %t.cov -g -mllvm --debug-info-correlate -mllvm -pgo-function-entry-coverage -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
1923
// RUN: env LLVM_PROFILE_FILE=%t.cov.proflite %run %t.cov
@@ -23,7 +27,9 @@
2327
// RUN: env LLVM_PROFILE_FILE=%t.cov.profraw %run %t.cov.normal
2428
// RUN: llvm-profdata merge -o %t.cov.normal.profdata %t.cov.profraw
2529

26-
// RUN: diff <(llvm-profdata show --all-functions --counts %t.cov.normal.profdata) <(llvm-profdata show --all-functions --counts %t.cov.profdata)
30+
// RUN: llvm-profdata show --all-functions --counts %t.cov.normal.profdata > %t.cov.normal.dump
31+
// RUN: llvm-profdata show --all-functions --counts %t.cov.profdata > %t.cov.dump
32+
// RUN: diff %t.cov.normal.dump %t.cov.dump
2733

2834
// Test debug info correlate with online merging.
2935

@@ -36,11 +42,17 @@
3642
// RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.proflite %run %t
3743
// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.profdir/
3844

39-
// RUN: diff <(llvm-profdata show --all-functions --counts %t.normal.profdata) <(llvm-profdata show --all-functions --counts %t.profdata)
45+
46+
// RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal3.dump
47+
// RUN: llvm-profdata show --all-functions --counts %t.profdata > %t.prof3.dump
48+
// RUN: diff %t.normal3.dump %t.prof3.dump
4049

4150
// RUN: rm -rf %t.profdir && mkdir %t.profdir
4251
// RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov
4352
// RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov
4453
// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info=%t.cov %t.profdir/
4554

46-
// RUN: diff <(llvm-profdata show --all-functions --counts %t.cov.normal.profdata) <(llvm-profdata show --all-functions --counts %t.cov.profdata)
55+
// RUN: llvm-profdata show --all-functions --counts %t.cov.normal.profdata > %t.cov.normal2.dump
56+
// RUN: llvm-profdata show --all-functions --counts %t.cov.profdata > %t.cov2.dump
57+
// RUN: diff %t.cov.normal2.dump %t.cov2.dump
58+

0 commit comments

Comments
 (0)