[compiler-rt] r254955 - [TSan] Port check_memcpy.sh script to a regular lit test.
Jonathan Roelofs via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 15:17:57 PST 2015
On 12/7/15 3:47 PM, Alexey Samsonov via llvm-commits wrote:
>
> On Mon, Dec 7, 2015 at 2:00 PM, Jonathan Roelofs
> <jonathan at codesourcery.com <mailto:jonathan at codesourcery.com>> wrote:
>
>
>
> On 12/7/15 2:54 PM, Alexey Samsonov via llvm-commits wrote:
>
> Author: samsonov
> Date: Mon Dec 7 15:53:59 2015
> New Revision: 254955
>
> URL: http://llvm.org/viewvc/llvm-project?rev=254955&view=rev
> Log:
> [TSan] Port check_memcpy.sh script to a regular lit test.
>
> Check that TSan runtime doesn't contain compiler-inserted calls
> to memset/memmove functions.
>
> In future, we may consider moving this test to
> test/sanitizer_common,
> as we don't want to have compiler-inserted memcpy/memmove calls in
> any sanitizer runtime.
>
> Added:
> compiler-rt/trunk/test/tsan/Linux/check_memcpy.cc
> compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh (with
> props)
> Removed:
> compiler-rt/trunk/lib/tsan/check_memcpy.sh
> Modified:
> compiler-rt/trunk/lib/tsan/Makefile.old
>
> Modified: compiler-rt/trunk/lib/tsan/Makefile.old
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/Makefile.old?rev=254955&r1=254954&r2=254955&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/Makefile.old (original)
> +++ compiler-rt/trunk/lib/tsan/Makefile.old Mon Dec 7 15:53:59 2015
> @@ -71,14 +71,12 @@ presubmit:
> # Release build with clang.
> $(MAKE) -f Makefile.old clean
> $(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=$(CLANG)
> CXX=$(CLANG)++
> - ./check_memcpy.sh
> # Debug build with gcc
> $(MAKE) -f Makefile.old clean
> $(MAKE) -f Makefile.old run DEBUG=1 -j 16 CC=gcc CXX=g++
> # Release build with gcc
> $(MAKE) -f Makefile.old clean
> $(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=gcc CXX=g++
> - ./check_memcpy.sh
> # Sanity check for Go runtime
> (cd go && ./buildgo.sh)
> # Check cmake build
>
> Removed: compiler-rt/trunk/lib/tsan/check_memcpy.sh
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/check_memcpy.sh?rev=254954&view=auto
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/check_memcpy.sh (original)
> +++ compiler-rt/trunk/lib/tsan/check_memcpy.sh (removed)
> @@ -1,31 +0,0 @@
> -#!/bin/bash
> -
> -# Ensure that tsan runtime does not contain compiler-emitted
> memcpy and memset calls.
> -
> -set -eu
> -
> -ROOTDIR=$(dirname $0)
> -TEST_DIR=$ROOTDIR/../../test/tsan
> -
> -: ${CXX:=clang++}
> -CFLAGS="-fsanitize=thread -fPIE -O1 -g"
> -LDFLAGS="-pie -lpthread -ldl -lrt -lm -Wl,--whole-archive
> $ROOTDIR/rtl/libtsan.a -Wl,--no-whole-archive"
> -
> -SRC=$TEST_DIR/simple_race.cc
> -OBJ=$SRC.o
> -EXE=$SRC.exe
> -$CXX $SRC $CFLAGS -c -o $OBJ
> -$CXX $OBJ $LDFLAGS -o $EXE
> -
> -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
>
> Added: compiler-rt/trunk/test/tsan/Linux/check_memcpy.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Linux/check_memcpy.cc?rev=254955&view=auto
> ==============================================================================
> --- compiler-rt/trunk/test/tsan/Linux/check_memcpy.cc (added)
> +++ compiler-rt/trunk/test/tsan/Linux/check_memcpy.cc Mon Dec 7
> 15:53:59 2015
> @@ -0,0 +1,11 @@
> +// Test that verifies TSan runtime doesn't contain compiler-emitted
> +// memcpy/memmove calls. It builds the binary with TSan and
> passes it to
> +// check_memcpy.sh script.
> +
> +// RUN: %clangxx_tsan -O1 %s -o %t
> +// RUN: %S/check_memcpy.sh %t
> +
> +int main() {
> + return 0;
> +}
> +
>
> Added: compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh?rev=254955&view=auto
> ==============================================================================
> --- compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh (added)
> +++ compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh Mon Dec 7
> 15:53:59 2015
> @@ -0,0 +1,26 @@
> +#!/bin/bash
> +
> +# Script that ensures that TSan runtime does not contain
> compiler-emitted
> +# memcpy and memset calls.
>
>
> Why is this a script at all? ISTM it should be done as FileCheck
> CHECK-NOT's in check_memcpy.cc...
>
>
> Right, I've killed it in r254959. Thanks!
Thank you!
>
>
>
> +
> +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
>
> Propchange: compiler-rt/trunk/test/tsan/Linux/check_memcpy.sh
> ------------------------------------------------------------------------------
> svn:executable = *
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com <mailto:jonathan at codesourcery.com>
> CodeSourcery / Mentor Embedded
>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com <mailto:vonosmas at gmail.com>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the llvm-commits
mailing list