summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-09-09 18:43:24 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-09-09 18:43:24 +0000
commit627d78f6c2c19e3539193213fd9700c697991acf (patch)
treeb4d3c79b7aa8a53c31a33dd93e716459772e0973 /compiler-rt/test
parent22ce5eb051591b828b1ce4238624b6e95d334a5b (diff)
downloadbcm5719-llvm-627d78f6c2c19e3539193213fd9700c697991acf.tar.gz
bcm5719-llvm-627d78f6c2c19e3539193213fd9700c697991acf.zip
[asan] Disable handle_abort in Android tests.
The same thing is already done on Mac. handle_abort slows down tests significantly because it triggers tombstone collection on Android; also, it changes failed test outcome from "not-crash" to "crash" (as in "bin/not --crash"). This change adds handle_abort=0 to asan options on android (test only!), and also tweaks android_run.py to semi-correctly pass the crash/no-crash status to the caller. llvm-svn: 281075
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/abort_on_error.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/atexit_stats.cc4
-rwxr-xr-xcompiler-rt/test/asan/android_commands/android_run.py9
-rw-r--r--compiler-rt/test/asan/lit.cfg6
4 files changed, 17 insertions, 4 deletions
diff --git a/compiler-rt/test/asan/TestCases/Linux/abort_on_error.cc b/compiler-rt/test/asan/TestCases/Linux/abort_on_error.cc
index 67fa9b83e65..3f70613e4c7 100644
--- a/compiler-rt/test/asan/TestCases/Linux/abort_on_error.cc
+++ b/compiler-rt/test/asan/TestCases/Linux/abort_on_error.cc
@@ -9,6 +9,8 @@
// lit doesn't set ASAN_OPTIONS anyway.
// RUN: not %run %t 2>&1 | FileCheck %s
+// UNSUPPORTED: android
+
#include <stdlib.h>
int main() {
char *x = (char*)malloc(10 * sizeof(char));
diff --git a/compiler-rt/test/asan/TestCases/atexit_stats.cc b/compiler-rt/test/asan/TestCases/atexit_stats.cc
index 42a3fbf23f5..f0b5830b405 100644
--- a/compiler-rt/test/asan/TestCases/atexit_stats.cc
+++ b/compiler-rt/test/asan/TestCases/atexit_stats.cc
@@ -2,9 +2,9 @@
// RUN: %clangxx_asan -O3 %s -o %t
// RUN: %env_asan_opts=atexit=1:print_stats=1 %run %t 2>&1 | FileCheck %s
//
-// No atexit output on Android due to
+// No atexit output in older versions of Android due to
// https://code.google.com/p/address-sanitizer/issues/detail?id=263
-// XFAIL: android
+// UNSUPPORTED: android
#include <stdlib.h>
#if !defined(__APPLE__) && !defined(__FreeBSD__)
diff --git a/compiler-rt/test/asan/android_commands/android_run.py b/compiler-rt/test/asan/android_commands/android_run.py
index 272d2110e5a..9f7bdeef577 100755
--- a/compiler-rt/test/asan/android_commands/android_run.py
+++ b/compiler-rt/test/asan/android_commands/android_run.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-import os, sys, subprocess, tempfile
+import os, signal, sys, subprocess, tempfile
from android_common import *
ANDROID_TMPDIR = '/data/local/tmp/Output'
@@ -34,4 +34,9 @@ if ret != 0:
sys.stdout.write(pull_from_device(device_stdout))
sys.stderr.write(pull_from_device(device_stderr))
-sys.exit(int(pull_from_device(device_exitcode)))
+retcode = int(pull_from_device(device_exitcode))
+# If the device process died with a signal, do abort().
+# Not exactly the same, but good enough to fool "not --crash".
+if retcode > 128:
+ os.kill(os.getpid(), signal.SIGABRT)
+sys.exit(retcode)
diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg
index f2c0c872e01..feb851bcd6a 100644
--- a/compiler-rt/test/asan/lit.cfg
+++ b/compiler-rt/test/asan/lit.cfg
@@ -37,6 +37,12 @@ if config.host_os == 'Darwin':
# Also, make sure we do not overwhelm the syslog while testing.
default_asan_opts = 'abort_on_error=0'
default_asan_opts += ':log_to_syslog=0'
+elif config.android:
+ # The same as on Darwin, we default to "abort_on_error=1" which slows down
+ # testing. Also, all existing tests are using "not" instead of "not --crash"
+ # which does not work for abort()-terminated programs.
+ default_asan_opts = 'abort_on_error=0'
+
if default_asan_opts:
config.environment['ASAN_OPTIONS'] = default_asan_opts
default_asan_opts += ':'
OpenPOWER on IntegriCloud