Skip to content

Commit cdf0b82

Browse files
committed
Renames
1 parent 1f1e207 commit cdf0b82

File tree

6 files changed

+62
-26
lines changed

6 files changed

+62
-26
lines changed

unittest/run_all.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
echo "Run all tests..."
22
date
33
echo ""
4-
./run_sanitizer.sh
4+
./run_normal.sh
5+
# ./run_sanitizer.sh
56
./run_gprof.sh
67
./run_valgrind.sh
78
echo ""

unittest/run_gprof.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
REPORT=report_gprof.txt
2+
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
23

34
echo "Run gprof profiler..." | tee $REPORT
45
date | tee -a $REPORT
56

67
echo "" | tee -a $REPORT
78
echo "Run with: -O0" | tee -a $REPORT
89
cd ../mapcodelib
9-
gcc -g -O0 -c mapcoder.c -pg
10+
gcc $OPTS -g -O0 -c mapcoder.c -pg
1011
cd ../unittest
11-
gcc -g -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
12-
./unittest
12+
gcc $OPTS -g -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
13+
./unittest | tee -a $REPORT
1314
gprof ./unittest | tee -a $REPORT
1415
echo "----------------" | tee -a $REPORT
1516

1617
echo "" | tee -a $REPORT
1718
echo "Run with: -O3" | tee -a $REPORT
1819
cd ../mapcodelib
19-
gcc -g -O3 -c mapcoder.c -pg
20+
gcc $OPTS -g -O3 -c mapcoder.c -pg
2021
cd ../unittest
21-
gcc -g -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
22-
./unittest
22+
gcc $OPTS -g -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
23+
./unittest | tee -a $REPORT
2324
gprof ./unittest | tee -a $REPORT
2425
echo "----------------" | tee -a $REPORT
2526

unittest/run_normal.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
REPORT=report_normal.txt
2+
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
3+
4+
echo "Run normal..." | tee $REPORT
5+
date | tee -a $REPORT
6+
7+
echo "" | tee -a $REPORT
8+
echo "Run with: -O0" | tee -a $REPORT
9+
cd ../mapcodelib
10+
gcc $OPTS -O0 -DDEBUG -c mapcoder.c
11+
cd ../unittest
12+
gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
13+
./unittest | tee -a $REPORT
14+
echo "----------------" | tee -a $REPORT
15+
16+
echo "" | tee -a $REPORT
17+
echo "Run with: -O3" | tee -a $REPORT
18+
cd ../mapcodelib
19+
gcc $OPTS -O3 -c mapcoder.c
20+
cd ../unittest
21+
gcc $OPTS -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
22+
./unittest | tee -a $REPORT
23+
echo "----------------" | tee -a $REPORT
24+
25+
echo "" | tee -a $REPORT
26+
echo "Report in: $REPORT"

unittest/run_sanitizer.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
REPORT=report_sanitizer.txt
2+
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
3+
24
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
35

46
echo "Run address sanitizer..." | tee $REPORT
@@ -8,39 +10,39 @@ date | tee -a $REPORT
810
echo "" | tee -a $REPORT
911
echo "Run with: -O0" | tee -a $REPORT
1012
cd ../mapcodelib
11-
gcc -O0 -DDEBUG -c mapcoder.c
13+
gcc $OPTS -O0 -DDEBUG -c mapcoder.c
1214
cd ../unittest
13-
gcc -O0 -DDEBUG unittest.c -lm -lpthread -fsanitize=address -o unittest
15+
gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -fsanitize=address -o unittest
1416
./unittest | tee -a $REPORT
1517
echo "----------------" | tee -a $REPORT sanitize.txt
1618

1719
# Optimize 1
1820
echo "" | tee -a $REPORT
1921
echo "Run with: -O1" | tee -a $REPORT sanitize.txt
2022
cd ../mapcodelib
21-
gcc -O1 -c mapcoder.c
23+
gcc $OPTS -O1 -c mapcoder.c
2224
cd ../unittest
23-
gcc -O1 unittest.c -lm -lpthread -fsanitize=address -o unittest
25+
gcc $OPTS -O1 unittest.c -lm -lpthread -fsanitize=address -o unittest
2426
./unittest | tee -a $REPORT
2527
echo "----------------" | tee -a $REPORT sanitize.txt
2628

2729
# Optimize 2
2830
echo "" | tee -a $REPORT
2931
echo "Run with: -O2" | tee -a $REPORT sanitize.txt
3032
cd ../mapcodelib
31-
gcc -O2 -c mapcoder.c
33+
gcc $OPTS -O2 -c mapcoder.c
3234
cd ../unittest
33-
gcc -O2 unittest.c -lm -lpthread -fsanitize=address -o unittest
35+
gcc $OPTS -O2 unittest.c -lm -lpthread -fsanitize=address -o unittest
3436
./unittest | tee -a $REPORT
3537
echo "----------------" | tee -a $REPORT sanitize.txt
3638

