<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 3:58 PM, Reid Kleckner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Wed Aug 12 17:58:56 2015<br>
New Revision: 244827<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=244827&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=244827&view=rev</a><br>
Log:<br>
Move tests that use unistd.h and pthread.h to TestCases/Posix<br>
<br>
Added:<br>
compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/closed-fds.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/gc-test.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc<br>
compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc<br>
- copied, changed from r244647, compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc<br>
Removed:<br>
compiler-rt/trunk/test/asan/TestCases/closed-fds.cc<br>
compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc<br>
compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc<br>
compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc<br>
compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc<br>
compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc<br>
compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc<br>
compiler-rt/trunk/test/asan/TestCases/gc-test.cc<br>
compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc<br>
compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc<br>
compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/closed-fds.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc&p1=compiler-rt/trunk/test/asan/TestCases/closed-fds.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/closed-fds.cc&p1=compiler-rt/trunk/test/asan/TestCases/closed-fds.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc&p1=compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/coverage-caller-callee.cc&p1=compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc&p1=compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/coverage-maybe-open-file.cc&p1=compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc&p1=compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/current_allocated_bytes.cc&p1=compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc&p1=compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/deep_thread_stack.cc&p1=compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc&p1=compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/dlclose-test.cc&p1=compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc&p1=compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/free_hook_realloc.cc&p1=compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/gc-test.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc&p1=compiler-rt/trunk/test/asan/TestCases/gc-test.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/gc-test.cc&p1=compiler-rt/trunk/test/asan/TestCases/gc-test.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc&p1=compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc&p1=compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/Posix/init-order-pthread-create.cc Wed Aug 12 17:58:56 2015<br>
@@ -1,7 +1,7 @@<br>
// Check that init-order checking is properly disabled if pthread_create is<br>
// called.<br>
<br>
-// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -pthread -o %t<br>
+// RUN: %clangxx_asan %s %p/../Helpers/init-order-pthread-create-extra.cc -pthread -o %t<br></blockquote><div><br></div><div>Please move init-order-pthread-create-extra.cc somewhere under TestCases/Posix as well, so that we don't have to go up the directory tree here.</div><div>A yet cleaner approach would be to get rid of extra .cc file and create a self-contained test :two sources in one, with a few #ifdef magic - see TestCases/dlclose-test.cc for inspiration.</div><div>I will totally understand if you refuse to do this extra work :)</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:strict_init_order=true %run %t<br>
<br>
#include <stdio.h><br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc&p1=compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/stack-overflow.cc&p1=compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Copied: compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc (from r244647, compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc&p1=compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc&r1=244647&r2=244827&rev=244827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/stack-use-after-return.cc&p1=compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc&r1=244647&r2=244827&rev=244827&view=diff</a><br>
==============================================================================<br>
(empty)<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/closed-fds.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/closed-fds.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/closed-fds.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/closed-fds.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/closed-fds.cc (removed)<br>
@@ -1,33 +0,0 @@<br>
-// Check that when the program closed its std(in|out|err), running the external<br>
-// symbolizer still works.<br>
-<br>
-// RUN: rm -f %t.log.*<br>
-// RUN: %clangxx_asan -O0 %s -o %t 2>&1 && ASAN_OPTIONS=$ASAN_OPTIONS:log_path=%t.log:verbosity=2 not %run %t 2>&1<br>
-// RUN: FileCheck %s --check-prefix=CHECK-FILE < %t.log.*<br>
-<br>
-// FIXME: copy %t.log back from the device and re-enable on Android.<br>
-// UNSUPPORTED: android<br>
-<br>
-#include <assert.h><br>
-#include <stdio.h><br>
-#include <stdlib.h><br>
-#include <string.h><br>
-#include <unistd.h><br>
-<br>
-int main(int argc, char **argv) {<br>
- int result = fprintf(stderr, "Closing streams.\n");<br>
- assert(result > 0);<br>
- close(STDIN_FILENO);<br>
- close(STDOUT_FILENO);<br>
- close(STDERR_FILENO);<br>
- result = fprintf(stderr, "Can you hear me now?\n");<br>
- assert(result < 0);<br>
- char *x = (char *)malloc(10 * sizeof(char));<br>
- free(x);<br>
- x[argc] = 'X'; // BOOM<br>
- // CHECK-FILE: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}<br>
- // CHECK-FILE: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}<br>
- // CHECK-FILE: {{WRITE of size 1 at 0x.* thread T0}}<br>
- // CHECK-FILE: {{ #0 0x.* in main .*closed-fds.cc:}}[[@LINE-4]]<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc (removed)<br>
@@ -1,74 +0,0 @@<br>
-// Test caller-callee coverage with large number of threads<br>
-// and various numbers of callers and callees.<br>
-<br>
-// RUN: %clangxx_asan -fsanitize-coverage=edge,indirect-calls %s -o %t<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 10 1 2>&1 | FileCheck %s --check-prefix=CHECK-10-1<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 9 2 2>&1 | FileCheck %s --check-prefix=CHECK-9-2<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 7 3 2>&1 | FileCheck %s --check-prefix=CHECK-7-3<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 17 1 2>&1 | FileCheck %s --check-prefix=CHECK-17-1<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 15 2 2>&1 | FileCheck %s --check-prefix=CHECK-15-2<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:verbosity=1 %run %t 18 3 2>&1 | FileCheck %s --check-prefix=CHECK-18-3<br>
-// RUN: rm -f caller-callee*.sancov<br>
-//<br>
-// REQUIRES: asan-64-bits<br>
-//<br>
-// CHECK-10-1: CovDump: 10 caller-callee pairs written<br>
-// CHECK-9-2: CovDump: 18 caller-callee pairs written<br>
-// CHECK-7-3: CovDump: 21 caller-callee pairs written<br>
-// CHECK-17-1: CovDump: 14 caller-callee pairs written<br>
-// CHECK-15-2: CovDump: 28 caller-callee pairs written<br>
-// CHECK-18-3: CovDump: 42 caller-callee pairs written<br>
-<br>
-#include <stdio.h><br>
-#include <stdlib.h><br>
-#include <pthread.h><br>
-int P = 0;<br>
-struct Foo {virtual void f() {if (P) printf("Foo::f()\n");}};<br>
-struct Foo1 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo2 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo3 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo4 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo5 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo6 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo7 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo8 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo9 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo10 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo11 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo12 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo13 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo14 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo15 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo16 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo17 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo18 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-struct Foo19 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};<br>
-<br>
-Foo *foo[20] = {<br>
- new Foo, new Foo1, new Foo2, new Foo3, new Foo4, new Foo5, new Foo6,<br>
- new Foo7, new Foo8, new Foo9, new Foo10, new Foo11, new Foo12, new Foo13,<br>
- new Foo14, new Foo15, new Foo16, new Foo17, new Foo18, new Foo19,<br>
-};<br>
-<br>
-int n_functions = 10;<br>
-int n_callers = 2;<br>
-<br>
-void *Thread(void *arg) {<br>
- if (n_callers >= 1) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();<br>
- if (n_callers >= 2) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();<br>
- if (n_callers >= 3) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();<br>
- return arg;<br>
-}<br>
-<br>
-int main(int argc, char **argv) {<br>
- if (argc >= 2)<br>
- n_functions = atoi(argv[1]);<br>
- if (argc >= 3)<br>
- n_callers = atoi(argv[2]);<br>
- const int kNumThreads = 16;<br>
- pthread_t t[kNumThreads];<br>
- for (int i = 0; i < kNumThreads; i++)<br>
- pthread_create(&t[i], 0, Thread, 0);<br>
- for (int i = 0; i < kNumThreads; i++)<br>
- pthread_join(t[i], 0);<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc (removed)<br>
@@ -1,32 +0,0 @@<br>
-// FIXME: <a href="https://code.google.com/p/address-sanitizer/issues/detail?id=316" rel="noreferrer" target="_blank">https://code.google.com/p/address-sanitizer/issues/detail?id=316</a><br>
-// XFAIL: android<br>
-//<br>
-// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t<br>
-// RUN: rm -rf %T/coverage-maybe-open-file<br>
-// RUN: mkdir -p %T/coverage-maybe-open-file && cd %T/coverage-maybe-open-file<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1 %run %t | FileCheck %s --check-prefix=CHECK-success<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=0 %run %t | FileCheck %s --check-prefix=CHECK-fail<br>
-// RUN: [ "$(cat test.sancov.packed)" == "test" ]<br>
-// RUN: cd .. && rm -rf %T/coverage-maybe-open-file<br>
-<br>
-#include <stdio.h><br>
-#include <string.h><br>
-#include <unistd.h><br>
-<br>
-#include <sanitizer/coverage_interface.h><br>
-<br>
-// FIXME: the code below might not work on Windows.<br>
-int main(int argc, char **argv) {<br>
- int fd = __sanitizer_maybe_open_cov_file("test");<br>
- if (fd > 0) {<br>
- printf("SUCCESS\n");<br>
- const char s[] = "test\n";<br>
- write(fd, s, strlen(s));<br>
- close(fd);<br>
- } else {<br>
- printf("FAIL\n");<br>
- }<br>
-}<br>
-<br>
-// CHECK-success: SUCCESS<br>
-// CHECK-fail: FAIL<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc (removed)<br>
@@ -1,44 +0,0 @@<br>
-// RUN: %clangxx_asan -O0 %s -pthread -o %t && %run %t<br>
-// RUN: %clangxx_asan -O2 %s -pthread -o %t && %run %t<br>
-// REQUIRES: stable-runtime<br>
-<br>
-#include <assert.h><br>
-#include <pthread.h><br>
-#include <sanitizer/allocator_interface.h><br>
-#include <stdio.h><br>
-#include <stdlib.h><br>
-<br>
-const size_t kLargeAlloc = 1UL << 20;<br>
-<br>
-void* allocate(void *arg) {<br>
- volatile void *ptr = malloc(kLargeAlloc);<br>
- free((void*)ptr);<br>
- return 0;<br>
-}<br>
-<br>
-void* check_stats(void *arg) {<br>
- assert(__sanitizer_get_current_allocated_bytes() > 0);<br>
- return 0;<br>
-}<br>
-<br>
-int main() {<br>
- size_t used_mem = __sanitizer_get_current_allocated_bytes();<br>
- printf("Before: %zu\n", used_mem);<br>
- const int kNumIterations = 1000;<br>
- for (int iter = 0; iter < kNumIterations; iter++) {<br>
- pthread_t thr[4];<br>
- for (int j = 0; j < 4; j++) {<br>
- assert(0 ==<br>
- pthread_create(&thr[j], 0, (j < 2) ? allocate : check_stats, 0));<br>
- }<br>
- for (int j = 0; j < 4; j++)<br>
- assert(0 == pthread_join(thr[j], 0));<br>
- used_mem = __sanitizer_get_current_allocated_bytes();<br>
- if (used_mem > kLargeAlloc) {<br>
- printf("After iteration %d: %zu\n", iter, used_mem);<br>
- return 1;<br>
- }<br>
- }<br>
- printf("Success after %d iterations\n", kNumIterations);<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc (removed)<br>
@@ -1,58 +0,0 @@<br>
-// RUN: %clangxx_asan -O0 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O1 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// REQUIRES: stable-runtime<br>
-<br>
-#include <pthread.h><br>
-<br>
-int *x;<br>
-<br>
-void *AllocThread(void *arg) {<br>
- x = new int;<br>
- *x = 42;<br>
- return NULL;<br>
-}<br>
-<br>
-void *FreeThread(void *arg) {<br>
- delete x;<br>
- return NULL;<br>
-}<br>
-<br>
-void *AccessThread(void *arg) {<br>
- *x = 43; // BOOM<br>
- return NULL;<br>
-}<br>
-<br>
-typedef void* (*callback_type)(void* arg);<br>
-<br>
-void *RunnerThread(void *function) {<br>
- pthread_t thread;<br>
- pthread_create(&thread, NULL, (callback_type)function, NULL);<br>
- pthread_join(thread, NULL);<br>
- return NULL;<br>
-}<br>
-<br>
-void RunThread(callback_type function) {<br>
- pthread_t runner;<br>
- pthread_create(&runner, NULL, RunnerThread, (void*)function);<br>
- pthread_join(runner, NULL);<br>
-}<br>
-<br>
-int main(int argc, char *argv[]) {<br>
- RunThread(AllocThread);<br>
- RunThread(FreeThread);<br>
- RunThread(AccessThread);<br>
- return (x != 0);<br>
-}<br>
-<br>
-// CHECK: AddressSanitizer: heap-use-after-free<br>
-// CHECK: WRITE of size 4 at 0x{{.*}} thread T[[ACCESS_THREAD:[0-9]+]]<br>
-// CHECK: freed by thread T[[FREE_THREAD:[0-9]+]] here:<br>
-// CHECK: previously allocated by thread T[[ALLOC_THREAD:[0-9]+]] here:<br>
-// CHECK: Thread T[[ACCESS_THREAD]] created by T[[ACCESS_RUNNER:[0-9]+]] here:<br>
-// CHECK: Thread T[[ACCESS_RUNNER]] created by T0 here:<br>
-// CHECK: Thread T[[FREE_THREAD]] created by T[[FREE_RUNNER:[0-9]+]] here:<br>
-// CHECK: Thread T[[FREE_RUNNER]] created by T0 here:<br>
-// CHECK: Thread T[[ALLOC_THREAD]] created by T[[ALLOC_RUNNER:[0-9]+]] here:<br>
-// CHECK: Thread T[[ALLOC_RUNNER]] created by T0 here:<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/dlclose-test.cc (removed)<br>
@@ -1,106 +0,0 @@<br>
-// Regression test for<br>
-// <a href="http://code.google.com/p/address-sanitizer/issues/detail?id=19" rel="noreferrer" target="_blank">http://code.google.com/p/address-sanitizer/issues/detail?id=19</a><br>
-// Bug description:<br>
-// 1. application dlopens foo.so<br>
-// 2. asan registers all globals from foo.so<br>
-// 3. application dlcloses foo.so<br>
-// 4. application mmaps some memory to the location where foo.so was before<br>
-// 5. application starts using this mmaped memory, but asan still thinks there<br>
-// are globals.<br>
-// 6. BOOM<br>
-<br>
-// This sublte test assumes that after a foo.so is dlclose-d<br>
-// we can mmap the region of memory that has been occupied by the library.<br>
-// It works on i368/x86_64 Linux, but not necessary anywhere else.<br>
-// REQUIRES: x86_64-supported-target,i386-supported-target<br>
-<br>
-// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so<br>
-// RUN: %clangxx_asan -O0 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O1 -DSHARED_LIB %s -fPIC -shared -o %t-so.so<br>
-// RUN: %clangxx_asan -O1 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O2 -DSHARED_LIB %s -fPIC -shared -o %t-so.so<br>
-// RUN: %clangxx_asan -O2 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 -DSHARED_LIB %s -fPIC -shared -o %t-so.so<br>
-// RUN: %clangxx_asan -O3 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s<br>
-<br>
-#if !defined(SHARED_LIB)<br>
-#include <assert.h><br>
-#include <dlfcn.h><br>
-#include <stdio.h><br>
-#include <string.h><br>
-#include <sys/mman.h><br>
-#include <unistd.h><br>
-<br>
-#include <string><br>
-<br>
-#if defined(__FreeBSD__)<br>
-// The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before<br>
-// that, it was never implemented. So just define it to zero.<br>
-#undef MAP_NORESERVE<br>
-#define MAP_NORESERVE 0<br>
-#endif<br>
-<br>
-using std::string;<br>
-<br>
-typedef int *(fun_t)();<br>
-<br>
-int main(int argc, char *argv[]) {<br>
- string path = string(argv[0]) + "-so.so";<br>
- size_t PageSize = sysconf(_SC_PAGESIZE);<br>
- printf("opening %s ... \n", path.c_str());<br>
- void *lib = dlopen(path.c_str(), RTLD_NOW);<br>
- if (!lib) {<br>
- printf("error in dlopen(): %s\n", dlerror());<br>
- return 1;<br>
- }<br>
- fun_t *get = (fun_t*)dlsym(lib, "get_address_of_static_var");<br>
- if (!get) {<br>
- printf("failed dlsym\n");<br>
- return 1;<br>
- }<br>
- int *addr = get();<br>
- assert(((size_t)addr % 32) == 0); // should be 32-byte aligned.<br>
- printf("addr: %p\n", addr);<br>
- addr[0] = 1; // make sure we can write there.<br>
-<br>
- // Now dlclose the shared library.<br>
- printf("attempting to dlclose\n");<br>
- if (dlclose(lib)) {<br>
- printf("failed to dlclose\n");<br>
- return 1;<br>
- }<br>
- // Now, the page where 'addr' is unmapped. Map it.<br>
- size_t page_beg = ((size_t)addr) & ~(PageSize - 1);<br>
- void *res = mmap((void*)(page_beg), PageSize,<br>
- PROT_READ | PROT_WRITE,<br>
- MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE, -1, 0);<br>
- if (res == (char*)-1L) {<br>
- printf("failed to mmap\n");<br>
- return 1;<br>
- }<br>
- addr[1] = 2; // BOOM (if the bug is not fixed).<br>
- printf("PASS\n");<br>
- // CHECK: PASS<br>
- return 0;<br>
-}<br>
-#else // SHARED_LIB<br>
-#include <stdio.h><br>
-<br>
-static int pad1;<br>
-static int static_var;<br>
-static int pad2;<br>
-<br>
-extern "C"<br>
-int *get_address_of_static_var() {<br>
- return &static_var;<br>
-}<br>
-<br>
-__attribute__((constructor))<br>
-void at_dlopen() {<br>
- printf("%s: I am being dlopened\n", __FILE__);<br>
-}<br>
-__attribute__((destructor))<br>
-void at_dlclose() {<br>
- printf("%s: I am being dlclosed\n", __FILE__);<br>
-}<br>
-#endif // SHARED_LIB<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/free_hook_realloc.cc (removed)<br>
@@ -1,34 +0,0 @@<br>
-// Check that free hook doesn't conflict with Realloc.<br>
-// RUN: %clangxx_asan -O2 %s -o %t<br>
-// RUN: %run %t 2>&1 | FileCheck %s<br>
-<br>
-#include <stdlib.h><br>
-#include <unistd.h><br>
-#include <sanitizer/allocator_interface.h><br>
-<br>
-static void *glob_ptr;<br>
-<br>
-extern "C" {<br>
-void __sanitizer_free_hook(const volatile void *ptr) {<br>
- if (ptr == glob_ptr) {<br>
- *(int*)ptr = 0;<br>
- write(1, "FreeHook\n", sizeof("FreeHook\n"));<br>
- }<br>
-}<br>
-}<br>
-<br>
-int main() {<br>
- int *x = (int*)malloc(100);<br>
- x[0] = 42;<br>
- glob_ptr = x;<br>
- int *y = (int*)realloc(x, 200);<br>
- // Verify that free hook was called and didn't spoil the memory.<br>
- if (y[0] != 42) {<br>
- _exit(1);<br>
- }<br>
- write(1, "Passed\n", sizeof("Passed\n"));<br>
- free(y);<br>
- // CHECK: FreeHook<br>
- // CHECK: Passed<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/gc-test.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/gc-test.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/gc-test.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/gc-test.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/gc-test.cc (removed)<br>
@@ -1,54 +0,0 @@<br>
-// RUN: %clangxx_asan %s -pthread -o %t<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0<br>
-// RUN: %clangxx_asan -O3 %s -pthread -o %t<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0<br>
-// REQUIRES: stable-runtime<br>
-<br>
-#include <assert.h><br>
-#include <stdio.h><br>
-#include <pthread.h><br>
-#include <sanitizer/asan_interface.h><br>
-<br>
-static const int kNumThreads = 2;<br>
-static const int kLeftRedzoneSize = sizeof(void *) * 4;<br>
-<br>
-void *Thread(void *unused) {<br>
- void *fake_stack = __asan_get_current_fake_stack();<br>
- char var[15];<br>
- if (fake_stack) {<br>
- fprintf(stderr, "fake stack found: %p; var: %p\n", fake_stack, var);<br>
- // CHECK1: fake stack found<br>
- // CHECK1: fake stack found<br>
- void *beg, *end;<br>
- void *real_stack =<br>
- __asan_addr_is_in_fake_stack(fake_stack, &var[0], &beg, &end);<br>
- assert(real_stack);<br>
- assert((char*)beg <= (char*)&var[0]);<br>
- assert((char*)end > (char*)&var[0]);<br>
- for (int i = -kLeftRedzoneSize; i < 15; i++) {<br>
- void *beg1, *end1;<br>
- char *ptr = &var[0] + i;<br>
- void *real_stack1 =<br>
- __asan_addr_is_in_fake_stack(fake_stack, ptr, &beg1, &end1);<br>
- assert(real_stack == real_stack1);<br>
- assert(beg == beg1);<br>
- assert(end == end1);<br>
- }<br>
- } else {<br>
- fprintf(stderr, "no fake stack\n");<br>
- // CHECK0: no fake stack<br>
- // CHECK0: no fake stack<br>
- }<br>
- return NULL;<br>
-}<br>
-<br>
-int main(int argc, char **argv) {<br>
- pthread_t t[kNumThreads];<br>
- for (int i = 0; i < kNumThreads; i++)<br>
- pthread_create(&t[i], 0, Thread, 0);<br>
- for (int i = 0; i < kNumThreads; i++)<br>
- pthread_join(t[i], 0);<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc (removed)<br>
@@ -1,43 +0,0 @@<br>
-// Check that init-order checking is properly disabled if pthread_create is<br>
-// called.<br>
-<br>
-// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -pthread -o %t<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:strict_init_order=true %run %t<br>
-<br>
-#include <stdio.h><br>
-#include <pthread.h><br>
-#include <unistd.h><br>
-<br>
-void *bar(void *input, bool sleep_before_init) {<br>
- if (sleep_before_init)<br>
- usleep(500000);<br>
- return input;<br>
-}<br>
-<br>
-void *glob = bar((void*)0x1234, false);<br>
-extern void *glob2;<br>
-<br>
-void *poll(void *arg) {<br>
- void **glob = (void**)arg;<br>
- while (true) {<br>
- usleep(100000);<br>
- printf("glob is now: %p\n", *glob);<br>
- }<br>
-}<br>
-<br>
-struct GlobalPollerStarter {<br>
- GlobalPollerStarter() {<br>
- pthread_t p;<br>
- pthread_attr_t attr;<br>
- pthread_attr_init(&attr);<br>
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);<br>
- pthread_create(&p, 0, poll, &glob);<br>
- pthread_attr_destroy(&attr);<br>
- printf("glob poller is started");<br>
- }<br>
-} global_poller;<br>
-<br>
-int main() {<br>
- printf("%p %p\n", glob, glob2);<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc (removed)<br>
@@ -1,114 +0,0 @@<br>
-// Test ASan detection of stack-overflow condition.<br>
-<br>
-// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O0 %s -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-<br>
-// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O0 %s -DTHREAD -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -DTHREAD -pthread -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s<br>
-// RUN: not %run %t 2>&1 | FileCheck %s<br>
-// REQUIRES: stable-runtime<br>
-<br>
-#include <assert.h><br>
-#include <stdlib.h><br>
-#include <pthread.h><br>
-#include <unistd.h><br>
-#include <sys/time.h><br>
-#include <sys/resource.h><br>
-#include <sanitizer/asan_interface.h><br>
-<br>
-const int BS = 1024;<br>
-volatile char x;<br>
-volatile int y = 1;<br>
-volatile int z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13;<br>
-<br>
-void recursive_func(char *p) {<br>
-#if defined(SMALL_FRAME)<br>
- char *buf = 0;<br>
-#elif defined(SAVE_ALL_THE_REGISTERS)<br>
- char *buf = 0;<br>
- int t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13;<br>
- t0 = z0;<br>
- t1 = z1;<br>
- t2 = z2;<br>
- t3 = z3;<br>
- t4 = z4;<br>
- t5 = z5;<br>
- t6 = z6;<br>
- t7 = z7;<br>
- t8 = z8;<br>
- t9 = z9;<br>
- t10 = z10;<br>
- t11 = z11;<br>
- t12 = z12;<br>
- t13 = z13;<br>
-<br>
- z0 = t0;<br>
- z1 = t1;<br>
- z2 = t2;<br>
- z3 = t3;<br>
- z4 = t4;<br>
- z5 = t5;<br>
- z6 = t6;<br>
- z7 = t7;<br>
- z8 = t8;<br>
- z9 = t9;<br>
- z10 = t10;<br>
- z11 = t11;<br>
- z12 = t12;<br>
- z13 = t13;<br>
-#else<br>
- char buf[BS];<br>
- // Check that the stack grows in the righ direction, unless we use fake stack.<br>
- if (p && !__asan_get_current_fake_stack())<br>
- assert(p - buf >= BS);<br>
- buf[rand() % BS] = 1;<br>
- buf[rand() % BS] = 2;<br>
- x = buf[rand() % BS];<br>
-#endif<br>
- if (y)<br>
- recursive_func(buf);<br>
- x = 1; // prevent tail call optimization<br>
- // CHECK: {{stack-overflow on address 0x.* \(pc 0x.* bp 0x.* sp 0x.* T.*\)}}<br>
- // If stack overflow happens during function prologue, stack trace may be<br>
- // corrupted. Unwind tables are not always 100% exact there.<br>
- // For this reason, we don't do any further checks.<br>
-}<br>
-<br>
-void *ThreadFn(void* unused) {<br>
- recursive_func(0);<br>
- return 0;<br>
-}<br>
-<br>
-void LimitStackAndReexec(int argc, char **argv) {<br>
- struct rlimit rlim;<br>
- int res = getrlimit(RLIMIT_STACK, &rlim);<br>
- assert(res == 0);<br>
- if (rlim.rlim_cur == RLIM_INFINITY) {<br>
- rlim.rlim_cur = 256 * 1024;<br>
- res = setrlimit(RLIMIT_STACK, &rlim);<br>
- assert(res == 0);<br>
-<br>
- execv(argv[0], argv);<br>
- assert(0 && "unreachable");<br>
- }<br>
-}<br>
-<br>
-int main(int argc, char **argv) {<br>
- LimitStackAndReexec(argc, argv);<br>
-#ifdef THREAD<br>
- pthread_t t;<br>
- pthread_create(&t, 0, ThreadFn, 0);<br>
- pthread_join(t, 0);<br>
-#else<br>
- recursive_func(0);<br>
-#endif<br>
- return 0;<br>
-}<br>
<br>
Removed: compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc?rev=244826&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc?rev=244826&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc (removed)<br>
@@ -1,80 +0,0 @@<br>
-// RUN: export ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1<br>
-// RUN: %clangxx_asan -O0 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O1 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: %clangxx_asan -O3 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=0 %run %t<br>
-// Regression test for a CHECK failure with small stack size and large frame.<br>
-// RUN: %clangxx_asan -O3 %s -pthread -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s<br>
-//<br>
-// Test that we can find UAR in a thread other than main:<br>
-// RUN: %clangxx_asan -DUseThread -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s<br>
-//<br>
-// Test the max_uar_stack_size_log/min_uar_stack_size_log flag.<br>
-//<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:max_uar_stack_size_log=20:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-20 %s<br>
-// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:min_uar_stack_size_log=24:max_uar_stack_size_log=24:verbosity=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-24 %s<br>
-<br>
-#include <stdio.h><br>
-#include <pthread.h><br>
-<br>
-#ifndef kSize<br>
-# define kSize 1<br>
-#endif<br>
-<br>
-#ifndef UseThread<br>
-# define UseThread 0<br>
-#endif<br>
-<br>
-#ifndef kStackSize<br>
-# define kStackSize 0<br>
-#endif<br>
-<br>
-__attribute__((noinline))<br>
-char *Ident(char *x) {<br>
- fprintf(stderr, "1: %p\n", x);<br>
- return x;<br>
-}<br>
-<br>
-__attribute__((noinline))<br>
-char *Func1() {<br>
- char local[kSize];<br>
- return Ident(local);<br>
-}<br>
-<br>
-__attribute__((noinline))<br>
-void Func2(char *x) {<br>
- fprintf(stderr, "2: %p\n", x);<br>
- *x = 1;<br>
- // CHECK: WRITE of size 1 {{.*}} thread T0<br>
- // CHECK: #0{{.*}}Func2{{.*}}stack-use-after-return.cc:[[@LINE-2]]<br>
- // CHECK: is located in stack of thread T0 at offset<br>
- // CHECK: 'local' <== Memory access at offset {{16|32}} is inside this variable<br>
- // THREAD: WRITE of size 1 {{.*}} thread T{{[1-9]}}<br>
- // THREAD: #0{{.*}}Func2{{.*}}stack-use-after-return.cc:[[@LINE-6]]<br>
- // THREAD: is located in stack of thread T{{[1-9]}} at offset<br>
- // THREAD: 'local' <== Memory access at offset {{16|32}} is inside this variable<br>
- // CHECK-20: T0: FakeStack created:{{.*}} stack_size_log: 20<br>
- // CHECK-24: T0: FakeStack created:{{.*}} stack_size_log: 24<br>
-}<br>
-<br>
-void *Thread(void *unused) {<br>
- Func2(Func1());<br>
- return NULL;<br>
-}<br>
-<br>
-int main(int argc, char **argv) {<br>
-#if UseThread<br>
- pthread_attr_t attr;<br>
- pthread_attr_init(&attr);<br>
- if (kStackSize > 0)<br>
- pthread_attr_setstacksize(&attr, kStackSize);<br>
- pthread_t t;<br>
- pthread_create(&t, &attr, Thread, 0);<br>
- pthread_attr_destroy(&attr);<br>
- pthread_join(t, 0);<br>
-#else<br>
- Func2(Func1());<br>
-#endif<br>
- return 0;<br>
-}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>