[compiler-rt] r367851 - compiler-rt: Rename cc files in test/hwasan/TestCases subdirectories as well

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 06:12:23 PDT 2019


Author: nico
Date: Mon Aug  5 06:12:23 2019
New Revision: 367851

URL: http://llvm.org/viewvc/llvm-project?rev=367851&view=rev
Log:
compiler-rt: Rename cc files in test/hwasan/TestCases subdirectories as well

Should've been part of r367849.

Added:
    compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cpp
      - copied unchanged from r367850, compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc
    compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cpp
      - copied unchanged from r367850, compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc
    compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cpp
      - copied unchanged from r367850, compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc
    compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cpp
      - copied unchanged from r367850, compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc
Removed:
    compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc
    compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc
    compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc
    compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc

Removed: compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc?rev=367850&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cc (removed)
@@ -1,25 +0,0 @@
-// RUN: %clangxx_hwasan -O0 %s -o %t
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
-
-// UNSUPPORTED: android
-
-// REQUIRES: stable-runtime
-
-#include <stdio.h>
-#include <stdlib.h>
-
-extern void *aligned_alloc(size_t alignment, size_t size);
-
-int main() {
-  void *p = aligned_alloc(17, 100);
-  // CHECK: ERROR: HWAddressSanitizer: invalid alignment requested in aligned_alloc: 17
-  // CHECK: {{#0 0x.* in .*}}{{aligned_alloc|memalign}}
-  // CHECK: {{#1 0x.* in main .*aligned_alloc-alignment.cc:}}[[@LINE-3]]
-  // CHECK: SUMMARY: HWAddressSanitizer: invalid-aligned-alloc-alignment
-
-  printf("pointer after failed aligned_alloc: %zd\n", (size_t)p);
-  // CHECK-NULL: pointer after failed aligned_alloc: 0
-
-  return 0;
-}

Removed: compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc?rev=367850&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/Linux/pvalloc-overflow.cc (removed)
@@ -1,46 +0,0 @@
-// RUN: %clangxx_hwasan -O0 %s -o %t
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t m1 2>&1 | FileCheck %s
-// RUN: %env_hwasan_opts=allocator_may_return_null=1     %run %t m1 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t psm1 2>&1 | FileCheck %s
-// RUN: %env_hwasan_opts=allocator_may_return_null=1     %run %t psm1 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
-
-// UNSUPPORTED: android
-
-// REQUIRES: stable-runtime
-
-// Checks that pvalloc overflows are caught. If the allocator is allowed to
-// return null, the errno should be set to ENOMEM.
-
-#include <assert.h>
-#include <errno.h>
-#include <malloc.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
-int main(int argc, char *argv[]) {
-  assert(argc == 2);
-  const char *action = argv[1];
-
-  const size_t page_size = sysconf(_SC_PAGESIZE);
-
-  void *p = nullptr;
-  if (!strcmp(action, "m1")) {
-    p = pvalloc((uintptr_t)-1);
-  } else if (!strcmp(action, "psm1")) {
-    p = pvalloc((uintptr_t)-(page_size - 1));
-  } else {
-    assert(0);
-  }
-
-  fprintf(stderr, "errno: %d\n", errno);
-
-  return p != nullptr;
-}
-
-// CHECK: {{ERROR: HWAddressSanitizer: pvalloc parameters overflow: size .* rounded up to system page size .* cannot be represented in type size_t}}
-// CHECK: {{#0 0x.* in .*pvalloc}}
-// CHECK: {{#1 0x.* in main .*pvalloc-overflow.cc:}}
-// CHECK: SUMMARY: HWAddressSanitizer: pvalloc-overflow
-
-// CHECK-NULL: errno: 12

Removed: compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc?rev=367850&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/Posix/posix_memalign-alignment.cc (removed)
@@ -1,22 +0,0 @@
-// RUN: %clangxx_hwasan -O0 %s -o %t
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
-
-// REQUIRES: stable-runtime
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int main() {
-  void *p = reinterpret_cast<void*>(42);
-  int res = posix_memalign(&p, 17, 100);
-  // CHECK: ERROR: HWAddressSanitizer: invalid alignment requested in posix_memalign: 17
-  // CHECK: {{#0 0x.* in .*posix_memalign}}
-  // CHECK: {{#1 0x.* in main .*posix_memalign-alignment.cc:}}[[@LINE-3]]
-  // CHECK: SUMMARY: HWAddressSanitizer: invalid-posix-memalign-alignment
-
-  printf("pointer after failed posix_memalign: %zd\n", (size_t)p);
-  // CHECK-NULL: pointer after failed posix_memalign: 42
-
-  return 0;
-}

Removed: compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc?rev=367850&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/Posix/system-allocator-fallback.cc (removed)
@@ -1,54 +0,0 @@
-// RUN: %clangxx %s -o %t -ldl
-// RUN: %clangxx_hwasan -shared %s -o %t.so -DSHARED_LIB -shared-libsan -Wl,-rpath,%compiler_rt_libdir
-// RUN: %env_hwasan_opts=disable_allocator_tagging=0 %run %t
-
-// The dynamic loader on Android O appears to have a bug where it crashes when
-// dlopening DF_1_GLOBAL libraries.
-// REQUIRES: android-28
-
-#include <stddef.h>
-
-// Test that allocations made by the system allocator can be realloc'd and freed
-// by the hwasan allocator.
-
-typedef void run_test_fn(void *(*system_malloc)(size_t size));
-
-#ifdef SHARED_LIB
-
-// Call the __sanitizer_ versions of these functions so that the test
-// doesn't require the Android dynamic loader.
-extern "C" void *__sanitizer_realloc(void *ptr, size_t size);
-extern "C" void __sanitizer_free(void *ptr);
-
-extern "C" run_test_fn run_test;
-void run_test(void *(*system_malloc)(size_t size)) {
-  void *mem = system_malloc(64);
-  mem = __sanitizer_realloc(mem, 128);
-  __sanitizer_free(mem);
-}
-
-#else
-
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <string>
-
-int main(int argc, char **argv) {
-  std::string path = argv[0];
-  path += ".so";
-  void *lib = dlopen(path.c_str(), RTLD_NOW);
-  if (!lib) {
-    printf("error in dlopen(): %s\n", dlerror());
-    return 1;
-  }
-
-  auto run_test = reinterpret_cast<run_test_fn *>(dlsym(lib, "run_test"));
-  if (!run_test) {
-    printf("failed dlsym\n");
-    return 1;
-  }
-
-  run_test(malloc);
-}
-
-#endif




More information about the llvm-commits mailing list