[compiler-rt] r374211 - [sanitizer] Use raise() in test and cover more signals

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 13:18:28 PDT 2019


Author: vitalybuka
Date: Wed Oct  9 13:18:27 2019
New Revision: 374211

URL: http://llvm.org/viewvc/llvm-project?rev=374211&view=rev
Log:
[sanitizer] Use raise() in test and cover more signals

Added:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_name.cpp
Removed:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_trap.cpp

Added: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_name.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_name.cpp?rev=374211&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_name.cpp (added)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_name.cpp Wed Oct  9 13:18:27 2019
@@ -0,0 +1,19 @@
+// RUN: %clangxx -O1 %s -o %t 
+// RUN: %env_tool_opts=handle_sigfpe=2 not %run %t 0 2>&1 | FileCheck %s -DSIGNAME=FPE
+// RUN: %env_tool_opts=handle_sigill=2 not %run %t 1 2>&1 | FileCheck %s -DSIGNAME=ILL
+// RUN: %env_tool_opts=handle_abort=2 not %run %t 2 2>&1 | FileCheck %s -DSIGNAME=ABRT
+// RUN: %env_tool_opts=handle_segv=2 not %run %t 3 2>&1 | FileCheck %s -DSIGNAME=SEGV
+// RUN: %env_tool_opts=handle_sigbus=2 not %run %t 4 2>&1 | FileCheck %s -DSIGNAME=BUS
+// RUN: %env_tool_opts=handle_sigtrap=2 not %run %t 5 2>&1 | FileCheck %s -DSIGNAME=TRAP
+
+#include <signal.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+  if (argc != 2) return 0;
+  int signals[] = {SIGFPE, SIGILL, SIGABRT, SIGSEGV, SIGBUS, SIGTRAP};
+  raise(signals[atoi(argv[1])]);
+}
+
+// CHECK: Sanitizer:DEADLYSIGNAL
+// CHECK: Sanitizer: [[SIGNAME]] on unknown address

Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_trap.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_trap.cpp?rev=374210&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_trap.cpp (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_trap.cpp (removed)
@@ -1,8 +0,0 @@
-// RUN: %clangxx -O1 %s -o %t && %env_tool_opts=handle_sigtrap=2 not %run %t 2>&1 | FileCheck %s
-
-int main() {
-  __builtin_debugtrap();
-}
-
-// CHECK: Sanitizer:DEADLYSIGNAL
-// CHECK: Sanitizer: TRAP on unknown address




More information about the llvm-commits mailing list