[compiler-rt] 53e3f8e - [XRay] Prefix setting XRAY_OPTIONS with env
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 06:53:12 PST 2025
Author: Aiden Grossman
Date: 2025-11-17T14:53:02Z
New Revision: 53e3f8e3c50ee28e33181514933c5632a001033b
URL: https://github.com/llvm/llvm-project/commit/53e3f8e3c50ee28e33181514933c5632a001033b
DIFF: https://github.com/llvm/llvm-project/commit/53e3f8e3c50ee28e33181514933c5632a001033b.diff
LOG: [XRay] Prefix setting XRAY_OPTIONS with env
So setting the environment variable works with the new internal shell.
This does not fix all the XRay tests because some of them are using
subshells and need to be rewritten to not use subshells.
Added:
Modified:
compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp
compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp
compiler-rt/test/xray/TestCases/Posix/c-test.cpp
compiler-rt/test/xray/TestCases/Posix/common-trampoline-alignment.cpp
compiler-rt/test/xray/TestCases/Posix/custom-event-handler-alignment.cpp
compiler-rt/test/xray/TestCases/Posix/custom-event-logging.cpp
compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp
compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp
compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp
compiler-rt/test/xray/TestCases/Posix/quiet-start.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp b/compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp
index 1440460c9de27..47e7a0710131d 100644
--- a/compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp
@@ -3,7 +3,7 @@
// RUN: %clangxx_xray -std=c++11 %s -o %t -g
// RUN: rm -f basic-filtering-*
-// RUN: XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1 \
+// RUN: env XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1 \
// RUN: xray_logfile_base=basic-filtering- \
// RUN: xray_naive_log_func_duration_threshold_us=1000 \
// RUN: xray_naive_log_max_stack_depth=2" %run %t 2>&1 | \
@@ -14,9 +14,9 @@
// RUN: rm -f basic-filtering-*
//
// Now check support for the XRAY_BASIC_OPTIONS environment variable.
-// RUN: XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1 \
+// RUN: env XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1 \
// RUN: xray_logfile_base=basic-filtering-" \
-// RUN: XRAY_BASIC_OPTIONS="func_duration_threshold_us=1000 max_stack_depth=2" \
+// RUN: env XRAY_BASIC_OPTIONS="func_duration_threshold_us=1000 max_stack_depth=2" \
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
// RUN: "`ls basic-filtering-* | head -1`" | \
diff --git a/compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp b/compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp
index d40dcd808bcba..eb76d5f95b6cd 100644
--- a/compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/basic-mode-dso.cpp
@@ -4,7 +4,7 @@
// RUN: %clangxx_xray -g -fPIC -fxray-instrument -fxray-shared -shared -std=c++11 %t/testlib.cpp -o %t/testlib.so
// 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
-// RUN: 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
+// 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
// RUN: %llvm_xray account --format=csv --sort=funcid "`ls basic-mode-dso-* | head -1`" | FileCheck --check-prefix=ACCOUNT %s
// RUN: rm basic-mode-dso-*
diff --git a/compiler-rt/test/xray/TestCases/Posix/c-test.cpp b/compiler-rt/test/xray/TestCases/Posix/c-test.cpp
index 6427566186514..d7c766682f38f 100644
--- a/compiler-rt/test/xray/TestCases/Posix/c-test.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/c-test.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_xray -g -fxray-modes=xray-basic,xray-fdr,xray-profiling -o %t %s
// RUN: rm -f xray-log.c-test.*
-// RUN: XRAY_OPTIONS=patch_premain=true:verbosity=1:xray_mode=xray-basic %t \
+// RUN: env XRAY_OPTIONS=patch_premain=true:verbosity=1:xray_mode=xray-basic %t \
// RUN: 2>&1 | FileCheck %s
// RUN: rm -f xray-log.c-test.*
//
diff --git a/compiler-rt/test/xray/TestCases/Posix/common-trampoline-alignment.cpp b/compiler-rt/test/xray/TestCases/Posix/common-trampoline-alignment.cpp
index f9189644b40b8..d072e57f5cdbc 100644
--- a/compiler-rt/test/xray/TestCases/Posix/common-trampoline-alignment.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/common-trampoline-alignment.cpp
@@ -2,7 +2,7 @@
// expect 16-byte alignment of the stack.
//
// RUN: %clangxx_xray -std=c++11 %s -o %t
-// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" \
+// RUN: env XRAY_OPTIONS="patch_premain=false verbosity=1" \
// RUN: %run %t 2>&1
// REQUIRES: x86_64-target-arch
// REQUIRES: built-in-llvm-tree
diff --git a/compiler-rt/test/xray/TestCases/Posix/custom-event-handler-alignment.cpp b/compiler-rt/test/xray/TestCases/Posix/custom-event-handler-alignment.cpp
index 9c61cba83b0da..19154820d5089 100644
--- a/compiler-rt/test/xray/TestCases/Posix/custom-event-handler-alignment.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/custom-event-handler-alignment.cpp
@@ -2,7 +2,7 @@
// calls.
//
// RUN: %clangxx_xray -std=c++11 %s -o %t
-// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" \
+// RUN: env XRAY_OPTIONS="patch_premain=false verbosity=1" \
// RUN: %run %t 2>&1
// REQUIRES: x86_64-target-arch
// REQUIRES: built-in-llvm-tree
diff --git a/compiler-rt/test/xray/TestCases/Posix/custom-event-logging.cpp b/compiler-rt/test/xray/TestCases/Posix/custom-event-logging.cpp
index 30f4fffa429ee..cbdfe6c57b38e 100644
--- a/compiler-rt/test/xray/TestCases/Posix/custom-event-logging.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/custom-event-logging.cpp
@@ -1,9 +1,9 @@
// Use the clang feature for custom xray event logging.
//
// RUN: %clangxx_xray -std=c++11 %s -o %t
-// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1 xray_logfile_base=custom-event-logging.xray-" %run %t 2>&1 | FileCheck %s
+// RUN: env XRAY_OPTIONS="patch_premain=false verbosity=1 xray_logfile_base=custom-event-logging.xray-" %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_xray -std=c++11 -fpic -fpie %s -o %t
-// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1 xray_logfile_base=custom-event-logging.xray-" %run %t 2>&1 | FileCheck %s
+// RUN: env XRAY_OPTIONS="patch_premain=false verbosity=1 xray_logfile_base=custom-event-logging.xray-" %run %t 2>&1 | FileCheck %s
// FIXME: Support this in non-x86_64 as well
// REQUIRES: target={{(aarch64|x86_64)-.*linux.*}}
// REQUIRES: built-in-llvm-tree
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
index 6c94dbd8b21d2..0517c9a9b47e5 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-inmemory.cpp
@@ -2,9 +2,9 @@
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir
// RUN: cd %t.dir
-// RUN: XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
+// RUN: env XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
// RUN: verbosity=1" \
-// RUN: XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
+// RUN: env XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
// RUN: [ $FILES -eq 0 ]
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
index f9288d9002de0..a545f540bc6e7 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode-multiple.cpp
@@ -2,9 +2,9 @@
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir
// RUN: cd %t.dir
-// RUN: XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
+// RUN: env XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-inmemory-test- \
// RUN: verbosity=1" \
-// RUN: XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
+// RUN: env XRAY_FDR_OPTIONS="no_file_flush=true func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: FILES=`find %t.dir -name 'fdr-inmemory-test-*' | wc -l`
// RUN: [ $FILES -eq 0 ]
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
index 0ee8aaa755d5a..e74cacd1fe9ff 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
@@ -1,14 +1,14 @@
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
// RUN: rm -f fdr-logging-test-*
// RUN: rm -f fdr-unwrite-test-*
-// RUN: XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-logging-test- \
+// RUN: env XRAY_OPTIONS="patch_premain=false xray_logfile_base=fdr-logging-test- \
// RUN: xray_mode=xray-fdr verbosity=1" \
-// RUN: XRAY_FDR_OPTIONS="func_duration_threshold_us=0" \
+// RUN: env XRAY_FDR_OPTIONS="func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
-// RUN: XRAY_OPTIONS="patch_premain=false \
+// RUN: env XRAY_OPTIONS="patch_premain=false \
// RUN: xray_logfile_base=fdr-unwrite-test- xray_mode=xray-fdr \
// RUN: verbosity=1" \
-// RUN: XRAY_FDR_OPTIONS="func_duration_threshold_us=5000" \
+// RUN: env XRAY_FDR_OPTIONS="func_duration_threshold_us=5000" \
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
// RUN: "`ls fdr-logging-test-* | head -1`" \
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp
index 85284fc27ab38..d3fd2536ead00 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp
@@ -1,6 +1,6 @@
// RUN: rm -rf %t && mkdir %t
// RUN: %clangxx_xray -g -std=c++11 %s -o %t.exe
-// RUN: XRAY_OPTIONS="patch_premain=false \
+// RUN: env XRAY_OPTIONS="patch_premain=false \
// RUN: xray_logfile_base=%t/ xray_mode=xray-fdr verbosity=1" \
// RUN: XRAY_FDR_OPTIONS=func_duration_threshold_us=0 %run %t.exe 2>&1 | \
// RUN: FileCheck %s
diff --git a/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp b/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
index 58f310e3a1083..6f201a329db24 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
@@ -1,7 +1,7 @@
// Check that when forking in basic logging mode, we get the
diff erent tids for child and parent
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
// RUN: rm -f fork-basic-logging-test-*
-// RUN: XRAY_OPTIONS="patch_premain=true xray_logfile_base=fork-basic-logging-test- \
+// RUN: env XRAY_OPTIONS="patch_premain=true xray_logfile_base=fork-basic-logging-test- \
// RUN: xray_mode=xray-basic verbosity=1 xray_naive_log_func_duration_threshold_us=0" \
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
diff --git a/compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp b/compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp
index b850c053681a1..5d00d0f02b3e1 100644
--- a/compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/profiling-multi-threaded.cpp
@@ -4,9 +4,9 @@
// FIXME: Make -fxray-modes=xray-profiling part of the default?
// RUN: %clangxx_xray -std=c++11 %s -o %t -fxray-modes=xray-profiling
// RUN: rm -f xray-log.profiling-multi-*
-// RUN: XRAY_OPTIONS=verbosity=1 \
+// RUN: env XRAY_OPTIONS=verbosity=1 \
// RUN: XRAY_PROFILING_OPTIONS=no_flush=1 %run %t
-// RUN: XRAY_OPTIONS=verbosity=1 %run %t
+// RUN: env XRAY_OPTIONS=verbosity=1 %run %t
// RUN: PROFILES=`ls xray-log.profiling-multi-* | wc -l`
// RUN: [ $PROFILES -eq 1 ]
// RUN: rm -f xray-log.profiling-multi-*
diff --git a/compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp b/compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp
index b2359607379d6..d0226613db7c1 100644
--- a/compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/profiling-single-threaded.cpp
@@ -4,9 +4,9 @@
// FIXME: Make -fxray-modes=xray-profiling part of the default?
// RUN: %clangxx_xray -std=c++11 %s -o %t -fxray-modes=xray-profiling
// RUN: rm -f xray-log.profiling-single-*
-// RUN: XRAY_OPTIONS=verbosity=1 \
+// RUN: env XRAY_OPTIONS=verbosity=1 \
// RUN: XRAY_PROFILING_OPTIONS=no_flush=true %run %t
-// RUN: XRAY_OPTIONS=verbosity=1 %run %t
+// RUN: env XRAY_OPTIONS=verbosity=1 %run %t
// RUN: PROFILES=`ls xray-log.profiling-single-* | wc -l`
// RUN: [ $PROFILES -eq 2 ]
// RUN: rm -f xray-log.profiling-single-*
diff --git a/compiler-rt/test/xray/TestCases/Posix/quiet-start.cpp b/compiler-rt/test/xray/TestCases/Posix/quiet-start.cpp
index 48830017047c0..d8e96e0297bd1 100644
--- a/compiler-rt/test/xray/TestCases/Posix/quiet-start.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/quiet-start.cpp
@@ -2,11 +2,11 @@
// instrumentation sleds.
//
// RUN: %clangxx -std=c++11 %s -o %t %xraylib
-// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1" %run %t 2>&1 | \
+// RUN: env XRAY_OPTIONS="patch_premain=true verbosity=1" %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix NOISY
-// RUN: XRAY_OPTIONS="patch_premain=true verbosity=0" %run %t 2>&1 | \
+// RUN: env XRAY_OPTIONS="patch_premain=true verbosity=0" %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix QUIET
-// RUN: XRAY_OPTIONS="" %run %t 2>&1 | FileCheck %s --check-prefix DEFAULT
+// RUN: env XRAY_OPTIONS="" %run %t 2>&1 | FileCheck %s --check-prefix DEFAULT
// REQUIRES: built-in-llvm-tree
More information about the llvm-commits
mailing list