mgorny created this revision.
mgorny added reviewers: krytarowski, rnk, samsonov, howard.hinnant.
Herald added subscribers: llvm-commits, dberris.
Herald added a project: LLVM.

Introduce a new %paxctl_nomprotect substitution and call it on two
builtin tests that do not work with MPROTECT on NetBSD.  This
substitution evaluates to no-op command (':') on other systems.


https://reviews.llvm.org/D71513

Files:
  compiler-rt/test/builtins/Unit/clear_cache_test.c
  compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
  compiler-rt/test/lit.common.cfg.py


Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -504,3 +504,6 @@
                                  "test", "sanitizer_common", "netbsd_commands")
   config.netbsd_noaslr_prefix = ('sh ' +
                                  os.path.join(nb_commands_dir, 
'run_noaslr.sh'))
+  config.substitutions.append( ('%paxctl_nomprotect', '/usr/sbin/paxctl +m') )
+else:
+  config.substitutions.append( ('%paxctl_nomprotect', ':') )
Index: compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
+++ 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 && %paxctl_nomprotect %t && %run %t
 // REQUIRES: librt_has_enable_execute_stack
 //===-- enable_execute_stack_test.c - Test __enable_execute_stack 
----------===//
 //
Index: compiler-rt/test/builtins/Unit/clear_cache_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/clear_cache_test.c
+++ 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 && %paxctl_nomprotect %t && %run %t
 // REQUIRES: librt_has_clear_cache
 //===-- clear_cache_test.c - Test clear_cache 
-----------------------------===//
 //


Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -504,3 +504,6 @@
                                  "test", "sanitizer_common", "netbsd_commands")
   config.netbsd_noaslr_prefix = ('sh ' +
                                  os.path.join(nb_commands_dir, 'run_noaslr.sh'))
+  config.substitutions.append( ('%paxctl_nomprotect', '/usr/sbin/paxctl +m') )
+else:
+  config.substitutions.append( ('%paxctl_nomprotect', ':') )
Index: compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
+++ 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 && %paxctl_nomprotect %t && %run %t
 // REQUIRES: librt_has_enable_execute_stack
 //===-- enable_execute_stack_test.c - Test __enable_execute_stack ----------===//
 //
Index: compiler-rt/test/builtins/Unit/clear_cache_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/clear_cache_test.c
+++ 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 && %paxctl_nomprotect %t && %run %t
 // REQUIRES: librt_has_clear_cache
 //===-- clear_cache_test.c - Test clear_cache -----------------------------===//
 //
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to