[Piglit] [PATCH 5/5] Trim a failing test case to a (near) minimal reproducing case

Ian Romanick idr at freedesktop.org
Wed Sep 24 09:47:42 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

It is very easy for the search to get stuck at a local minimum.  Thus
far that has not been an issue.  The resulting minimized test case is
generally small enough that it is easy to either perform additional
trimming by hand or find the root cause of the failure.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 trim_shader.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 trim_shader.sh

diff --git a/trim_shader.sh b/trim_shader.sh
new file mode 100644
index 0000000..d393a4f
--- /dev/null
+++ b/trim_shader.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+trimname=$(echo $1 | sed 's/shader_test/trim.shader_test/')
+workname=$(echo $1 | sed 's/shader_test/work.shader_test/')
+
+cp $1 $trimname
+
+typeset -i i
+i=0
+
+while true; do
+    if ! python2 generated_tests/random_ubo_trim.py $trimname $workname ; then
+	echo Test trimmer could not make progress.
+	break
+    fi
+
+
+    if mesa installed bin/shader_runner ./$workname -auto -fbo | grep -q pass; then
+	# If the test passes now, increment a counter.
+	echo No progress
+	i=$((i + 1))
+    else
+	# The test still fails.  The working file is now the minimal
+	# file.  Also, reset the counter.
+	mv $workname $trimname
+	i=0
+    fi
+
+    if [ $i -gt 100 ]; then
+	echo "100 attempts to trim failed.  Done"
+	break
+    fi
+done
-- 
1.8.1.4



More information about the Piglit mailing list