Skip to content

Commit 74df1a7

Browse files
author
ribu
committed
Improved scripts
1 parent b35cf45 commit 74df1a7

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

unittest/run_all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/sh
12
echo "Run all tests..."
23
date
34
echo ""

unittest/run_gprof.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#!/bin/sh
12
REPORT=report_gprof.txt
23
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
34
LIB="../mapcodelib/mapcoder.o"
45

5-
echo "----------------------------------------------------------------" | tee -a $REPORT
6+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
67
echo "Run gprof profiler..." | tee $REPORT
78
date | tee -a $REPORT
8-
echo "----------------------------------------------------------------" | tee -a $REPORT
9+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
910

1011
TEST=`which gprof`
1112
if [ "$TEST" = "" ]
@@ -22,7 +23,7 @@ cd ../unittest
2223
gcc $OPTS -g -O0 unittest.c -lm -lpthread -o unittest $LIB -pg
2324
./unittest | tee -a $REPORT
2425
gprof ./unittest | tee -a $REPORT
25-
echo "----------------" | tee -a $REPORT
26+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
2627

2728
echo "" | tee -a $REPORT
2829
echo "Run with: -O3" | tee -a $REPORT
@@ -32,7 +33,7 @@ cd ../unittest
3233
gcc $OPTS -g -O3 unittest.c -lm -lpthread -o unittest $LIB -pg
3334
./unittest | tee -a $REPORT
3435
gprof ./unittest | tee -a $REPORT
35-
echo "----------------" | tee -a $REPORT
36+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
3637

3738
echo "" | tee -a $REPORT
3839
echo "Report in: $REPORT"

unittest/run_normal.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
#!/bin/sh
12
REPORT=report_normal.txt
23
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
34

4-
echo "----------------------------------------------------------------" | tee -a $REPORT
5+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
56
echo "Run normal..." | tee $REPORT
67
date | tee -a $REPORT
7-
echo "----------------------------------------------------------------" | tee -a $REPORT
8+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
89

910
echo "" | tee -a $REPORT
1011
echo "Run with: -O0" | tee -a $REPORT
@@ -13,7 +14,7 @@ gcc $OPTS -O0 -DDEBUG -c mapcoder.c
1314
cd ../unittest
1415
gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
1516
./unittest | tee -a $REPORT
16-
echo "----------------" | tee -a $REPORT
17+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
1718

1819
echo "" | tee -a $REPORT
1920
echo "Run with: -O3" | tee -a $REPORT
@@ -22,7 +23,7 @@ gcc $OPTS -O3 -c mapcoder.c
2223
cd ../unittest
2324
gcc $OPTS -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
2425
./unittest | tee -a $REPORT
25-
echo "----------------" | tee -a $REPORT
26+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
2627

2728
echo "" | tee -a $REPORT
2829
echo "Report in: $REPORT"

unittest/run_sanitizer.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
#!/bin/sh
12
REPORT=report_sanitizer.txt
23
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
34
LIB="../mapcodelib/mapcoder.o"
45

56
export 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
89
echo "Run address sanitizer..." | tee $REPORT
910
date | tee -a $REPORT
10-
echo "----------------------------------------------------------------" | tee -a $REPORT
11+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
1112

1213
TEST=`which clang`
1314
if [ "$TEST" = "" ]
1415
then
1516
echo "No clang found on this machine - skipping script..."
1617
exit 1
1718
fi
19+
1820
# No optimize
1921
echo "" | tee -a $REPORT
2022
echo "Run with: -O0" | tee -a $REPORT
@@ -23,17 +25,7 @@ gcc $OPTS -O0 -DDEBUG -c mapcoder.c
2325
cd ../unittest
2426
gcc $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
3931
echo "" | tee -a $REPORT
@@ -43,7 +35,7 @@ gcc $OPTS -O2 -c mapcoder.c
4335
cd ../unittest
4436
gcc $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
4941
echo "" | tee -a $REPORT
@@ -53,7 +45,7 @@ gcc $OPTS -O3 -c mapcoder.c
5345
cd ../unittest
5446
gcc $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

5850
echo "" | tee -a $REPORT
5951
echo "Report in: $REPORT"

unittest/run_valgrind.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#!/bin/sh
12
REPORT=report_valgrind.txt
23
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
34
LIB="../mapcodelib/mapcoder.o"
45

5-
echo "----------------------------------------------------------------" | tee -a $REPORT
6+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
67
echo "Run valgrind" | tee $REPORT
78
date | tee -a $REPORT
8-
echo "----------------------------------------------------------------" | tee -a $REPORT
9+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
910

1011
TEST=`which valgrind`
1112
if [ "$TEST" = "" ]
@@ -21,7 +22,7 @@ gcc $OPTS -g -O0 -c mapcoder.c
2122
cd ../unittest
2223
gcc $OPTS -g -O0 unittest.c -lm -lpthread -o unittest $LIB
2324
valgrind --leak-check=yes ./unittest | tee -a $REPORT
24-
echo "----------------" tee -a $REPORT
25+
echo "!! -------------------------------------------------------------" | tee -a $REPORT
2526

2627
echo "" tee -a $REPORT
2728
echo "Report in: $REPORT"

0 commit comments

Comments
 (0)