Home | History | Annotate | Download | only in tsan
      1 #!/bin/bash
      2 
      3 PIN_ROOT=${PIN_ROOT:-$HOME/pin}
      4 TS_ROOT=${TS_ROOT:-`dirname $0`}
      5 TS_VARIANT=-debug
      6 MT=
      7 
      8 UNAME_OS=`uname -o`
      9 if [ "$UNAME_OS" == "GNU/Linux" ]; then
     10   PIN_BINARY=${PIN_BINARY:-pin}
     11   DLL=so
     12   OS=linux
     13 elif [ "$UNAME_OS" == "Cygwin" ]; then
     14   PIN_BINARY=${PIN_BINARY:-pin.bat}
     15   DLL=dll
     16   OS=windows
     17 fi
     18 
     19 export MSM_THREAD_SANITIZER=1
     20 
     21 
     22 FOLLOW=-follow_execv
     23 PIN_FLAGS=${PIN_FLAGS:-""}
     24 
     25 TS_FLAGS="-short_name"
     26 PIN_FLAGS=""
     27 
     28 VERBOZE=0
     29 
     30 for arg in "$@"; do
     31   case $arg in
     32     --opt) TS_VARIANT="";;
     33     --dbg) TS_VARIANT="-debug";;
     34     --mt)  MT=mt;;
     35     --v=[1-9]) VERBOZE=1; TS_FLAGS="$TS_FLAGS $arg";;
     36     --) shift; break;;
     37     -*) TS_FLAGS="$TS_FLAGS $arg";;
     38     *) break;;
     39   esac
     40   shift
     41 done
     42 
     43 
     44 ulimit -c 0 # core make very little sense here
     45 
     46 if [ $VERBOZE == "1" ] ; then
     47   printf "PIN_ROOT   : %s\n" "$PIN_ROOT"
     48   printf "PIN_BINARY : %s\n" "$PIN_BINARY"
     49   printf "PIN_FLAGS  : %s\n" "$PIN_FLAGS"
     50   printf "TS_ROOT    : %s\n" "$TS_ROOT"
     51   printf "TS_VARIANT : %s\n" "$TS_VARIANT"
     52   printf "TS_FLAGS   : %s\n" "$TS_FLAGS"
     53   printf "PARAMS     : %s\n" "$*"
     54 fi
     55 
     56 if [ "$TS_VARIANT" == "-debug" ] ; then
     57   TS_FLAGS="$TS_FLAGS -slow_asserts"
     58 fi
     59 
     60 TS_PARAMS="$@"
     61 
     62 run() {
     63   echo $@
     64   $@
     65 }
     66 
     67 run $PIN_ROOT/$PIN_BINARY $PIN_FLAGS $FOLLOW \
     68   -t64 $TS_ROOT/bin/amd64-$OS${TS_VARIANT}-ts_pin$MT.$DLL \
     69   -t   $TS_ROOT/bin/x86-$OS${TS_VARIANT}-ts_pin$MT.$DLL \
     70  $TS_FLAGS -- $TS_PARAMS
     71 
     72