[compiler-rt] r275982 - [compiler-rt] Fix Asan imports/exports unittest
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 08:27:26 PDT 2016
Author: etienneb
Date: Tue Jul 19 10:27:23 2016
New Revision: 275982
URL: http://llvm.org/viewvc/llvm-project?rev=275982&view=rev
Log:
[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
Modified:
compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc
Modified: compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc?rev=275982&r1=275981&r2=275982&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc Tue Jul 19 10:27:23 2016
@@ -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>
More information about the llvm-commits
mailing list