Skip to content

Commit 374ccc3

Browse files
authored
Merge pull request #53 from redhat-performance/rerun
Update error codes to be more specific
2 parents 3c1dd87 + 1d54ec9 commit 374ccc3

1 file changed

Lines changed: 34 additions & 13 deletions

File tree

passmark/passmark_run

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ usage()
111111
echo " --cpu_add n: add n cpus each iteration until hit max cpus"
112112
echo " --powers_2: starting from 1 cpu, keep doubling the cpus until max cpus"
113113
source ${TOOLS_BIN}/general_setup --usage
114-
exit 1
114+
exit $E_USAGE
115115
}
116116

117117
produce_report()
@@ -174,6 +174,29 @@ produce_report()
174174
echo Checksum: Not applicable for summary file >> $summary_file
175175
}
176176

177+
attempt_tools_generic()
178+
{
179+
method="$1"
180+
if [[ ! -d "$TOOLS_BIN" ]]; then
181+
$method ${tools_git}/archive/refs/heads/main.zip
182+
if [[ $? -eq 0 ]]; then
183+
unzip -q main.zip
184+
mv test_tools-wrappers-main ${TOOLS_BIN}
185+
rm main.zip
186+
fi
187+
fi
188+
}
189+
190+
attempt_tools_git()
191+
{
192+
if [[ ! -d "$TOOLS_BIN" ]]; then
193+
git clone $tools_git "$TOOLS_BIN"
194+
if [ $? -ne 0 ]; then
195+
exit_out "Error: pulling git $tools_git failed." 101
196+
fi
197+
fi
198+
}
199+
177200
install_tools()
178201
{
179202
pushd $curdir > /dev/null
@@ -208,12 +231,10 @@ install_tools()
208231
#
209232
TOOLS_BIN=${HOME}/test_tools
210233
export TOOLS_BIN
211-
if [ ! -d "${TOOLS_BIN}" ]; then
212-
git clone $tools_git ${TOOLS_BIN}
213-
if [ $? -ne 0 ]; then
214-
exit_out "pulling git $tools_git failed." 1
215-
fi
216-
fi
234+
235+
attempt_tools_generic "wget"
236+
attempt_tools_generic "curl -L -O "
237+
attempt_tools_git
217238

218239
if [ $show_usage -eq 1 ]; then
219240
usage $1
@@ -228,7 +249,7 @@ run_passmark()
228249
if [[ $arch == "aarch64" ]]; then
229250
unzip /$to_home_root/$to_user/uploads/pt_linux_arm64.zip
230251
if [ $? -ne 0 ]; then
231-
exit_out "pt_linux_arm64.zip failed" 1
252+
exit_out "pt_linux_arm64.zip failed" $E_GENERAL
232253
fi
233254
#
234255
# Ubuntu check
@@ -242,7 +263,7 @@ run_passmark()
242263
else
243264
unzip /$to_home_root/$to_user/uploads/pt_linux_x64.zip
244265
if [ $? -ne 0 ]; then
245-
exit_out "pt_linux_x64.zip failed" 1
266+
exit_out "pt_linux_x64.zip failed" $E_GENERAL
246267
fi
247268
fi
248269
fi
@@ -261,14 +282,14 @@ run_passmark()
261282
#
262283
# Give up.
263284
#
264-
exit_out "/usr/lib64/libncurses.so.6 not present" 1
285+
exit_out "/usr/lib64/libncurses.so.6 not present" $E_GENERAL
265286
fi
266287
if [[ -f "libncurses.so.6" ]]; then
267288
ln -s libncurses.so.6 libncurses.so.5
268289
else
269290
lib=`find . -print | grep 'libncurses.so.6$'`
270291
if [[ $? -ne 0 ]]; then
271-
exit_out "libncurses.so.6 not present" 1
292+
exit_out "libncurses.so.6 not present" $E_GENERAL
272293
fi
273294
fi
274295
fi
@@ -303,12 +324,12 @@ run_passmark()
303324
if [[ $arch == "aarch64" ]]; then
304325
./pt_linux_arm64 -r 3 >> ${test_name}_${iter}.out
305326
if [ $? -ne 0 ]; then
306-
exit_out "Execution of ./pt_linux_arm64 failed" 1
327+
exit_out "Execution of ./pt_linux_arm64 failed" $E_GENERAL
307328
fi
308329
else
309330
./pt_linux_x64 -r 3 >> ${test_name}_${iter}.out
310331
if [ $? -ne 0 ]; then
311-
exit_out "Execution of ./pt_linux_x64 failed" 1
332+
exit_out "Execution of ./pt_linux_x64 failed" $E_GENERAL
312333
fi
313334
fi
314335
end_time=$(retrieve_time_stamp)

0 commit comments

Comments
 (0)