-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicCheck.sh
More file actions
54 lines (46 loc) · 1.01 KB
/
BasicCheck.sh
File metadata and controls
54 lines (46 loc) · 1.01 KB
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
#!/bin/bash
# everything works=0, helgrind faild=1, valgrind faild=2, valgrind and helgrind faild=3, Compilation failed=7
DIR_PATH=${1?Error: no path given}
PROGRAM=${2?Error: no program name}
cd $DIR_PATH
output="7"
check="0"
table=" Compilation Memory leaks thread race"
make > "/dev/null"
if [ $? -gt 0 ];then
echo $table
echo " Fail FAIL FAIL"
exit 7
fi
valgrind --leak-check=full --error-exitcode=2 ./${PROGRAM} ${ARGUMANTS} > valgrind.txt 2>&1
if [ $? -eq 2 ];then
check="1"
fi
valgrind --tool=helgrind --error-exitcode=1 ./${PROGRAM} ${ARGUMANTS} > helgrind.txt 2>&1
if [ $? -ne 1 ];then
if [ $check -ne 1 ];then
echo $table
echo " PASS PASS PASS"
rm valgrind.txt
rm helgrind.txt
exit 0
else
echo $table
echo " PASS FAIL PASS"
exit 2
rm valgrind.txt
fi
fi
if [ $check -eq 1 ];then
output="3"
echo $table
echo " PASS FAIL FAIL"
else
output="1"
echo $table
echo " PASS PASS FAIL"
fi
rm valgrind.txt
rm helgrind.txt
cd - > "/dev/null"
exit $output