-
Notifications
You must be signed in to change notification settings - Fork 1
/
valgrind.sh
executable file
·51 lines (41 loc) · 941 Bytes
/
valgrind.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
#!/bin/sh
# Constants
min=0
max=100
# Check directory of execution
repo_location=./
if [ ! -f "$repo_location/Makefile" ]; then
repo_location=../
fi
if [ ! -f "$repo_location/Makefile" ]; then
echo "${RED}ERROR${NC}: Not able to set repo location"
fi
# Handle arguments
if [ "$#" -gt 0 ]; then
input="$@"
else
input=$(ruby -e "puts ($min..$max).to_a.shuffle.join(' ')")
fi
make -C ${repo_location}
echo "${repo_location}push_swap $input"
echo "----------------";
# valgrind --leak-check=full \
# --show-leak-kinds=all \
# --track-origins=yes \
# --verbose \
# --log-file=valgrind-out.txt \
# ./executable exampleParam1
valgrind --leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
${repo_location}push_swap $input > /dev/null &&
{
echo "----------------";
echo
echo "It worked!"
} ||
{
echo "----------------";
echo
echo "It failed!"
}