-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate_results.bash
executable file
·209 lines (183 loc) · 5.12 KB
/
generate_results.bash
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env bash
ROOT_DIR=$(pwd)
PATH=${PATH}:${ROOT_DIR}
SRC_DIR=${ROOT_DIR}/src
mkdir -p build
cd build
function my_time {
echo -n "$1 "
# BSD date doesn't provide sub second measurements
before=$(python3 -c "import time; print(time.time())")
$@
if [ "$?" -ne "0" ]
then
python3 -c "import time; print(str(time.time() - ${before}) + 's')"
fi
}
mkdir -p clang-tidy
cd clang-tidy
export CXX=clang++
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE ../.. > cmake.txt
cp compile_commands.json ../..
clang-tidy --quiet -checks=*,-fuchsia-default-arguments,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-modernize-use-trailing-return-type,-fuchsia-default-arguments-calls,-llvmlibc-*,-readability-identifier-length,-altera-struct-pack-align,-altera-unroll-loops ${SRC_DIR}/*.cpp 1> warnings.txt
rm ../../compile_commands.json
associate_warnings.py --cpp_dir=${SRC_DIR}
cd ..
mkdir -p cppcheck
cd cppcheck
cppcheck ${SRC_DIR}/*.cpp 1> cppcheck.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
cd ..
mkdir -p gcc/debug
cd gcc/debug
function run_executable {
$(timeout 1 ./${1} > intermediate_results/${1}_output.txt 2>&1)
echo ${1} $? > intermediate_results/${1}_result.txt
}
export -f run_executable
function run_executable_with_valgrind {
$(timeout 5 valgrind --error-exitcode=1 ./${1} > intermediate_results/${1}_valgrind_output.txt 2>&1)
echo ${1} $? > intermediate_results/${1}_valgrind_result.txt
}
export -f run_executable_with_valgrind
function run_folder {
with_valgrind=${1}
declare -a executable_files
executables_count=0
for file in `ls -1` ; do
if [ -x $file ] && [ -f $file ] ; then
executable_files[executables_count]=$file
let "executables_count++"
fi
done
mkdir -p intermediate_results
[[ "$with_valgrind" = true ]] && multiplier=2 || multiplier=1
num_jobs=$(($executables_count*$multiplier))
for (( i=0; i<=$(( $executables_count -1 )); i++ ))
do
echo -ne "kicking off $(($i*$multiplier+1))/$num_jobs\r"
sem -j+0 run_executable ${executable_files[$i]}
if [ "$with_valgrind" = true ] ; then
echo -ne "kicking off $(($i*$multiplier+2))/$num_jobs\r"
sem -j+0 run_executable_with_valgrind ${executable_files[$i]}
fi
done
echo -ne '\n'
sem --wait
rm -f runtime_results.txt
if [ "$with_valgrind" = true ] ; then
rm -f valgrind_results.txt
fi
for file in "${executable_files[@]}" ; do
cat intermediate_results/${file}_result.txt >> runtime_results.txt
if [ "$with_valgrind" = true ] ; then
cat intermediate_results/${file}_valgrind_result.txt >> valgrind_results.txt
fi
done
}
echo "gcc debug"
export CXX='g++'
cmake ../../.. -DCMAKE_BUILD_TYPE=Debug > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder true
cd ..
mkdir -p rel_with_deb_info
cd rel_with_deb_info
echo "gcc rel with deb info"
cmake ../../.. -DCMAKE_BUILD_TYPE=RelWithDebInfo > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder true
cd ../..
mkdir -p clang/debug
cd clang/debug
export CXX=clang++
echo "clang debug"
cmake ../../.. -DCMAKE_BUILD_TYPE=Debug > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder false
cd ..
mkdir -p rel_with_deb_info
cd rel_with_deb_info
echo "clang rel with deb info"
cmake ../../.. -DCMAKE_BUILD_TYPE=RelWithDebInfo > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder false
cd ../..
fsanitize_build() {
mkdir -p $2/debug
cd $2/debug
if [ "$1" == "gcc" ]; then
export CXX='g++'
else
export CXX=$1++
fi
echo $1 $2 debug
cmake ../../../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=$2 -fno-sanitize-recover=$2" > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder false
cd ..
mkdir -p rel_with_deb_info
cd rel_with_deb_info
echo $1 $2 rel with deb info
cmake ../../../.. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-fsanitize=$2 -fno-sanitize-recover=$2" > cmake.txt
make -j $(nproc) 1> make.txt 2> warnings.txt
associate_warnings.py --cpp_dir=${SRC_DIR}
run_folder false
cd ../..
}
mkdir -p clang_fsanitize
cd clang_fsanitize
fsanitize_build clang address
fsanitize_build clang undefined
fsanitize_build clang address,undefined
cd ..
mkdir -p gcc_fsanitize
cd gcc_fsanitize
fsanitize_build gcc address
fsanitize_build gcc leak
fsanitize_build gcc undefined
fsanitize_build gcc address,leak,undefined
cd ..
mkdir -p msvc
cd msvc
../../download_msvc_files.py
cd ../..
#print results
echo
echo
echo VERSIONS
echo
echo linux kernel
uname -a
echo
echo gcc
gcc --version
echo
echo valgrind
valgrind --version
echo
echo clang++
clang++ --version
echo
echo clang-tidy
clang-tidy --version
echo
echo cppcheck
cppcheck --version
echo
echo parallell
parallel --version
echo
echo bash
bash --version
echo
echo python3
python3 --version
echo
export LC_CTYPE=C.UTF-8
print_results.py