[compiler-rt] r208777 - [ASan tests] Create a Posix/ directory for tests that we don't plan to run on Windows

Timur Iskhodzhanov timurrrr at google.com
Wed May 14 07:12:02 PDT 2014


Author: timurrrr
Date: Wed May 14 09:12:02 2014
New Revision: 208777

URL: http://llvm.org/viewvc/llvm-project?rev=208777&view=rev
Log:
[ASan tests] Create a Posix/ directory for tests that we don't plan to run on Windows

Added:
    compiler-rt/trunk/test/asan/TestCases/Posix/
    compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/assign_large_valloc_to_global.cc
      - copied, changed from r208691, compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/init-order-dlopen.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/ioctl.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/ioctl.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/large_allocator_unpoisons_on_free.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/lit.local.cfg
      - copied, changed from r208691, compiler-rt/trunk/test/asan/TestCases/Linux/lit.local.cfg
    compiler-rt/trunk/test/asan/TestCases/Posix/readv.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/readv.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/shared-lib-test.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/start-deactivated.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/strerror_r_test.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/wait.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/wait.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/waitid.cc
      - copied unchanged from r208691, compiler-rt/trunk/test/asan/TestCases/waitid.cc
Removed:
    compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc
    compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc
    compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc
    compiler-rt/trunk/test/asan/TestCases/ioctl.cc
    compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
    compiler-rt/trunk/test/asan/TestCases/readv.cc
    compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc
    compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc
    compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc
    compiler-rt/trunk/test/asan/TestCases/wait.cc
    compiler-rt/trunk/test/asan/TestCases/waitid.cc

