mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott Wood <swood@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Scott Wood <swood@redhat.com>
Subject: [PATCH 7/8] ktest: Add simple config-bisect frontend
Date: Sun, 16 Jul 2017 19:16:29 -0500	[thread overview]
Message-ID: <20170717001630.10518-7-swood@redhat.com> (raw)
In-Reply-To: <20170717001630.10518-1-swood@redhat.com>

From: Scott Wood <oss@buserror.net>

Add a friendly, git-bisect-like frontend to config-bisect.pl.  Unlike
ktest.pl, this frontend requires no configuration beyond specifying
the kernel output directory and (if cross-compiling) $ARCH, and does not
need to run continuously for the entire bisection (and thus can be used
to bisect on the machine testing the kernels).

Signed-off-by: Scott Wood <swood@redhat.com>
---
Is the ktest directory the right place for this, or should it (along with
config-bisect.pl) go elsewhere since it no longer depends on the ktest
infrastructure?  If so, where?

 tools/testing/ktest/config-bisect.sh | 120 +++++++++++++++++++++++++++++++++++
 1 file changed, 120 insertions(+)
 create mode 100755 tools/testing/ktest/config-bisect.sh

diff --git a/tools/testing/ktest/config-bisect.sh b/tools/testing/ktest/config-bisect.sh
new file mode 100755
index 000000000000..6032e6736109
--- /dev/null
+++ b/tools/testing/ktest/config-bisect.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+BACKEND=$(dirname $BASH_SOURCE)/config-bisect.pl
+
+usage() {
+	echo Usage:
+	echo "$0 <outputdir> command [args]"
+	echo commands:
+	echo    reset
+	echo    init
+	echo    diff
+	echo    bad [conf]
+	echo    good [conf]
+	echo    skip
+	echo If conf is unspecified, \".config\" is used.
+	echo If cross-compiling, pass the ARCH environment variable.
+}
+
+reset() {
+	rm -rf $STATE
+}
+
+init() {
+	reset
+	mkdir -p $STATE/bad
+	mkdir -p $STATE/good
+	echo 0 > $STATE/good/idx
+	echo 0 > $STATE/bad/idx
+}
+
+next() {
+	if ! [ -d $STATE ]; then
+		echo $0: No config-bisect in progress -- initializing
+		init
+	fi
+
+	IDX=$(cat $STATE/$1/idx)
+	IDX=$(expr $IDX + 1)
+
+	CONF=$2
+	if [ -z "$CONF" ]; then
+		CONF=$O/.config
+	fi
+
+	cp $CONF $STATE/$1/$IDX
+	echo $IDX > $STATE/$1/idx
+}
+
+show_diff() {
+	GI=$(cat $STATE/good/idx)
+	BI=$(cat $STATE/bad/idx)
+
+	if [ $GI != 0 ] && [ $BI != 0 ]; then
+		diff -u $STATE/good/$GI $STATE/bad/$BI
+	else
+		echo $0: cannot diff without at least one good and one bad
+	fi
+}
+
+genconf() {
+	GI=$(cat $STATE/good/idx)
+	BI=$(cat $STATE/bad/idx)
+
+	echo good index $GI, bad index $BI
+
+	if [ $GI != 0 ] && [ $BI != 0 ]; then
+		$BACKEND $O $STATE/good/$GI $STATE/bad/$BI
+
+		case $? in
+		0)
+			;;
+		2)
+			echo Failing config diff:
+			show_diff
+			;;
+		*)
+			echo $0: error in backend
+			exit 1;
+			;;
+		esac
+	fi
+}
+
+if [ -z "$1" -o -z "$2" ]; then
+	usage
+	exit 1
+fi
+
+O=$1
+STATE=$O/.config-bisect
+
+case $2 in
+init)
+	init
+	;;
+reset)
+	reset
+	;;
+diff)
+	show_diff
+	;;
+bad)
+	next bad $3
+	genconf
+	;;
+good)
+	next good $3
+	genconf
+	;;
+skip)
+	# The options chosen are randomized, so we'll get a different
+	# config just by re-running the config bisect backend with the
+	# same inputs.
+	genconf
+	;;
+*)
+	usage
+	exit 1
+	;;
+esac
-- 
2.9.4

  parent reply	other threads:[~2017-07-17  0:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17  0:16 [PATCH 1/8] ktest: Clarify config file usage Scott Wood
2017-07-17  0:16 ` [PATCH 2/8] ktest: Set buildonly=1 for CONFIG_BISECT_TYPE=build Scott Wood
2017-07-17  0:16 ` [PATCH 3/8] ktest: Set do_not_reboot=y " Scott Wood
2017-07-17  0:16 ` [PATCH 4/8] ktest: Separate out config bisect logic Scott Wood
2017-07-17  0:16 ` [PATCH 5/8] ktest/config_bisect: Simplify " Scott Wood
2017-07-17  0:16 ` [PATCH 6/8] ktest/config-bisect: Try harder to find a new config Scott Wood
2017-07-17  0:16 ` Scott Wood [this message]
2017-07-17  0:16 ` [PATCH 8/8] ktest: Use config-bisect.pl in ktest.pl Scott Wood
2017-09-14 21:41   ` Scott Wood
2017-10-04 19:17     ` Steven Rostedt
2017-10-04 19:18   ` Steven Rostedt
2017-10-04 20:24     ` Scott Wood
2017-10-05 12:50       ` Steven Rostedt
2017-10-05 23:18         ` Scott Wood
2017-10-05 19:43           ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170717001630.10518-7-swood@redhat.com \
    --to=swood@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®