[compiler-rt] r201415 - [asan] Change stack uar test to not use ulimit.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Feb 14 06:36:42 PST 2014


Author: eugenis
Date: Fri Feb 14 08:36:42 2014
New Revision: 201415

URL: http://llvm.org/viewvc/llvm-project?rev=201415&view=rev
Log:
[asan] Change stack uar test to not use ulimit.

Because of how Android test runner is implemented, ulimit in RUN: line
gets executed on the host machine and does not affect the test.


Modified:
    compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc

Modified: compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc?rev=201415&r1=201414&r2=201415&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc Fri Feb 14 08:36:42 2014
@@ -9,8 +9,8 @@
 // RUN:   not %t 2>&1 | FileCheck %s
 // RUN: ASAN_OPTIONS=detect_stack_use_after_return=0 %t
 // Regression test for a CHECK failure with small stack size and large frame.
-// RUN: %clangxx_asan  -O3 %s -o %t -DkSize=10000 && \
-// RUN: (ulimit -s 65;  not %t) 2>&1 | FileCheck %s
+// RUN: %clangxx_asan  -O3 %s -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && \
+// RUN:   not %t 2>&1 | FileCheck --check-prefix=THREAD %s
 //
 // Test that we can find UAR in a thread other than main:
 // RUN: %clangxx_asan  -DUseThread -O2 %s -o %t && \
@@ -32,6 +32,10 @@
 # define UseThread 0
 #endif
 
+#ifndef kStackSize
+# define kStackSize 0
+#endif
+
 __attribute__((noinline))
 char *Ident(char *x) {
   fprintf(stderr, "1: %p\n", x);
@@ -67,8 +71,13 @@ void *Thread(void *unused)  {
 
 int main(int argc, char **argv) {
 #if UseThread
+  pthread_attr_t attr;
+  pthread_attr_init(&attr);
+  if (kStackSize > 0)
+    pthread_attr_setstacksize(&attr, kStackSize);
   pthread_t t;
-  pthread_create(&t, 0, Thread, 0);
+  pthread_create(&t, &attr, Thread, 0);
+  pthread_attr_destroy(&attr);
   pthread_join(t, 0);
 #else
   Func2(Func1());





More information about the llvm-commits mailing list