On Fri, Sep 19, 2014 at 11:13 PM, Yuri Gribov <tetra2...@gmail.com> wrote:
> Will test and resend on Monday.

Ok, I've fallen ill and then completely forgot about this. Here's an
updated version.

>> CLANG=${CLANG:-clang}
> You probably need the same for CLANGXX

I'm doing this below depending on whether CLANG is really clang or gcc.

> Why are you disabling leak detection? It is on by default, which means
> you are benchmarking not the same thing that users run.
> At least make it an option.

I've kept the detect_leaks=0 because as kcc mentioned lots of tests
have leaks. If you desperately want this cluttered stderr you can
remove the detect_leaks=0 part from final patch (or I can do it
myself).

> I don't understand this LD_LIBRARY_PATH magic, what's its for?

Fixed. This now allows user to override default script's ASAN_OPTIONS.

@Evgeniy: you can just remove detect_leaks=0 if you desperately want
this stderr clutter in runner's output.

-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: run_spec_clang_asan.sh
===================================================================
--- run_spec_clang_asan.sh      (revision 2196)
+++ 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 tests 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,8 +80,8 @@
 FC         = echo
 
 default=base=default=default:
-COPTIMIZE     = $OPT_LEVEL
-CXXOPTIMIZE  =  $OPT_LEVEL
+COPTIMIZE   = $OPT_LEVEL
+CXXOPTIMIZE = $OPT_LEVEL
 
 default=base=default=default:
 PORTABILITY = -DSPEC_CPU_LP64
@@ -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=alloc_dealloc_mismatch=0:detect_leaks=0${ASAN_OPTIONS:+:$ASAN_OPTIONS}
 . shrc
 runspec -c $name -a run -I -l --size $size -n $NUM_RUNS $@

Reply via email to