1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
echo "--------------------"
echo "Building tester"
echo "--------------------"
make -C tester
echo "Compiling and testing with sanitizers"
sanitizers=( '-fsanitize=leak -fsanitize=address'
'-fsanitize=memory -fsanitize-memory-track-origins=2'
'-fsanitize=undefined'
)
COMPARE_TEST_RESULTS=./tester/build/bmp-compare
for sanitizer in "${sanitizers[@]}"
do
echo "--------------------"
echo "Starting tests with the following sanitizer enabled: $sanitizer"
echo "--------------------"
make -C solution clean && make -C solution with="$sanitizer" || { echo "Unable to compile; see log" ; exit 1 ; }
# Here we launch tests
for test in `ls tester/tests/* -d` ;
do
fst="$test/input.bmp"
snd="$test/output.bmp"
expected="${snd/.bmp/_expected.bmp}"
./solution/build/image-transformer "$fst" "$snd"
echo -e "\ncomparing: $snd and $expected"
$COMPARE_TEST_RESULTS "$snd" "$expected" && echo -e "OK\n" || exit 1 ;
done
# tests end
echo ""
done