3739
# Optimize 3
3840
echo "" | tee -a $REPORT
3941
echo "Run with: -O3" | tee -a $REPORT sanitize.txt
4042
cd ../mapcodelib
41-
gcc -O3 -c mapcoder.c
43+
gcc $OPTS -O3 -c mapcoder.c
4244
cd ../unittest
43-
gcc -O3 unittest.c -lm -lpthread -fsanitize=address -o unittest
45+
gcc $OPTS -O3 unittest.c -lm -lpthread -fsanitize=address -o unittest
4446
./unittest | tee -a $REPORT
4547
echo "----------------" | tee -a $REPORT sanitize.txt
4648

unittest/run_valgrind.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
REPORT=report_valgrind.txt
2+
OPTS="-Wall -Werror -Wno-pointer-to-int-cast"
23

34
echo "Run valgrind" | tee $REPORT
45

56
echo "" | tee -a $REPORT
67
echo "Run with: -O0" | tee -a report_valgrind.txt
78
cd ../mapcodelib
8-
gcc -g -O0 -DDEBUG -c mapcoder.c
9+
gcc $OPTS -g -O0 -DDEBUG -c mapcoder.c
910
cd ../unittest
10-
gcc -g -O0 -DDEBUG unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
11-
valgrind --leak-check=yes ./unittest tee -a $REPORT
11+
gcc $OPTS -g -O0 -DDEBUG unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
12+
valgrind --leak-check=yes ./unittest | tee -a $REPORT
1213
echo "----------------" tee -a $REPORT
1314

1415
echo "" | tee -a $REPORT
1516
echo "Run with: -O3" | tee -a report_valgrind.txt
1617
cd ../mapcodelib
17-
gcc -g -O3 -c mapcoder.c
18+
gcc $OPTS -g -O3 -c mapcoder.c
1819
cd ../unittest
19-
gcc -g -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
20-
valgrind --leak-check=yes ./unittest tee -a $REPORT
20+
gcc $OPTS -g -O3 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
21+
valgrind --leak-check=yes ./unittest | tee -a $REPORT
2122
echo "----------------" tee -a $REPORT
2223

2324
echo "" tee -a $REPORT

unittest/unittest.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -983,12 +983,12 @@ static int testReEncode(void) {
983983

984984
printf("%d records\n", nrRecords);
985985
for (ccode = _TERRITORY_MIN + 1; ccode < _TERRITORY_MAX; ccode++) {
986-
int min_boundary = data_start[INDEX_OF_TERRITORY(ccode)];
987-
int max_boundary = data_start[INDEX_OF_TERRITORY(ccode) + 1];
986+
int min_boundary = DATA_START[INDEX_OF_TERRITORY(ccode)];
987+
int max_boundary = DATA_START[INDEX_OF_TERRITORY(ccode) + 1];
988988
showTestProgress(max_boundary, nrRecords, nrTests);
989989
// use internal knowledge of mapcoder to test all the territory boundaries
990990
for (m = min_boundary; m < max_boundary; m++) {
991-
const TerritoryBoundary *b = territoryBoundary(m);
991+
const TerritoryBoundary *b = TERRITORY_BOUNDARY(m);
992992

993993
// Create context for thread.
994994
contexts[nrThread].nrTests = 0;
@@ -2026,7 +2026,7 @@ static int testAlphabetPerTerritory(void) {
20262026
if (alphabetsForTerritory->alphabet[j] < 0 ||
20272027
alphabetsForTerritory->alphabet[j] >= _ALPHABET_MAX) {
20282028
foundError();
2029-
printf("*** ERROR *** Bad alphabetsForTerritory[%d].alphabet[%d]: %d\n", i, j,
2029+
printf("*** ERROR *** Bad ALPHABETS_FOR_TERRITORY[%d].alphabet[%d]: %d\n", i, j,
20302030
alphabetsForTerritory->alphabet[j]);
20312031
}
20322032
}
@@ -2037,8 +2037,13 @@ static int testAlphabetPerTerritory(void) {
20372037

20382038
int main(const int argc, const char **argv) {
20392039
int nrTests = 0;
2040+
2041+
// Ref unused var.
2042+
if (ISO3166_ALPHA[0] == 0) {
2043+
}
2044+
20402045
printf("Mapcode C Library Unit Tests\n");
2041-
printf("Library version %s (data version %s)\n", MAPCODE_C_VERSION, mapcode_dataversion);
2046+
printf("Library version %s (data version %s)\n", MAPCODE_C_VERSION, MAPCODE_DATA_VERSION);
20422047
#ifdef NO_POSIX_THREADS
20432048
printf("Compiler options: NO_POSIX_THREADS\n");
20442049
#else

0 commit comments

Comments
 (0)