[Ezbench-dev] [PATCH 11/15] test/piglit: allow resuming incomplete runs

Martin Peres martin.peres at linux.intel.com
Mon Jan 30 20:54:09 UTC 2017


---
 tests.d/piglit/piglit.test | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tests.d/piglit/piglit.test b/tests.d/piglit/piglit.test
index ed104e1..8a78f74 100644
--- a/tests.d/piglit/piglit.test
+++ b/tests.d/piglit/piglit.test
@@ -44,42 +44,45 @@ 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
 }
 
 function __piglit_resume__ {
     cd "$REPO_PIGLIT"
 
+    # verify that the run is indeed resumable
+    local piglit_output="${run_log_file}_tmp"
+    [ -d "$piglit_output" ] || return 19
+
     # ignore the incomplete result to avoid being stuck in a loop
-    local cmdline="$REPO_PIGLIT/piglit resume -n ${run_log_file}_tmp"
+    local cmdline="$REPO_PIGLIT/piglit resume -n '$piglit_output'"
 
     # Start the debug console
     if hash xterm; then
-        xterm -geometry +0+300 -e "echo $cmdline; tail -F \"$run_log_file.stdout\""&
+        xterm -geometry +0+300 -e "echo $cmdline; tail -n1 -F \"$run_log_file.stdout\""&
         xterm_pid=$!
     fi
 
-    ENV_DUMP_RESTRICT_TO_BINARY="NO_ENVDUMP_PLEASE"
+    ENV_DUMP_RESTRICT_TO_BINARY="NO_ENVDUMP_PLEASE" \
     $cmdline >> "$run_log_file.stdout" 2>> "$run_log_file.stderr"
     local exit_code=$?
 
     # Kill the debug console
     [ -n "$xterm_pid" ] && kill $xterm_pid
 
-    if [ $exit_code -ne 0 ]; then
+    # piglit resume returns 1 if we try to resume a report that is already done
+    if [[ $exit_code -ne 0 && $exit_code -ne 1 ]]; then
         __piglit_resume__
     else
         __piglit_gen_report__
     fi
+
+    return 0
 }
 
 function __piglit_run__ {
@@ -92,8 +95,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 +135,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
-- 
2.11.0



More information about the Ezbench-dev mailing list