// 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));
// 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__)
#!/usr/bin/python
-import os, sys, subprocess, tempfile
+import os, signal, sys, subprocess, tempfile
from android_common import *
ANDROID_TMPDIR = '/data/local/tmp/Output'
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)
# 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 += ':'