hwsim tests: add script to aid bisecting

Message ID 20171011114617.27448-1-johannes@sipsolutions.net
State New
Headers show
Series
  • hwsim tests: add script to aid bisecting
Related show

Commit Message

Johannes Berg Oct. 11, 2017, 11:46 a.m.
From: Johannes Berg <johannes.berg@intel.com>

I find myself writing a version of this script every now and
then, but there's little point in that - just add one to the
tree so we can use it again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/vm/bisect-run.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100755 tests/hwsim/vm/bisect-run.sh

Patch

diff --git a/tests/hwsim/vm/bisect-run.sh b/tests/hwsim/vm/bisect-run.sh
new file mode 100755
index 000000000000..fa511073f0db
--- /dev/null
+++ b/tests/hwsim/vm/bisect-run.sh
@@ -0,0 +1,43 @@ 
+#!/bin/sh
+
+set -e
+
+path="$(dirname $0)"
+
+test="$1"
+makedir="$2"
+if [ -z $test ] ; then
+	echo "This script helps bisect test failures, given a test case."
+	echo ""
+	echo "Use it like this:"
+	echo "  git bisect start"
+	echo "  git bisect bad <commit>"
+	echo "  git bisect good <commit>"
+	echo "  git bisect run $0 <test name> [<compile directory>]"
+	echo ""
+	echo "(the compile directory is optional, use it if you want to"
+	echo "use an out-of-tree kernel build."
+	echo ""
+	echo "Note that, of course, you have to have a working vm-run setup."
+	exit 200 # exit git bisect run if called that way
+fi
+
+if [ -n "$makedir" ] ; then
+	cd "$makedir"
+fi
+
+yes '' | make oldconfig || exit 125
+make -j8 || exit 125
+
+output=$(mktemp)
+if [ $? -ne 0 ] ; then
+        exit 202
+fi
+finish() {
+        rm -f $output
+}
+trap finish EXIT
+
+"$path/vm-run.sh" $test 2>&1 | tee $output
+
+grep -q 'ALL-PASSED' $output && exit 0 || exit 1