[Ezbench-dev] [PATCH 10/25] test/piglit: allow resuming incomplete runs
Petri Latvala
petri.latvala at intel.com
Fri Feb 24 11:19:11 UTC 2017
From: Martin Peres <martin.peres at linux.intel.com>
---
tests.d/piglit/piglit.test | 62 +++++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/tests.d/piglit/piglit.test b/tests.d/piglit/piglit.test
index 32d54be..6e247c2 100644
--- a/tests.d/piglit/piglit.test
+++ b/tests.d/piglit/piglit.test
@@ -44,42 +44,50 @@ END
done
# Display the final status, if it was a full run
- if [ -z "${testSubTests[$t]}" ]; then
- if [ "$exit_code" -eq 0 ]; then
- echo ": completed"
- else
- echo ": incomplete"
- fi
+ if [ ! -f "${run_log_file}.testlist" ]; then
+ echo ": completed"
fi
# delete the temporary report
- rm -rf ${piglit_output} 2>&1
+ rm -rf "${piglit_output}" 2>&1
+
+ return 0
}
function __piglit_resume__ {
cd "$REPO_PIGLIT"
- # ignore the incomplete result to avoid being stuck in a loop
- local cmdline="$REPO_PIGLIT/piglit resume -n ${run_log_file}_tmp"
+ # verify that the run is indeed resumable
+ local piglit_output="${run_log_file}_tmp"
+ [ -d "$piglit_output" ] || return 19
- # Start the debug console
- if hash xterm; then
- xterm -geometry +0+300 -e "echo $cmdline; tail -F \"$run_log_file.stdout\""&
- xterm_pid=$!
- fi
+ # Only try to resume if it is still possible to resume, otherwise, just
+ # generate the report
+ if [ -f "$piglit_output/metadata.json" ]; then
+ # ignore the incomplete result to avoid being stuck in a loop
+ local cmdline="$REPO_PIGLIT/piglit resume -n '$piglit_output'"
- ENV_DUMP_RESTRICT_TO_BINARY="NO_ENVDUMP_PLEASE"
- $cmdline >> "$run_log_file.stdout" 2>> "$run_log_file.stderr"
- local exit_code=$?
+ # Start the debug console
+ if hash xterm; then
+ xterm -geometry +0+300 -e "echo $cmdline; tail -n1 -F \"$run_log_file.stdout\""&
+ xterm_pid=$!
+ fi
- # Kill the debug console
- [ -n "$xterm_pid" ] && kill $xterm_pid
+ ENV_DUMP_RESTRICT_TO_BINARY="NO_ENVDUMP_PLEASE" \
+ $cmdline >> "$run_log_file.stdout" 2>> "$run_log_file.stderr"
+ local exit_code=$?
- if [ $exit_code -ne 0 ]; then
- __piglit_resume__
- else
- __piglit_gen_report__
+ # Kill the debug console
+ [ -n "$xterm_pid" ] && kill $xterm_pid
+
+ # piglit resume returns 1 if we try to resume a report that is already done
+ if [ $exit_code -ne 0 ]; then
+ __piglit_resume__
+ fi
fi
+
+ __piglit_gen_report__
+ return 0
}
function __piglit_run__ {
@@ -92,8 +100,8 @@ function __piglit_run__ {
# Sub tests
local has_subtests=0
local testlist=''
- testlistfile="${run_log_file}.testlist"
- rm "$testlistfile"
+ local testlistfile="${run_log_file}.testlist"
+ rm "$testlistfile" 2> /dev/null
for subtest in "${run_sub_tests[@]}"; do
echo "$subtest" | cut -d '<' -f 1 >> $testlistfile
has_subtests=1
@@ -132,7 +140,8 @@ for backend in $backends; do
[ "$(basename $test_script)" == "igt.py" ] && continue
name="piglit:$backend:$(basename ${test_script} | cut -d '.' -f 1)"
- eval "${name}_run() { __piglit_run__ $backend $test_script \$@; }"
+ eval "${name}_run() { __piglit_run__ $backend $test_script \$@;}"
+ eval "${name}_resume() { __piglit_resume__;}"
test_name="$test_name $name"
done
done
@@ -140,3 +149,4 @@ done
test_unit="pass/total"
test_type="unit"
test_exec_time=600
+test_has_exit_code=1
--
2.9.3
More information about the Ezbench-dev
mailing list