Skip to content

Commit 12504ae

Browse files
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.7 [skip ci]
1 parent f03ccef commit 12504ae

File tree

18 files changed

+77
-18
lines changed

18 files changed

+77
-18
lines changed

compiler-rt/test/asan/TestCases/log-path_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
// RUN: FileCheck %s --check-prefix=CHECK-BAD-DIR < %t.out
2626

2727
// Too long log_path.
28-
// RUN: %env_asan_opts=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \
28+
// RUN: %python -c "for i in range(0, 10000): print(i, end='')" > %t.long_log_path
29+
// RUN: %env_asan_opts=log_path=%{readfile:%t.long_log_path} \
2930
// RUN: not %run %t 2> %t.out
3031
// RUN: FileCheck %s --check-prefix=CHECK-LONG < %t.out
3132

compiler-rt/test/asan/TestCases/scariness_score_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: %clangxx_asan -O0 -mllvm -asan-use-stack-safety=0 %s -o %t
77
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
88
// off by default. It's safe for these tests, though, so we turn it on.
9-
// RUN: export %env_asan_opts=symbolize=0:detect_stack_use_after_return=1:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
9+
// RUN: %export_asan_opts=symbolize=0:detect_stack_use_after_return=1:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
1010
// Make sure the stack is limited (may not be the default under GNU make)
1111
// RUN: ulimit -s 4096
1212
// RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK1
@@ -41,7 +41,7 @@
4141
// RUN: %clangxx_asan -O0 %s -o %t -fsanitize-address-use-after-return=always -mllvm -asan-use-stack-safety=0
4242
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
4343
// off by default. It's safe for these tests, though, so we turn it on.
44-
// RUN: export %env_asan_opts=symbolize=0:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
44+
// RUN: %export_asan_opts=symbolize=0:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
4545
// Make sure the stack is limited (may not be the default under GNU make)
4646
// RUN: ulimit -s 4096
4747
// RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK1

compiler-rt/test/asan/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def get_required_attr(config, attr_name):
4141
config.substitutions.append(
4242
("%env_asan_opts=", "env ASAN_OPTIONS=" + default_asan_opts_str)
4343
)
44+
config.substitutions.append(
45+
("%export_asan_opts=", "export ASAN_OPTIONS=" + default_asan_opts_str)
46+
)
4447

4548
# Setup source root.
4649
config.test_source_root = os.path.dirname(__file__)

compiler-rt/test/lit.common.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,3 +1066,5 @@ def target_page_size():
10661066
# llvm.
10671067
config.substitutions.append(("%crt_src", config.compiler_rt_src_root))
10681068
config.substitutions.append(("%llvm_src", config.llvm_src_root))
1069+
1070+
config.substitutions.append(("%python", '"%s"' % (sys.executable)))

compiler-rt/test/memprof/TestCases/log_path_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
// RUN: %env_memprof_opts=print_text=true:log_path=/dev/null/INVALID not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-DIR --dump-input=always
1919

2020
// Too long log_path.
21-
// RUN: %env_memprof_opts=print_text=true:log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \
21+
// RUN: %python -c "for i in range(0, 10000): print(i, end='')" > %t.long_log_path
22+
// RUN: %env_memprof_opts=print_text=true:log_path=%{readfile:%t.long_log_path} \
2223
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-LONG --dump-input=always
2324

2425
// Specifying the log name via the __memprof_profile_filename variable.

compiler-rt/test/msan/allocator_mapping.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// mapping the heap early, in __msan_init.
44
//
55
// RUN: %clangxx_msan -O0 %s -o %t_1
6-
// RUN: %clangxx_msan -O0 -DHEAP_ADDRESS=$(%run %t_1) %s -o %t_2 && %run %t_2
6+
// RUN: %run %t_1 > %t.heap_address
7+
// RUN: %clangxx_msan -O0 -DHEAP_ADDRESS=%{readfile:%t.heap_address} %s -o %t_2 && %run %t_2
78
//
89
// This test only makes sense for the 64-bit allocator. The 32-bit allocator
910
// does not have a fixed mapping. Exclude platforms that use the 32-bit

compiler-rt/test/nsan/Posix/allocator_mapping.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/// Test that a module constructor can not map memory over the NSan heap
33
/// (without MAP_FIXED, of course).
44
// RUN: %clangxx_nsan -O0 %s -o %t_1
5-
// RUN: %clangxx_nsan -O0 -DHEAP_ADDRESS=$(%run %t_1) %s -o %t_2 && %run %t_2
5+
// RUN: %run %t_1 > %t.heap_address
6+
// RUN: %clangxx_nsan -O0 -DHEAP_ADDRESS=%{readfile:%t.heap_address} %s -o %t_2 && %run %t_2
67

