On Mon, Dec 03, 2012 at 11:06:48AM +0400, Konstantin Serebryany wrote: > This patch copies the asan tests almost, but not quite, verbatim from > upstream. > Since the patch is not in attachment (and gmail messes up with inlined > patches) I can't see the exact changes.
Sending patches inline rather than as attachments is the preferred way for gcc-patches, you can always grab it from the gcc-patches ml archive: http://gcc.gnu.org/ml/gcc-patches/2012-11/msg02557.html (then click on Raw text). I'm attaching the diff for asan_test.cc from llvm anyway. > I see #ifdef ASAN_AVOID_EXPENSIVE_TESTS, which I don't really like > because I'd rather fix the test than disable it. The test isn't disabled, just by default limited to 30 threads instead of 1000, because that really will ruin testing for everybody with ulimit -u in 1024-ish range. Even 500 threads would be undesirable for that. > Can we commit the tests 100% verbatim, and then fix them as separate commits > (preferably, by fixing the tests upstream and doing the merge with > libsanitizer/merge.sh)? I'd prefer delay committing the patch over causing random testsuite failures elsewhere. Jakub
--- /usr/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc 2012-11-30 14:23:48.525229790 +0100 +++ asan_test.cc 2012-12-03 10:12:14.503366704 +0100 @@ -1,7 +1,5 @@ //===-- asan_test.cc ------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // @@ -481,10 +479,16 @@ void *ManyThreadsWorker(void *a) { } TEST(AddressSanitizer, ManyThreadsTest) { - const size_t kNumThreads = SANITIZER_WORDSIZE == 32 ? 30 : 1000; - pthread_t t[kNumThreads]; +#ifdef ASAN_AVOID_EXPENSIVE_TESTS + const size_t kMaxThreads = 30; +#else + const size_t kMaxThreads = SANITIZER_WORDSIZE == 32 ? 30 : 1000; +#endif + pthread_t t[kMaxThreads]; + size_t kNumThreads = kMaxThreads; for (size_t i = 0; i < kNumThreads; i++) { - pthread_create(&t[i], 0, (void* (*)(void *x))ManyThreadsWorker, (void*)i); + if (pthread_create(&t[i], 0, (void* (*)(void *x))ManyThreadsWorker, (void*)i)) + kNumThreads = i; } for (size_t i = 0; i < kNumThreads; i++) { pthread_join(t[i], 0);