summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-07-19 15:27:23 +0000
committerEtienne Bergeron <etienneb@google.com>2016-07-19 15:27:23 +0000
commit83cc0622ec53fe0c2fed6aa56566411a44935314 (patch)
treea8d823957dd2dcd78a00586b9b069436481ba5d0
parent0ea8d275cc97e9fbc0522068ba001666f3a50a2a (diff)
downloadbcm5719-llvm-83cc0622ec53fe0c2fed6aa56566411a44935314.tar.gz
bcm5719-llvm-83cc0622ec53fe0c2fed6aa56566411a44935314.zip
[compiler-rt] Fix Asan imports/exports unittest
Summary: Avoid mismatch between imports/exports for 32-bit and 64-bits version. The test is running grep over macros to detect which functions are intercepted. Unfortunately, exception handlers differ in 32-bit and 64-bit. This patch is removing the exception handlers from the test. Reviewers: rnk Subscribers: llvm-commits, wang0109, kubabrecka, chrisha Differential Revision: https://reviews.llvm.org/D22484 llvm-svn: 275982
-rw-r--r--compiler-rt/test/asan/TestCases/Windows/dll_host.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
index 71721fe29e8..5dba64926b2 100644
--- a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
+++ b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
@@ -5,20 +5,39 @@
// RUN: %clang_cl_asan -O0 %s -Fe%t
//
// Get the list of ASan wrappers exported by the main module RTL:
-// RUN: dumpbin /EXPORTS %t | grep -o "__asan_wrap[^ ]*" | grep -v @ | sort | uniq > %t.exported_wrappers
+// note: The mangling decoration (i.e. @4 )is removed because calling convention
+// differ from 32-bit and 64-bit.
+// RUN: dumpbin /EXPORTS %t | grep -o "__asan_wrap[^ ]*" | sed -e s/@.*// > %t.exported_wrappers
// FIXME: we should really check the other __asan exports too.
-// RUN: dumpbin /EXPORTS %t | grep -o "__sanitizer_[^ ]*" | grep -v @ | sort | uniq >> %t.exported_wrappers
+// RUN: dumpbin /EXPORTS %t | grep -o "__sanitizer_[^ ]*" | sed -e s/@.*// >> %t.exported_wrappers
//
// Get the list of ASan wrappers imported by the DLL RTL:
// [BEWARE: be really careful with the sed commands, as this test can be run
// from different environemnts with different shells and seds]
-// RUN: grep INTERCEPT_LIBRARY_FUNCTION %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(/__asan_wrap_/ | sed -e s/).*// | sort | uniq > %t.dll_imports
-// RUN: grep "^INTERFACE_FUNCTION.*sanitizer" %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(// | sed -e s/).*// | sort | uniq >> %t.dll_imports
+// RUN: grep INTERCEPT_LIBRARY_FUNCTION %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(/__asan_wrap_/ | sed -e s/).*// > %t.dll_imports
+// RUN: grep "^INTERFACE_FUNCTION.*sanitizer" %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(// | sed -e s/).*// >> %t.dll_imports
+//
+// Add functions interecepted in asan_malloc.win.cc and asan_win.cc.
+// RUN: echo "__asan_wrap_HeapAlloc" >> %t.dll_imports
+// RUN: echo "__asan_wrap_HeapFree" >> %t.dll_imports
+// RUN: echo "__asan_wrap_HeapReAlloc" >> %t.dll_imports
+// RUN: echo "__asan_wrap_HeapSize" >> %t.dll_imports
+// RUN: echo "__asan_wrap_CreateThread" >> %t.dll_imports
+// RUN: echo "__asan_wrap_NtWaitForWorkViaWorkerFactory" >> %t.dll_imports
+// RUN: echo "__asan_wrap_RaiseException" >> %t.dll_imports
+//
+// The exception handlers differ in 32-bit and 64-bit, so we ignore them:
+// RUN: echo "__asan_wrap__except_handler3" >> %t.exported_wrappers
+// RUN: echo "__asan_wrap__except_handler4" >> %t.exported_wrappers
+// RUN: echo "__asan_wrap___C_specific_handler" >> %t.exported_wrappers
+//
+// RUN: sort %t.dll_imports | uniq > %t.dll_imports-sorted
+// RUN: sort %t.exported_wrappers | uniq > %t.exported_wrappers-sorted
//
// Now make sure the DLL thunk imports everything:
// RUN: echo
// RUN: echo "=== NOTE === If you see a mismatch below, please update asan_win_dll_thunk.cc"
-// RUN: diff %t.dll_imports %t.exported_wrappers
+// RUN: diff %t.dll_imports-sorted %t.exported_wrappers-sorted
// REQUIRES: asan-static-runtime
#include <stdio.h>
OpenPOWER on IntegriCloud