78
#include <assert.h>
89
#include <stdio.h>

compiler-rt/test/profile/instrprof-hostname.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_profgen -o %t -O3 %s
22
// RUN: env LLVM_PROFILE_FILE=%h.%t-%h.profraw_%h %run %t
3-
// RUN: %run uname -n > %t.n
4-
// RUN: llvm-profdata merge -o %t.profdata `cat %t.n`.%t-`cat %t.n`.profraw_`cat %t.n`
3+
// RUN: %run uname -n | tr -d '\n' > %t.n
4+
// RUN: llvm-profdata merge -o %t.profdata %{readfile:%t.n}.%t-%{readfile:%t.n}.profraw_%{readfile:%t.n}
55
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
66
// REQUIRES: shell
77

compiler-rt/test/xray/TestCases/Posix/fdr-single-thread.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
22
// RUN: rm -f fdr-logging-1thr-*
3-
// RUN: XRAY_OPTIONS=XRAY_OPTIONS="verbosity=1 patch_premain=true \
3+
// RUN: env XRAY_OPTIONS=XRAY_OPTIONS="verbosity=1 patch_premain=true \
44
// RUN: xray_fdr_log=true \
55
// RUN: xray_fdr_log_func_duration_threshold_us=0 \
66
// RUN: xray_logfile_base=fdr-logging-1thr-" %run %t 2>&1
7+
// RUN: ls fdr-logging-1thr-* | head -n1 | tr -d '\n' > %t.xray_input
78
// RUN: %llvm_xray convert --output-format=yaml --symbolize --instr_map=%t \
8-
// RUN: "`ls fdr-logging-1thr-* | head -n1`" | FileCheck %s
9+
// RUN: "%{readfile:%t.xray_input}" | FileCheck %s
910
// RUN: rm fdr-logging-1thr-*
1011

1112
// UNSUPPORTED: target=arm{{.*}}

llvm/utils/lit/lit/TestRunner.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,16 +602,30 @@ def executeBuiltinUlimit(cmd, shenv):
602602
"""executeBuiltinUlimit - Change the current limits."""
603603
if os.name != "posix":
604604
raise InternalShellError(cmd, "'ulimit' not supported on this system")
605+
# Import resource here after we confirm we are on a POSIX system as the
606+
# module does not exist on Windows.
607+
import resource
605608
if len(cmd.args) != 3:
606609
raise InternalShellError(cmd, "'ulimit' requires two arguments")
607610
try:
608-
new_limit = int(cmd.args[2])
611+
if cmd.args[2] == "unlimited":
612+
new_limit = resource.RLIM_INFINITY
613+
else:
614+
new_limit = int(cmd.args[2])
609615
except ValueError as err:
610616
raise InternalShellError(cmd, "Error: 'ulimit': %s" % str(err))
611617
if cmd.args[1] == "-v":
612-
shenv.ulimit["RLIMIT_AS"] = new_limit * 1024
618+
if new_limit != resource.RLIM_INFINITY:
619+
new_limit = new_limit * 1024
620+
shenv.ulimit["RLIMIT_AS"] = new_limit
613621
elif cmd.args[1] == "-n":
614622
shenv.ulimit["RLIMIT_NOFILE"] = new_limit
623+
elif cmd.args[1] == "-s":
624+
if new_limit != resource.RLIM_INFINITY:
625+
new_limit = new_limit * 1024
626+
shenv.ulimit["RLIMIT_STACK"] = new_limit
627+
elif cmd.args[1] == "-f":
628+
shenv.ulimit["RLIMIT_FSIZE"] = new_limit
615629
else:
616630
raise InternalShellError(
617631
cmd, "'ulimit' does not support option: %s" % cmd.args[1]
@@ -811,6 +825,10 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
811825
not_args = []
812826
not_count = 0
813827
not_crash = False
828+
829+
# Expand all late substitutions.
830+
args = _expandLateSubstitutions(j, args, cmd_shenv.cwd)
831+
814832
while True:
815833
if args[0] == "env":
816834
# Create a copy of the global environment and modify it for
@@ -860,9 +878,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
860878
# Ensure args[0] is hashable.
861879
args[0] = expand_glob(args[0], cmd_shenv.cwd)[0]
862880

863-
# Expand all late substitutions.
864-
args = _expandLateSubstitutions(j, args, cmd_shenv.cwd)
865-
866881
inproc_builtin = inproc_builtins.get(args[0], None)
867882
if inproc_builtin and (args[0] != "echo" or len(cmd.commands) == 1):
868883
# env calling an in-process builtin is useless, so we take the safe

0 commit comments

Comments
 (0)