[compiler-rt] r210647 - [asan] One more coverage test.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Wed Jun 11 02:23:26 PDT 2014
Author: eugenis
Date: Wed Jun 11 04:23:25 2014
New Revision: 210647
URL: http://llvm.org/viewvc/llvm-project?rev=210647&view=rev
Log:
[asan] One more coverage test.
Test that coverage is dumped correctly (and completely) even when the processed
gets SIGKILL-ed.
Modified:
compiler-rt/trunk/test/asan/TestCases/Android/coverage-android.cc
Modified: compiler-rt/trunk/test/asan/TestCases/Android/coverage-android.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Android/coverage-android.cc?rev=210647&r1=210646&r2=210647&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Android/coverage-android.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Android/coverage-android.cc Wed Jun 11 04:23:25 2014
@@ -1,16 +1,35 @@
// Test for direct coverage writing with dlopen.
+
+// Test normal exit.
// RUN: %clangxx_asan -mllvm -asan-coverage=1 -DSHARED %s -shared -o %T/libcoverage_android_test_1.so -fPIC
// RUN: %clangxx_asan -mllvm -asan-coverage=1 -DSO_DIR=\"%device\" %s -o %t
-// RUN: adb shell rm -rf %device/coverage-direct
-// RUN: rm -rf %T/coverage-direct
+// RUN: adb shell rm -rf %device/coverage-android
+// RUN: rm -rf %T/coverage-android
+
+// RUN: adb shell mkdir -p %device/coverage-android/direct
+// RUN: mkdir -p %T/coverage-android/direct
+// RUN: ASAN_OPTIONS=coverage=1:coverage_direct=1:coverage_dir=%device/coverage-android/direct:verbosity=1 %run %t
+// RUN: adb pull %device/coverage-android/direct %T/coverage-android/direct
+// RUN: ls; pwd
+// RUN: cd %T/coverage-android/direct
+// RUN: %sancov rawunpack *.sancov.raw
+// RUN: %sancov print *.sancov |& FileCheck %s
+
+
+// Test sudden death.
+// RUN: %clangxx_asan -mllvm -asan-coverage=1 -DSHARED -DKILL %s -shared -o %T/libcoverage_android_test_1.so -fPIC
+// RUN: %clangxx_asan -mllvm -asan-coverage=1 -DSO_DIR=\"%device\" %s -o %t
+
+// RUN: adb shell rm -rf %device/coverage-android-kill
+// RUN: rm -rf %T/coverage-android-kill
-// RUN: adb shell mkdir -p %device/coverage-direct/direct
-// RUN: mkdir -p %T/coverage-direct/direct
-// RUN: ASAN_OPTIONS=coverage=1:coverage_direct=1:coverage_dir=%device/coverage-direct/direct:verbosity=1 %run %t
-// RUN: adb pull %device/coverage-direct/direct %T/coverage-direct/direct
+// RUN: adb shell mkdir -p %device/coverage-android-kill/direct
+// RUN: mkdir -p %T/coverage-android-kill/direct
+// RUN: ASAN_OPTIONS=coverage=1:coverage_direct=1:coverage_dir=%device/coverage-android-kill/direct:verbosity=1 not %run %t
+// RUN: adb pull %device/coverage-android-kill/direct %T/coverage-android-kill/direct
// RUN: ls; pwd
-// RUN: cd %T/coverage-direct/direct
+// RUN: cd %T/coverage-android-kill/direct
// RUN: %sancov rawunpack *.sancov.raw
// RUN: %sancov print *.sancov |& FileCheck %s
@@ -18,10 +37,17 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <signal.h>
#ifdef SHARED
extern "C" {
-void bar() { printf("bar\n"); }
+void bar() {
+ printf("bar\n");
+#ifdef KILL
+ kill(getpid(), SIGKILL);
+#endif
+}
}
#else
More information about the llvm-commits
mailing list