Hi all,

Here is a small patch for
https://code.google.com/p/address-sanitizer/source/browse/trunk/spec/run_spec_clang_asan.sh
which
* updates docs
* adds some option verification
* adds GCC support
* disables leak detection

Does the change look sane?

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Index: spec/run_spec_clang_asan.sh
===================================================================
--- spec/run_spec_clang_asan.sh (revision 2196)
+++ spec/run_spec_clang_asan.sh (working copy)
@@ -3,31 +3,63 @@
 # Simple script to run CPU2006 with AddressSanitizer.
 # Make sure to use spec version 1.2 (SPEC_CPU2006v1.2).
 # Run this script like this:
-# $./run_spec_clang_asan.sh TAG [test|train|ref] benchmarks
+# $./run_spec_clang_asan.sh TAG size benchmarks...
 # TAG is any word. If you use different TAGS you can runs several builds in
 # parallel.
-# test is a small data set, train is medium, ref is large.
-# To run all C use all_c, for C++ use all_cpp
+# size can be test, train or ref. test is a small data set, train is medium,
+# ref is large.
+# To run all C use all_c, for C++ use all_cpp. To run integer tests use int,
+# for floating point use fp.
 
 name=$1
 shift
 size=$1
 shift
 
+me=$(basename $0)
+
+usage() {
+  echo >&2 "Usage: $me TAG size bmarks"
+  exit 1
+}
+
+if test -z "$name"; then
+  usage
+fi
+
+case "$size" in
+  test|train|ref)
+    ;;
+  *)
+    echo >&2 "$me: unexpected size: $size"
+    usage
+    ;;
+esac
+
+if [ ! -f ./shrc ]; then
+  echo >&2 "$me: script must be run from SPEC2006 folder"
+  exit 1
+fi
+
 ulimit -s 8092  # stack
 
 SPEC_J=${SPEC_J:-20}
 NUM_RUNS=${NUM_RUNS:-1}
-F_ASAN=-fsanitize=address
 CLANG=${CLANG:-clang}
 BIT=${BIT:-64}
 OPT_LEVEL=${OPT_LEVEL:-"-O2"}
-
+if $CLANG --version 2>&1 | grep -q clang; then
+  F_ASAN=-fsanitize=address
+  CLANGXX=${CLANGXX:-$CLANG++}
+else
+  F_ASAN='-fsanitize=address -static-libasan'
+  CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
+fi
 rm -rf config/$name.*
 
 COMMON_FLAGS="$F_ASAN -m$BIT -g"
-CC="$CLANG     -std=gnu89 $COMMON_FLAGS"
-CXX="${CLANG}++           $COMMON_FLAGS"
+CC="$CLANG    -std=gnu89 $COMMON_FLAGS"
+CXX="$CLANGXX            $COMMON_FLAGS"
 
 cat << EOF > config/$name.cfg
 monitor_wrapper = $SPEC_WRAPPER  \$command
@@ -48,7 +80,7 @@
 FC         = echo
 
 default=base=default=default:
-COPTIMIZE     = $OPT_LEVEL
+COPTIMIZE    = $OPT_LEVEL
 CXXOPTIMIZE  =  $OPT_LEVEL
 
 default=base=default=default:
@@ -67,7 +99,7 @@
 CXXPORTABILITY= -include string.h -include stdlib.h -include cstddef
 EOF
 
-# Don't report alloc-dealloc-mismatch bugs (there is on in 471.omnetpp)
-export ASAN_OPTIONS=alloc_dealloc_mismatch=0
+# Don't report alloc-dealloc-mismatch bugs (there is on in 471.omnetpp) and 
leaks
+export 
ASAN_OPTIONS=${ASAN_OPTIONS:-}${LD_LIBRARY_PATH:+:}alloc_dealloc_mismatch=0:detect_leaks=0
 . shrc
 runspec -c $name -a run -I -l --size $size -n $NUM_RUNS $@

Reply via email to