Skip to content

Commit c7a9be8

Browse files
[XRay] Rewrite tests to not use subshells
So that they will actually function with the internal shell.
1 parent e95c5c8 commit c7a9be8

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
// RUN: xray_naive_log_func_duration_threshold_us=1000 \
99
// RUN: xray_naive_log_max_stack_depth=2" %run %t 2>&1 | \
1010
// RUN: FileCheck %s
11+
// RUN: ls basic-filtering-* | head -1 | tr -d '\n' > %t.log
1112
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
12-
// RUN: "`ls basic-filtering-* | head -1`" | \
13+
// RUN: "%{readfile:%t.log}" | \
1314
// RUN: FileCheck %s --check-prefix TRACE
1415
// RUN: rm -f basic-filtering-*
1516
//
@@ -18,8 +19,9 @@
1819
// RUN: xray_logfile_base=basic-filtering-" \
1920
// RUN: env XRAY_BASIC_OPTIONS="func_duration_threshold_us=1000 max_stack_depth=2" \
2021
// RUN: %run %t 2>&1 | FileCheck %s
22+
// RUN: ls basic-filtering-* | head -1 | tr -d '\n' > %t.log
2123
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
22-
// RUN: "`ls basic-filtering-* | head -1`" | \
24+
// RUN: "%{readfile:%t.log}" | \
2325
// RUN: FileCheck %s --check-prefix TRACE
2426
// RUN: rm -f basic-filtering-*
2527

compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// RUN: %clangxx_xray -g -fPIC -fxray-instrument -fxray-shared -std=c++11 %t/main.cpp %t/testlib.so -Wl,-rpath,%t -o %t/main.o
66

77
// RUN: env XRAY_OPTIONS="patch_premain=false,xray_mode=xray-basic,xray_logfile_base=basic-mode-dso-,verbosity=1" XRAY_BASIC_OPTIONS="func_duration_threshold_us=0" %run %t/main.o 2>&1 | FileCheck %s
8-
// RUN: %llvm_xray account --format=csv --sort=funcid "`ls basic-mode-dso-* | head -1`" | FileCheck --check-prefix=ACCOUNT %s
8+
// RUN: ls basic-mode-dso-* | head -1 | tr -d '\n' > %t.log
9+
// RUN: %llvm_xray account --format=csv --sort=funcid "%{readfile:%t.log}" | FileCheck --check-prefix=ACCOUNT %s
910
// RUN: rm basic-mode-dso-*
1011

1112
// REQUIRES: target={{(aarch64|x86_64)-.*}}

compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// RUN: verbosity=1" \
77
// RUN: env XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
88
// RUN: %run %t 2>&1 | FileCheck %s
9-
// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
10-
// RUN: [ $FILES -eq 0 ]
9+
// RUN: find %t.dir -name 'fdr-inmemory-test-*' | wc -l | tr -d '\n' > %t.file_count
10+
// RUN: %python -c "import sys; sys.exit(int(sys.argv[1]))" %{readfile:%t.file_count}
1111
// RUN: rm -rf %t.dir
1212
//
1313
// REQUIRES: built-in-llvm-tree

compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// RUN: verbosity=1" \
77
// RUN: env XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
88
// RUN: %run %t 2>&1 | FileCheck %s
9-
// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
10-
// RUN: [ $FILES -eq 0 ]
9+
// RUN: find %t.dir -name 'fdr-inmemory-test-*' | wc -l | tr -d '\n' > %t.file_count
10+
// RUN: %python -c "import sys; sys.exit(int(sys.argv[1]))" %{readfile:%t.file_count}
1111
// RUN: rm -rf %t.dir
1212
//
1313
// REQUIRES: built-in-llvm-tree

compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
// RUN: verbosity=1" \
1111
// RUN: env XRAY_FDR_OPTIONS="func_duration_threshold_us=5000" \
1212
// RUN: %run %t 2>&1 | FileCheck %s
13+
// RUN: ls fdr-logging-test-* | head -1 | tr -d '\n' > %t.log
1314
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
14-
// RUN: "`ls fdr-logging-test-* | head -1`" \
15+
// RUN: "%{readfile:%t.log}" \
1516
// RUN: | FileCheck %s --check-prefix=TRACE
17+
// RUN: ls fdr-unwrite-test-* | head -1 | tr -d '\n' > %t.log
1618
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
17-
// RUN: "`ls fdr-unwrite-test-* | head -1`" \
19+
// RUN: "%{readfile:%t.log}" \
1820
// RUN: | FileCheck %s --check-prefix=UNWRITE
1921
// RUN: rm fdr-logging-test-*
2022
// RUN: rm fdr-unwrite-test-*

compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
// RUN: env XRAY_OPTIONS="patch_premain=true xray_logfile_base=fork-basic-logging-test- \
55
// RUN: xray_mode=xray-basic verbosity=1 xray_naive_log_func_duration_threshold_us=0" \
66
// RUN: %run %t 2>&1 | FileCheck %s
7+
// RUN: ls -S fork-basic-logging-test-* | head -1 | tr -d '\n' > %t.log
78
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
8-
// RUN: "`ls -S fork-basic-logging-test-* | head -1`" \
9+
// RUN: "%{readfile:%t.log}" \
910
// RUN: | FileCheck %s --check-prefix=TRACE
1011

1112
// REQUIRES: x86_64-target-arch

compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// RUN: env XRAY_OPTIONS=verbosity=1 \
88
// RUN: XRAY_PROFILING_OPTIONS=no_flush=1 %run %t
99
// RUN: env XRAY_OPTIONS=verbosity=1 %run %t
10-
// RUN: PROFILES=`ls xray-log.profiling-multi-* | wc -l`
11-
// RUN: [ $PROFILES -eq 1 ]
10+
// RUN: ls xray-log.profiling-multi-* | wc -l | tr -d '\n' > %t.profiles
11+
// RUN: %python -c "import sys; sys.exit(int(sys.argv[1]) - 1)" %{readfile:%t.profiles}
1212
// RUN: rm -f xray-log.profiling-multi-*
1313
//
1414
// REQUIRES: built-in-llvm-tree

compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// RUN: env XRAY_OPTIONS=verbosity=1 \
88
// RUN: XRAY_PROFILING_OPTIONS=no_flush=true %run %t
99
// RUN: env XRAY_OPTIONS=verbosity=1 %run %t
10-
// RUN: PROFILES=`ls xray-log.profiling-single-* | wc -l`
11-
// RUN: [ $PROFILES -eq 2 ]
10+
// RUN: ls xray-log.profiling-single-* | wc -l | tr -d '\n' > %t.profiles
11+
// RUN: %python -c "import sys; sys.exit(int(sys.argv[1]) - 2)" %{readfile:%t.profiles}
1212
// RUN: rm -f xray-log.profiling-single-*
1313
//
1414
// REQUIRES: built-in-llvm-tree

0 commit comments

Comments
 (0)