-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_tests.sh
executable file
·156 lines (125 loc) · 3.46 KB
/
submit_tests.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
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
#!/bin/bash
function show_usage {
echo "USAGE"
echo "====="
echo ""
echo "Mandatory parameters:"
echo " --build=debug,release"
echo " What to run: a debug build, or a release build"
echo ""
echo " --compiler-version=dir"
echo " This is used to make get the name of the directory that contains the executable file"
echo ""
echo "Optional parameters:"
echo " --analyzer=valgrind,address-sanitizer"
echo " How to run the test program:"
echo " * valgrind: execute test program with valgrind. This can only be"
echo " run with --build=debug."
echo " * address-sanitizer: indicate that the program was compiled with"
echo " -fsanitize=address. This increases maximum memory for each job."
}
# usage
# usage=0
# build type (debug, release)
# build=0
# analyzer type (valgrind, address-sanitizer
# analyzer=0
for i in "$@"; do
case $i in
--help|-h)
usage=1
shift
;;
--build=*)
build="${i#*=}"
shift
;;
--compiler-version=*)
compiler_version="${i#*=}"
shift
;;
--analyzer=*)
analyzer="${i#*=}"
shift
;;
*)
echo -e "\e[1;4;31mError:\e[0m Option $i unknown"
exit
;;
esac
done
if [ ! -z $usage ]; then
show_usage
exit
fi
if [ -z $build ]; then
echo -e "\e[1;4;31mError:\e[0m Build parameter cannot be empty"
exit
fi
if [ -z $compiler_version ]; then
echo -e "\e[1;4;31mError:\e[0m Missing compiler version"
exit
fi
if [ "$build" != "debug" ] && [ "$build" != "release" ]; then
echo -e "\e[1;4;31mError:\e[0m Wrong value for build: '$build'"
echo " Allowed values are: 'debug', 'release'."
exit
fi
if [ ! -z $analyzer ]; then
if [ "$analyzer" != "valgrind" ] && [ "$analyzer" != "address-sanitizer" ]; then
echo -e "\e[1;4;31mError:\e[0m Wrong value for analyzer: '$analyzer'"
echo " Allowed values are: 'valgrind', 'address-sanitizer'."
exit
fi
fi
exe_directory=build-$build-$compiler_version
log_directory=info_$exe_directory
valgrind_param=""
use_valgrind=0
memory=4GB
if [ ! -z $analyzer ]; then
if [ "$analyzer" == "valgrind" ]; then
use_valgrind=1
valgrind_param="--valgrind"
info="$info"_valgrind
memory=8GB
elif [ "$analyzer" == "address-sanitizer" ]; then
# address sanitizer can be used in both debug and release compilations
memory=8GB
fi
fi
queue="long"
echo "Execution information"
echo " build: '$build'"
echo " exe_directory: '$exe_directory'"
echo " log_directory: '$log_directory'"
echo " analyzer: '$analyzer'"
echo " job memory: '$memory'"
echo " job queue: '$queue'"
echo " use valgrind: '$use_valgrind'"
echo " valgrind param: '$valgrind_param'"
lal_library_path=$HOME/LAL-dev/latest/linear-arrangement-library/lal-$build-$compiler_version
gcc_library_path=/home/soft/gcc-$compiler_version/lib64
echo " lal_library_path: $lal_library_path"
echo " gcc_library_path: $gcc_library_path"
mkdir -p $log_directory
for group in detail generate graphs linarr memory numeric properties utilities; do
job_name=latest_tests_"$build"_"$group"_"$compiler_version"
echo $group" - "$build
echo " job_name: $job_name"
sbatch \
--mem=$memory \
--job-name=$job_name \
-p $queue \
-o $log_directory/$group.out \
-e $log_directory/$group.err \
./test.sh \
$valgrind_param \
--$build \
--exe-directory=$exe_directory \
--exe-group=$group \
--log-file=log_$group \
--storage-dir=$log_directory \
--lal_library_path=$lal_library_path \
--gcc_library_path=$gcc_library_path
done