[TSan] Use llvm-objdump+FileCheck instead of standalone .sh script.
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 7 Dec 2015 22:43:30 +0000 (22:43 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 7 Dec 2015 22:43:30 +0000 (22:43 +0000)
llvm-svn: 254959

compiler-rt/test/CMakeLists.txt
compiler-rt/test/tsan/Linux/check_memcpy.cc
compiler-rt/test/tsan/Linux/check_memcpy.sh [deleted file]

index 684b409..e5c51c8 100644 (file)
@@ -19,8 +19,8 @@ if(NOT ANDROID)
   if(NOT COMPILER_RT_STANDALONE_BUILD)
     # Use LLVM utils and Clang from the same build tree.
     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
-      clang clang-headers FileCheck count not llvm-config llvm-nm llvm-symbolizer
-      compiler-rt-headers)
+      clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump
+      llvm-symbolizer compiler-rt-headers)
     if (COMPILER_RT_HAS_PROFILE)
       list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
     endif()
index 86f2455..8ad04c0 100644 (file)
@@ -3,9 +3,13 @@
 // check_memcpy.sh script.
 
 // RUN: %clangxx_tsan -O1 %s -o %t
-// RUN: %S/check_memcpy.sh %t
+// RUN: llvm-objdump -d %t | FileCheck %s
 
 int main() {
   return 0;
 }
 
+// CHECK-NOT: callq {{.*<(__interceptor_)?mem(cpy|set)>}}
+// tail calls:
+// CHECK-NOT: jmpq {{.*<(__interceptor_)?mem(cpy|set)>}}
+
diff --git a/compiler-rt/test/tsan/Linux/check_memcpy.sh b/compiler-rt/test/tsan/Linux/check_memcpy.sh
deleted file mode 100755 (executable)
index 2b5f21f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-# Script that ensures that TSan runtime does not contain compiler-emitted
-# memcpy and memset calls.
-
-set -eu
-
-if [[ "$#" != 1 ]]; then
-  echo "Usage: $0 /path/to/binary/built/with/tsan"
-  exit 1
-fi
-
-EXE=$1
-
-NCALL=$(objdump -d $EXE | egrep "callq .*<__interceptor_mem(cpy|set)>" | wc -l)
-if [ "$NCALL" != "0" ]; then
-  echo FAIL: found $NCALL memcpy/memset calls
-  exit 1
-fi
-
-# tail calls
-NCALL=$(objdump -d $EXE | egrep "jmpq .*<__interceptor_mem(cpy|set)>" | wc -l)
-if [ "$NCALL" != "0" ]; then
-  echo FAIL: found $NCALL memcpy/memset calls
-  exit 1
-fi