1+ #! /bin/sh
12REPORT=report_sanitizer.txt
23OPTS=" -Wall -Werror -Wno-pointer-to-int-cast"
34LIB=" ../mapcodelib/mapcoder.o"
45
56export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true:strict_init_order=true
67
7- echo " --- -------------------------------------------------------------" | tee -a $REPORT
8+ echo " !! -------------------------------------------------------------" | tee -a $REPORT
89echo " Run address sanitizer..." | tee $REPORT
910date | tee -a $REPORT
10- echo " --- -------------------------------------------------------------" | tee -a $REPORT
11+ echo " !! -------------------------------------------------------------" | tee -a $REPORT
1112
1213TEST=` which clang`
1314if [ " $TEST " = " " ]
1415then
1516 echo " No clang found on this machine - skipping script..."
1617 exit 1
1718fi
19+
1820# No optimize
1921echo " " | tee -a $REPORT
2022echo " Run with: -O0" | tee -a $REPORT
@@ -23,17 +25,7 @@ gcc $OPTS -O0 -DDEBUG -c mapcoder.c
2325cd ../unittest
2426gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
2527./unittest | tee -a $REPORT
26- echo " ----------------" | tee -a $REPORT
27-
28- # Optimize 1
29- echo " " | tee -a $REPORT
30- echo " Run with: -O1" | tee -a $REPORT
31- cd ../mapcodelib
32- gcc $OPTS -O1 -c mapcoder.c
33- cd ../unittest
34- gcc $OPTS -O1 unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
35- ./unittest | tee -a $REPORT
36- echo " ----------------" | tee -a $REPORT
28+ echo " !! -------------------------------------------------------------" | tee -a $REPORT
3729
3830# Optimize 2
3931echo " " | tee -a $REPORT
@@ -43,7 +35,7 @@ gcc $OPTS -O2 -c mapcoder.c
4335cd ../unittest
4436gcc $OPTS -O2 unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
4537./unittest | tee -a $REPORT
46- echo " ----------------" | tee -a $REPORT
38+ echo " !! --------------------------------------------- ----------------" | tee -a $REPORT
4739
4840# Optimize 3
4941echo " " | tee -a $REPORT
@@ -53,7 +45,7 @@ gcc $OPTS -O3 -c mapcoder.c
5345cd ../unittest
5446gcc $OPTS -O3 unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
5547./unittest | tee -a $REPORT
56- echo " ----------------" | tee -a $REPORT
48+ echo " !! --------------------------------------------- ----------------" | tee -a $REPORT
5749
5850echo " " | tee -a $REPORT
5951echo " Report in: $REPORT "
0 commit comments