Copied: compiler-rt/trunk/test/asan/TestCases/Posix/assign_large_valloc_to_global.cc (from r208691, compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/assign_large_valloc_to_global.cc?p2=compiler-rt/trunk/test/asan/TestCases/Posix/assign_large_valloc_to_global.cc&p1=compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc&r1=208691&r2=208777&rev=208777&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/assign_large_valloc_to_global.cc Wed May 14 09:12:02 2014
@@ -2,7 +2,7 @@
 // RUN: %clangxx_asan -O3 %s -o %t && %run %t
 #include <stdlib.h>
 #ifndef __APPLE__
-#include <malloc.h>
+# include <malloc.h>
 #endif  // __APPLE__
 int *p = (int*)valloc(1 << 20);
 int main() { }

Copied: compiler-rt/trunk/test/asan/TestCases/Posix/lit.local.cfg (from r208691, compiler-rt/trunk/test/asan/TestCases/Linux/lit.local.cfg)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/lit.local.cfg?p2=compiler-rt/trunk/test/asan/TestCases/Posix/lit.local.cfg&p1=compiler-rt/trunk/test/asan/TestCases/Linux/lit.local.cfg&r1=208691&r2=208777&rev=208777&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/lit.local.cfg (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/lit.local.cfg Wed May 14 09:12:02 2014
@@ -5,5 +5,5 @@ def getRoot(config):
 
 root = getRoot(config)
 
-if root.host_os not in ['Linux']:
+if root.host_os in ['Windows']:
   config.unsupported = True

Removed: compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/allow_user_segv.cc (removed)
@@ -1,48 +0,0 @@
-// Regression test for
-// https://code.google.com/p/address-sanitizer/issues/detail?id=180
-
-// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=allow_user_segv_handler=true not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %s -o %t && ASAN_OPTIONS=allow_user_segv_handler=true not %run %t 2>&1 | FileCheck %s
-
-#include <signal.h>
-#include <stdio.h>
-
-struct sigaction user_sigaction;
-struct sigaction original_sigaction;
-
-void User_OnSIGSEGV(int signum, siginfo_t *siginfo, void *context) {
-  fprintf(stderr, "User sigaction called\n");
-  if (original_sigaction.sa_flags | SA_SIGINFO)
-    original_sigaction.sa_sigaction(signum, siginfo, context);
-  else
-    original_sigaction.sa_handler(signum);
-}
-
-int DoSEGV() {
-  volatile int *x = 0;
-  return *x;
-}
-
-int main() {
-  user_sigaction.sa_sigaction = User_OnSIGSEGV;
-  user_sigaction.sa_flags = SA_SIGINFO;
-#if defined(__APPLE__) && !defined(__LP64__)
-  // On 32-bit Darwin KERN_PROTECTION_FAILURE (SIGBUS) is delivered.
-  int signum = SIGBUS;
-#else
-  // On 64-bit Darwin KERN_INVALID_ADDRESS (SIGSEGV) is delivered.
-  // On Linux SIGSEGV is delivered as well.
-  int signum = SIGSEGV;
-#endif
-  if (sigaction(signum, &user_sigaction, &original_sigaction)) {
-    perror("sigaction");
-    return 1;
-  }
-  fprintf(stderr, "User sigaction installed\n");
-  return DoSEGV();
-}
-
-// CHECK: User sigaction installed
-// CHECK-NEXT: User sigaction called
-// CHECK-NEXT: ASAN:SIGSEGV
-// CHECK: AddressSanitizer: SEGV on unknown address

Removed: compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/assign_large_valloc_to_global.cc (removed)
@@ -1,8 +0,0 @@
-// Make sure we don't report a leak nor hang.
-// RUN: %clangxx_asan -O3 %s -o %t && %run %t
-#include <stdlib.h>
-#ifndef __APPLE__
-#include <malloc.h>
-#endif  // __APPLE__
-int *p = (int*)valloc(1 << 20);
-int main() { }

Removed: compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/init-order-dlopen.cc (removed)
@@ -1,57 +0,0 @@
-// Regression test for
-// https://code.google.com/p/address-sanitizer/issues/detail?id=178
-
-// Assume we're on Darwin and try to pass -U to the linker. If this flag is
-// unsupported, don't use it.
-// RUN: %clangxx_asan -O0 %p/SharedLibs/init-order-dlopen-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so -Wl,-U,_inc_global || \
-// RUN:     %clangxx_asan -O0 %p/SharedLibs/init-order-dlopen-so.cc \
-// RUN:         -fPIC -shared -o %t-so.so
-// If the linker doesn't support --export-dynamic (which is ELF-specific),
-// try to link without that option.
-// FIXME: find a better solution.
-// RUN: %clangxx_asan -O0 %s -lpthread -ldl -o %t -Wl,--export-dynamic || \
-// RUN:     %clangxx_asan -O0 %s -lpthread -ldl -o %t
-// RUN: ASAN_OPTIONS=strict_init_order=true %run %t 2>&1 | FileCheck %s
-#include <dlfcn.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <string>
-
-using std::string;
-
-int foo() {
-  return 42;
-}
-int global = foo();
-
-__attribute__((visibility("default")))
-extern "C"
-void inc_global() {
-  global++;
-}
-
-void *global_poller(void *arg) {
-  while (true) {
-    if (global != 42)
-      break;
-    usleep(100);
-  }
-  return 0;
-}
-
-int main(int argc, char *argv[]) {
-  pthread_t p;
-  pthread_create(&p, 0, global_poller, 0);
-  string path = string(argv[0]) + "-so.so";
-  if (0 == dlopen(path.c_str(), RTLD_NOW)) {
-    fprintf(stderr, "dlerror: %s\n", dlerror());
-    return 1;
-  }
-  pthread_join(p, 0);
-  printf("PASSED\n");
-  // CHECK: PASSED
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/ioctl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/ioctl.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/ioctl.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/ioctl.cc (removed)
@@ -1,24 +0,0 @@
-// RUN: %clangxx_asan -O0 -g %s -o %t && ASAN_OPTIONS=handle_ioctl=1 not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 -g %s -o %t && ASAN_OPTIONS=handle_ioctl=1 not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_asan -O3 -g %s -o %t && %run %t
-
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-int main(int argc, char **argv) {
-  int fd = socket(AF_INET, SOCK_DGRAM, 0);
-
-  int nonblock;
-  int res = ioctl(fd, FIONBIO, &nonblock + 1);
-  // CHECK: AddressSanitizer: stack-buffer-overflow
-  // CHECK: READ of size 4 at
-  // CHECK: {{#.* in main .*ioctl.cc:}}[[@LINE-3]]
-  assert(res == 0);
-  close(fd);
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc (removed)
@@ -1,37 +0,0 @@
-// Test that LargeAllocator unpoisons memory before releasing it to the OS.
-// RUN: %clangxx_asan %s -o %t
-// The memory is released only when the deallocated chunk leaves the quarantine,
-// otherwise the mmap(p, ...) call overwrites the malloc header.
-// RUN: ASAN_OPTIONS=quarantine_size=1 %run %t
-
-#include <assert.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <stdlib.h>
-
-#ifdef __ANDROID__
-#include <malloc.h>
-void *my_memalign(size_t boundary, size_t size) {
-  return memalign(boundary, size);
-}
-#else
-void *my_memalign(size_t boundary, size_t size) {
-  void *p;
-  posix_memalign(&p, boundary, size);
-  return p;
-}
-#endif
-
-int main() {
-  const int kPageSize = 4096;
-  void *p = my_memalign(kPageSize, 1024 * 1024);
-  free(p);
-
-  char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);
-  assert(q == p);
-
-  memset(q, 42, kPageSize);
-
-  munmap(q, kPageSize);
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/readv.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/readv.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/readv.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/readv.cc (removed)
@@ -1,32 +0,0 @@
-// RUN: %clangxx_asan -O0 %s -o %t && %run %t
-// RUN: %clangxx_asan -O0 %s -DPOSITIVE -o %t && not %run %t 2>&1 | FileCheck %s
-
-// Test the readv() interceptor.
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/uio.h>
-#include <time.h>
-
-int main() {
-  char buf[2011];
-  struct iovec iov[2];
-#ifdef POSITIVE
-  char * volatile buf_ = buf;
-  iov[0].iov_base = buf_ - 1;
-#else
-  iov[0].iov_base = buf + 1;
-#endif
-  iov[0].iov_len = 5;
-  iov[1].iov_base = buf + 10;
-  iov[1].iov_len = 2000;
-  int fd = open("/etc/hosts", O_RDONLY);
-  assert(fd > 0);
-  readv(fd, iov, 2);
-  // CHECK: WRITE of size 5 at
-  close(fd);
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/shared-lib-test.cc (removed)
@@ -1,38 +0,0 @@
-// RUN: %clangxx_asan -O0 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -ldl -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O1 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O1 %s -ldl -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -ldl -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O3 %s -ldl -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <dlfcn.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <string>
-
-using std::string;
-
-typedef void (fun_t)(int x);
-
-int main(int argc, char *argv[]) {
-  string path = string(argv[0]) + "-so.so";
-  printf("opening %s ... \n", path.c_str());
-  void *lib = dlopen(path.c_str(), RTLD_NOW);
-  if (!lib) {
-    printf("error in dlopen(): %s\n", dlerror());
-    return 1;
-  }
-  fun_t *inc = (fun_t*)dlsym(lib, "inc");
-  if (!inc) return 1;
-  printf("ok\n");
-  inc(1);
-  inc(-1);  // BOOM
-  // CHECK: {{.*ERROR: AddressSanitizer: global-buffer-overflow}}
-  // CHECK: {{READ of size 4 at 0x.* thread T0}}
-  // CHECK: {{    #0 0x.*}}
-  // CHECK: {{    #1 0x.* in main .*shared-lib-test.cc:}}[[@LINE-4]]
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/start-deactivated.cc (removed)
@@ -1,57 +0,0 @@
-// Test for ASAN_OPTIONS=start_deactivated=1 mode.
-// Main executable is uninstrumented, but linked to ASan runtime. The shared
-// library is instrumented. Memory errors before dlopen are not detected.
-
-// RUN: %clangxx_asan -O0 %p/SharedLibs/start-deactivated-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx -O0 %s -c -o %t.o
-// RUN: %clangxx_asan -O0 %t.o -ldl -o %t
-// RUN: ASAN_OPTIONS=start_deactivated=1 not %run %t 2>&1 | FileCheck %s
-
-#include <dlfcn.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <string>
-
-#include "sanitizer/asan_interface.h"
-
-void test_malloc_shadow() {
-  char *p = (char *)malloc(100);
-  char *q = (char *)__asan_region_is_poisoned(p + 95, 8);
-  fprintf(stderr, "=%zd=\n", q ? q - (p + 95) : -1);
-  free(p);
-}
-
-typedef void (*Fn)();
-
-int main(int argc, char *argv[]) {
-  test_malloc_shadow();
-  // CHECK: =-1=
-
-  std::string path = std::string(argv[0]) + "-so.so";
-  void *dso = dlopen(path.c_str(), RTLD_NOW);
-  if (!dso) {
-    fprintf(stderr, "dlopen failed: %s\n", dlerror());
-    return 1;
-  }
-
-  test_malloc_shadow();
-  // CHECK: =5=
-
-  void *fn = dlsym(dso, "do_another_bad_thing");
-  if (!fn) {
-    fprintf(stderr, "dlsym failed: %s\n", dlerror());
-    return 1;
-  }
-
-  ((Fn)fn)();
-  // CHECK: AddressSanitizer: heap-buffer-overflow
-  // CHECK: READ of size 1
-  // CHECK: {{#0 .* in do_another_bad_thing}}
-  // CHECK: is located 5 bytes to the right of 100-byte region
-  // CHECK: in do_another_bad_thing
-
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/strerror_r_test.cc (removed)
@@ -1,14 +0,0 @@
-// RUN: %clangxx_asan -O0 %s -o %t && %run %t
-
-// Regression test for PR17138.
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-int main() {
-  char buf[1024];
-  char *res = (char *)strerror_r(300, buf, sizeof(buf));
-  printf("%p\n", res);
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/wait.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/wait.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/wait.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/wait.cc (removed)
@@ -1,56 +0,0 @@
-// RUN: %clangxx_asan -DWAIT -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAIT -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -DWAITPID -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAITPID -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -DWAIT3 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAIT3 -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -DWAIT4 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAIT4 -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -DWAIT3_RUSAGE -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAIT3_RUSAGE -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// RUN: %clangxx_asan -DWAIT4_RUSAGE -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -DWAIT4_RUSAGE -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-int main(int argc, char **argv) {
-  pid_t pid = fork();
-  if (pid) { // parent
-    int x[3];
-    int *status = x + argc * 3;
-    int res;
-#if defined(WAIT)
-    res = wait(status);
-#elif defined(WAITPID)
-    res = waitpid(pid, status, WNOHANG);
-#elif defined(WAIT3)
-    res = wait3(status, WNOHANG, NULL);
-#elif defined(WAIT4)
-    res = wait4(pid, status, WNOHANG, NULL);
-#elif defined(WAIT3_RUSAGE) || defined(WAIT4_RUSAGE)
-    struct rusage *ru = (struct rusage*)(x + argc * 3);
-    int good_status;
-# if defined(WAIT3_RUSAGE)
-    res = wait3(&good_status, WNOHANG, ru);
-# elif defined(WAIT4_RUSAGE)
-    res = wait4(pid, &good_status, WNOHANG, ru);
-# endif
-#endif
-    // CHECK: stack-buffer-overflow
-    // CHECK: {{WRITE of size .* at 0x.* thread T0}}
-    // CHECK: {{in .*wait}}
-    // CHECK: {{in main .*wait.cc:}}
-    // CHECK: is located in stack of thread T0 at offset
-    // CHECK: {{in main}}
-    return res == -1 ? 1 : 0;
-  }
-  // child
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/waitid.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/waitid.cc?rev=208776&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/waitid.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/waitid.cc (removed)
@@ -1,27 +0,0 @@
-// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-int main(int argc, char **argv) {
-  pid_t pid = fork();
-  if (pid) { // parent
-    int x[3];
-    int *status = x + argc * 3;
-    int res;
-
-    siginfo_t *si = (siginfo_t*)(x + argc * 3);
-    res = waitid(P_ALL, 0, si, WEXITED | WNOHANG);
-    // CHECK: stack-buffer-overflow
-    // CHECK: {{WRITE of size .* at 0x.* thread T0}}
-    // CHECK: {{in .*waitid}}
-    // CHECK: {{in main .*waitid.cc:}}
-    // CHECK: is located in stack of thread T0 at offset
-    // CHECK: {{in main}}
-    return res != -1;
-  }
-  // child
-  return 0;
-}





More information about the llvm-commits mailing list