-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_test.sh
executable file
·90 lines (64 loc) · 2.19 KB
/
build_test.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash -x
# By defualt, if a command exits before the timeout duration expires, the exit
# status of the command is returned by timeout.
#
# By default, if a command exceeds the timeout duration and is killed by timeout
# the exist status 124 is returned by timeout.
#
# When --preserve-status is used, if a command exits before the timeout duration
# expires, the exit status of the command is returned by timeout.
#
# When --preserve-status is used, if a command exceeds the timeout duration and
# is killed by timeout, the exist status returned by the command is 128 + N,
# where N is the signal number it received from timeout. Timeout returns this
# exit code. By default timeout sends the SIGTERM signal to the command. SIGTERM
# is signal number 15 (as defined in /usr/include/asm-generic/signal.h), meaning
# the exit code is 143 in this case.
gcc -o build/etherate_mt src/main.c -lpthread -Wall -Werror -pedantic -ftrapv -O0 -g --std=c11 -Wjump-misses-init -Wlogical-op -Wshadow -Wformat=2 -Wformat-signedness -Wextra -Wdouble-promotion -Winit-self -Wtrampolines -Wcast-qual -Wcast-align -Wwrite-strings
if [ $? -ne 0 ]
then
echo "Compile failed"
exit 1
fi
sudo ./build/etherate_mt -l
if [ $? -ne 0 ]
then
echo "Execute failed"
exit 1
fi
gcc -o build/etherate_mt src/main.c -pthread -Wall -Werror -O0 -g -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize=bounds -fsanitize=undefined
if [ $? -ne 0 ]
then
echo "Compile failed with AddressSanitizer"
exit 1
fi
sudo timeout --preserve-status 5 ./build/etherate_mt -I 3
if [ $? -ne 143 ]
then
echo "Execute failed with AddressSanitizer"
exit 1
fi
gcc -o build/etherate_mt src/main.c -pthread -Wall -Werror -O0 -g -fsanitize=thread
if [ $? -ne 0 ]
then
echo "Compile failed with ThreadSanitizer"
exit 1
fi
sudo timeout --preserve-status 5 ./build/etherate_mt -I 3
if [ $? -ne 143 ]
then
echo "Execute failed with ThreadSanitizer"
exit 1
fi
gcc -o build/etherate_mt src/main.c -lpthread -O3 --std=c11
if [ $? -ne 0 ]
then
echo "Optimised compile failed"
exit 1
fi
sudo ./build/etherate_mt -l
if [ $? -ne 0 ]
then
echo "Optimised execute failed"
exit 1
fi