[compiler-rt] e9185af - [compiler-rt] Fix some tests to work with lit internal shell. (#160728)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 10:59:37 PDT 2025
Author: cmtice
Date: 2025-09-26T10:59:33-07:00
New Revision: e9185af70a4898d050899aa83aa350e570459128
URL: https://github.com/llvm/llvm-project/commit/e9185af70a4898d050899aa83aa350e570459128
DIFF: https://github.com/llvm/llvm-project/commit/e9185af70a4898d050899aa83aa350e570459128.diff
LOG: [compiler-rt] Fix some tests to work with lit internal shell. (#160728)
This is part of our work to migrate lit tests to use internal shell by
default (performance improvements).
Added:
Modified:
compiler-rt/test/fuzzer/fork-sigusr.test
compiler-rt/test/fuzzer/sigint.test
compiler-rt/test/fuzzer/sigusr.test
compiler-rt/test/msan/allocator_mapping.cpp
compiler-rt/test/nsan/Posix/allocator_mapping.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/fuzzer/fork-sigusr.test b/compiler-rt/test/fuzzer/fork-sigusr.test
index 088e63cae4311..226c4147b7380 100644
--- a/compiler-rt/test/fuzzer/fork-sigusr.test
+++ b/compiler-rt/test/fuzzer/fork-sigusr.test
@@ -1,14 +1,16 @@
# Check that libFuzzer honors SIGUSR1/SIGUSR2
# Disabled on Windows which does not have SIGUSR1/SIGUSR2.
-REQUIRES: shell
UNSUPPORTED: darwin, target={{.*windows.*}}, target=aarch64{{.*}}
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/ForkSIGUSR
-RUN: %run %t/ForkSIGUSR -fork=3 -ignore_crashes=1 2>%t/log & export PID=$!
+# The line below needs the " | env" at the end, in order to make the
+# script continue executing, rather than waiting (forever) for the
+# 'nohup run...' command to finish.
+RUN: bash -c "nohup %run %t/ForkSIGUSR -fork=3 -ignore_crashes=1 2>%t/log & echo -n $! > %t2" | env
RUN: sleep 3
-RUN: kill -SIGUSR2 $PID
+RUN: kill -SIGUSR2 %{readfile:%t2}
RUN: sleep 6
RUN: cat %t/log | FileCheck %s --dump-input=fail
diff --git a/compiler-rt/test/fuzzer/sigint.test b/compiler-rt/test/fuzzer/sigint.test
index ac482d79b8e28..aa112f086066f 100644
--- a/compiler-rt/test/fuzzer/sigint.test
+++ b/compiler-rt/test/fuzzer/sigint.test
@@ -1,4 +1,4 @@
-REQUIRES: shell, msan
+REQUIRES: msan
UNSUPPORTED: target=arm{{.*}}
# Check that libFuzzer exits gracefully under SIGINT with MSan.
@@ -6,9 +6,12 @@ RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %msan_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGINT
-RUN: %run %t/LFSIGINT 2> %t/log & export PID=$!
+# The line below needs the " | env" at the end, in order to make the
+# script continue executing, rather than waiting (forever) for the
+# 'nohup run...' command to finish.
+RUN: bash -c "nohup %run %t/LFSIGINT 2> %t/log & echo -n $! > %t2" | env
RUN: sleep 2
-RUN: kill -SIGINT $PID
+RUN: kill -SIGINT %{readfile:%t2}
RUN: sleep 3
RUN: cat %t/log | FileCheck %s
diff --git a/compiler-rt/test/fuzzer/sigusr.test b/compiler-rt/test/fuzzer/sigusr.test
index c8a77ac63a6d7..0c1d29231e1a0 100644
--- a/compiler-rt/test/fuzzer/sigusr.test
+++ b/compiler-rt/test/fuzzer/sigusr.test
@@ -1,15 +1,17 @@
# FIXME: Disabled on Windows for now because of reliance on posix only features
# (eg: export, "&", pkill).
-REQUIRES: shell
UNSUPPORTED: darwin, target={{.*windows.*}}
# Check that libFuzzer honors SIGUSR1/SIGUSR2
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGUSR
-RUN: %run %t/LFSIGUSR 2> %t/log & export PID=$!
+# The line below needs the " | env" at the end, in order to make the
+# script continue executing, rather than waiting (forever) for the
+# 'nohup run...' command to finish.
+RUN: bash -c "nohup %run %t/LFSIGUSR 2> %t/log & echo -n $! > %t2"| env
RUN: sleep 2
-RUN: kill -SIGUSR1 $PID
+RUN: kill -SIGUSR1 %{readfile:%t2}
RUN: sleep 3
RUN: cat %t/log | FileCheck %s
diff --git a/compiler-rt/test/msan/allocator_mapping.cpp b/compiler-rt/test/msan/allocator_mapping.cpp
index e7a12da489152..aa48863861ecb 100644
--- a/compiler-rt/test/msan/allocator_mapping.cpp
+++ b/compiler-rt/test/msan/allocator_mapping.cpp
@@ -3,7 +3,8 @@
// mapping the heap early, in __msan_init.
//
// RUN: %clangxx_msan -O0 %s -o %t_1
-// RUN: %clangxx_msan -O0 -DHEAP_ADDRESS=$(%run %t_1) %s -o %t_2 && %run %t_2
+// RUN: %run %t_1 > %t_3
+// RUN: %clangxx_msan -O0 -DHEAP_ADDRESS=%{readfile:%t_3} %s -o %t_2 && %run %t_2
//
// This test only makes sense for the 64-bit allocator. The 32-bit allocator
// does not have a fixed mapping. Exclude platforms that use the 32-bit
diff --git a/compiler-rt/test/nsan/Posix/allocator_mapping.cpp b/compiler-rt/test/nsan/Posix/allocator_mapping.cpp
index 3a3e655e259d0..8be5008686385 100644
--- a/compiler-rt/test/nsan/Posix/allocator_mapping.cpp
+++ b/compiler-rt/test/nsan/Posix/allocator_mapping.cpp
@@ -2,7 +2,8 @@
/// Test that a module constructor can not map memory over the NSan heap
/// (without MAP_FIXED, of course).
// RUN: %clangxx_nsan -O0 %s -o %t_1
-// RUN: %clangxx_nsan -O0 -DHEAP_ADDRESS=$(%run %t_1) %s -o %t_2 && %run %t_2
+// RUN: %run %t_1 > %t_3
+// RUN: %clangxx_nsan -O0 -DHEAP_ADDRESS=%{readfile:%t_3} %s -o %t_2 && %run %t_2
#include <assert.h>
#include <stdio.h>
More information about the llvm-commits
mailing list