diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-12-14 17:03:48 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-12-20 17:50:53 +0100 |
commit | 190b9110c23c0c742602d686e4a5bcff3d94fba1 (patch) | |
tree | 9ff7f68601a58f43ab2ee394abee0acbf3af63d4 /compiler-rt | |
parent | e1882af9f6701c2ddcd2853ffeff456d5a8bf8e3 (diff) | |
download | bcm5719-llvm-190b9110c23c0c742602d686e4a5bcff3d94fba1.tar.gz bcm5719-llvm-190b9110c23c0c742602d686e4a5bcff3d94fba1.zip |
[compiler-rt] [test] Disable MPROTECT on two builtin tests
Introduce a new %run_nomprotect substitution to run tests that do not
work with MPROTECT enabled. This uses paxctl via a wrapper on NetBSD,
and evaluates to plain %run on other systems.
Differential Revision: https://reviews.llvm.org/D71513
Diffstat (limited to 'compiler-rt')
4 files changed, 18 insertions, 8 deletions
diff --git a/compiler-rt/test/builtins/Unit/clear_cache_test.c b/compiler-rt/test/builtins/Unit/clear_cache_test.c index bc7b00608f2..270dc73035c 100644 --- a/compiler-rt/test/builtins/Unit/clear_cache_test.c +++ b/compiler-rt/test/builtins/Unit/clear_cache_test.c @@ -1,6 +1,6 @@ // REQUIRES: native-run // UNSUPPORTED: arm, aarch64 -// RUN: %clang_builtins %s %librt -o %t && %run %t +// RUN: %clang_builtins %s %librt -o %t && %run_nomprotect %t // REQUIRES: librt_has_clear_cache //===-- clear_cache_test.c - Test clear_cache -----------------------------===// // diff --git a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c index ad39915d3a2..5e835ce3af4 100644 --- a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c +++ b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c @@ -1,5 +1,5 @@ // REQUIRES: native-run -// RUN: %clang_builtins %s %librt -o %t && %run %t +// RUN: %clang_builtins %s %librt -o %t && %run_nomprotect %t // REQUIRES: librt_has_enable_execute_stack //===-- enable_execute_stack_test.c - Test __enable_execute_stack ----------===// // diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index 1a955ac0ea4..bf2190a93da 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -112,6 +112,19 @@ config.substitutions.append( (' clang', """\n\n*** Do not use 'clangXXX' in tests, instead define '%clangXXX' substitution in lit config. ***\n\n""") ) +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.netbsd_noaslr_prefix = ('sh ' + + os.path.join(nb_commands_dir, 'run_noaslr.sh')) + config.netbsd_nomprotect_prefix = ('sh ' + + os.path.join(nb_commands_dir, + 'run_nomprotect.sh')) + config.substitutions.append( ('%run_nomprotect', + config.netbsd_nomprotect_prefix) ) +else: + config.substitutions.append( ('%run_nomprotect', '%run') ) + # Allow tests to be executed on a simulator or remotely. if config.emulator: config.substitutions.append( ('%run', config.emulator) ) @@ -498,9 +511,3 @@ elif config.use_lld and (not config.has_lld): config.clang = " " + " ".join(run_wrapper + [config.compile_wrapper, config.clang]) + " " config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " " - -if config.host_os == 'NetBSD': - nb_commands_dir = os.path.join(config.compiler_rt_src_root, - "test", "sanitizer_common", "netbsd_commands") - config.netbsd_noaslr_prefix = ('sh ' + - os.path.join(nb_commands_dir, 'run_noaslr.sh')) diff --git a/compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh b/compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh new file mode 100644 index 00000000000..4a5c705dcfa --- /dev/null +++ b/compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/sbin/paxctl +m "${1}" +exec "${@}" |