[PATCH RFC 6/8] aiaiai-email: move test-patchset options into the configuration file

Keller, Jacob E jacob.e.keller at intel.com
Thu Mar 6 17:29:02 PST 2014


This patch modifies the configuration file to include most of the
options around the validator command, so that those no longer have to be
specified manually. This does break compatability with the current
validator setup, since those old options must now be specified on the
command line.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
 doc/TODO.txt                     |  6 -----
 doc/email/example-aiaiai.cfg     | 28 +++++++++++++++++++
 email/aiaiai-email-sh-functions  | 31 ++++++++++++++++++---
 email/aiaiai-email-test-patchset | 58 ++++++++++------------------------------
 4 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/doc/TODO.txt b/doc/TODO.txt
index adc9a97298b6..204825e0ec40 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -10,12 +10,6 @@ implementing them.
     containing the text for end-users to refer instead. Just like
     email.preamble refers the file, which contains the preamble. This is more
     flexible and consistent.
-  * Move command-line options of 'aiaiai-email-*' scripts to the configuration
-    file. This should make it simpler for users to configure the whole thing
-    when all the knobs are in one place. Just make each script to parse the
-    config file and pick own configuration from there. Namely, most of
-    the 'aiaiai-email-dispatcher', 'aiaiai-email-testpatchset', and
-    'aiaiai-email-lda' options have to go away.
   * Eventually make non-email scripts (aiaiai-test-patchset) also
     support the config file. This could be an alternative to specifying
     everythig via options. E.g., would could run
diff --git a/doc/email/example-aiaiai.cfg b/doc/email/example-aiaiai.cfg
index f921e611166c..03c9392dac40 100644
--- a/doc/email/example-aiaiai.cfg
+++ b/doc/email/example-aiaiai.cfg
@@ -86,6 +86,34 @@
 	# "make" command. For example, W=2 KALLSYMS_EXTRA_PASS=1.
 	kmake_opts =
 
+	# List of targets (space seperated) for which to run a kernel make.
+	# Leaving this empty will default to "all" as the only target. However,
+	# the "all" target is not implicit so you should explicitly have it in
+	# the list if you want it to run.
+	targets = all namespacecheck
+
+	# Path to the directory containing the deconfig files (those specified
+	# for each project). Leave empty to use the kernel tree default
+	# configs.
+	defconfigdir =
+
+	# Whether to test bisectability between patches in a series (1), or
+	# only to check results of the squished patch-set (0)
+	bisectability = 0
+
+	# Set to (1) to enable sparse during kernel builds
+	sparse = 1
+
+	# Set to (1) to enable smatch during kernel builds
+	smatch = 0
+
+	# Set to (1) to enable cppcheck during kernel builds
+	cppcheck = 0
+
+	# Set to (1) to enable coccinelle scripts during kernel builds
+	coccinelle = 1
+
+
 # The e-mail front-end may operate on several project. Each project has its
 # own kernel tree, kernel configuration, and some other settings. These are
 # configured in per-project sections. Section names have to start with "prj_"
diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index 32ceacbb7886..dcbc4f175be1 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -210,7 +210,9 @@ parse_config()
 # file:
 #
 # _dcfg_configs, _dcfg_branch, _dcfg_always_cc, _dcfg_reply_to_all,
-# _dcfg_accept_notify, _dcfg_unwanted_keywords, _dcfg_kmake_opts
+# _dcfg_accept_notify, _dcfg_unwanted_keywords, _dcfg_kmake_opts,
+# _dcfg_targets, _dcfg_defconfigdir, _dcfg_bisectability, _dcfg_sparse,
+# _dcfg_smatch, _dcfg_cppcheck, _dcfg_coccinelle
 #
 # It is expected that this is used internally by the parse_prj_config and
 # should not normally be called outside of this file.
@@ -227,6 +229,13 @@ _parse_default_config()
 	_dcfg_accept_notify="$(ini_config_get "$cfgfile" "defaults" "accept_notify")"
 	_dcfg_unwanted_keywords="$(ini_config_get "$cfgfile" "defaults" "unwanted_keywords")"
 	_dcfg_kmake_opts="$(ini_config_get "$cfgfile" "defaults" "kmake_opts")"
+	_dcfg_targets="$(ini_config_get "$cfgfile" "defaults" "targets")"
+	_dcfg_defconfigdir="$(ini_config_get "$cfgfile" "defaults" "defconfigdir")"
+	_dcfg_bisectability="$(ini_config_get "$cfgfile" "defaults" "bisectability")"
+	_dcfg_sparse="$(ini_config_get "$cfgfile" "defaults" "sparse")"
+	_dcfg_smatch="$(ini_config_get "$cfgfile" "defaults" "smatch")"
+	_dcfg_cppcheck="$(ini_config_get "$cfgfile" "defaults" "cppcheck")"
+	_dcfg_coccinelle="$(ini_config_get "$cfgfile" "defaults" "coccinelle")"
 }
 
 # Similar to "parse_config", but parses a project configuration section. If the
@@ -237,8 +246,10 @@ _parse_default_config()
 # The following variables are defined, but receive default values from the
 # [defaults] section, if they are not specified in the project section:
 #
-# pcfg_configs, pcfg_branch, pcfg_reply_to_all, pcfg_accept_notify,
-# pcfg_always_cc, pcfg_unwanted_keywords, and pcfg_kmake_opts.
+# pcfg_configs, pcfg_branch, pcfg_always_cc, pcfg_reply_to_all,
+# pcfg_accept_notify, pcfg_unwanted_keywords, pcfg_kmake_opts, pcfg_targets,
+# pcfg_defconfigdir, pcfg_bisectability, pcfg_sparse, pcfg_smatch,
+# pcfg_cppcheck, pcfg_coccinelle
 #
 # If the project is not found, this function only defined an empty "pcfg_name"
 # variable.
@@ -281,6 +292,20 @@ parse_prj_config()
 	ini_config_is_set "$cfgfile" "prj_$prj" "unwanted_keywords" || pcfg_unwanted_keywords="$_dcfg_unwanted_keywords"
 	pcfg_kmake_opts="$(ini_config_get "$cfgfile" "prj_$prj" "kmake_opts")"
 	ini_config_is_set "$cfgfile" "prj_$prj" "kmake_opts" || pcfg_kmake_opts="$_dcfg_kmake_opts"
+	pcfg_targets="$(ini_config_get "$cfgfile" "prj_$prj" "targets")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "targets" || pcfg_targets="$_dcfg_targets"
+	pcfg_defconfigdir="$(ini_config_get "$cfgfile" "prj_$prj" "defconfigdir")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "defconfigdir" || pcfg_defconfigdir="$_dcfg_defconfigdir"
+	pcfg_bisectability="$(ini_config_get "$cfgfile" "prj_$prj" "bisectability")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "bisectability" || pcfg_bisectability="$_dcfg_bisectability"
+	pcfg_sparse="$(ini_config_get "$cfgfile" "prj_$prj" "sparse")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "sparse" || pcfg_sparse="$_dcfg_sparse"
+	pcfg_smatch="$(ini_config_get "$cfgfile" "prj_$prj" "smatch")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "smatch" || pcfg_smatch="$_dcfg_smatch"
+	pcfg_cppcheck="$(ini_config_get "$cfgfile" "prj_$prj" "cppcheck")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "cppcheck" || pcfg_cppcheck="$_dcfg_cppcheck"
+	cfg_coccinelle="$(ini_config_get "$cfgfile" "prj_$prj" "coccinelle")"
+	ini_config_is_set "$cfgfile" "prj_$prj" "coccinelle" || cfg_coccinelle="$_dcfg_coccinelle"
 }
 
 # Compose (but not send) e-mail reply. This function assumes that the following
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index cb177dbcbda8..a55b4810db07 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -35,20 +35,9 @@ The mbox file containing the patches to test is expected to come from stdin
 
 Options:
   -i, --input=MBOX       use the MBOX file instead of stdin;
-  -C, --confdir=CDIR     path to the directory containing the defconfig files
-                         (those you specify in the config file); by default the
-                         defconfig files are assumed to be part of the
-                         <kernel-tree>; this option makes it possible to use
-                         stand-alone defconfig files instead;
   -p, --preserve         preserve all the temporary files - do not clean up;
       --test-mode        test mode - work as usually, but do not actually
                          send replies;
-      --bisectability    test bisectability;
-      --targets          list of make targets to build (defaults to all);
-      --sparse           check with sparse while building;
-      --smatch           check with smatch while building;
-      --cppcheck         check with cppcheck;
-      --coccinelle       check with coccinelle;
   -v, --verbose          be verbose;
   -h, --help             show this text and exit.
 EOF
@@ -187,19 +176,12 @@ $(cat -- $tmpdir/test-patchset.log)
 EOF
 }
 
-TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long test-mode,input:,confdir:,preserve,bisectability,targets,sparse,smatch,cppcheck,coccinelle,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long test-mode,input:,preserve,verbose,help -- "$@"` ||
 	fail_usage ""
 eval set -- "$TEMP"
 
 mbox=
-confdir=
 test_mode=
-bisectability=
-targets="all"
-sparse=
-smatch=
-cppcheck=
-coccinelle=
 
 while true; do
 	case "$1" in
@@ -207,35 +189,12 @@ while true; do
 		mbox="$(opt_check_read "$1" "$2")"
 		shift
 		;;
-	-C|--confdir)
-		confdir="$(opt_check_dir "$1" "$2")"
-		shift
-		;;
 	-p|--preserve)
 		preserve="--preserve"
 		;;
 	--test-mode)
 		test_mode=y
 		;;
-	--bisectability)
-		bisectability="--bisectability"
-		;;
-	--targets)
-		targets="$2"
-		shift
-		;;
-	--sparse)
-		sparse="--sparse"
-		;;
-	--smatch)
-		smatch="--smatch"
-		;;
-	--cppcheck)
-		cppcheck="--cppcheck"
-		;;
-	--coccinelle)
-		coccinelle="--coccinelle"
-		;;
 	-v|--verbose) verbose=-v
 		;;
 	-h|--help)
@@ -325,6 +284,17 @@ if [ -z "$pcfg_name" ]; then
 	error_project_not_found
 fi
 
+bisectability=
+sparse=
+smatch=
+cppcheck=
+coccinelle=
+[ "$pcfg_bisectability" != "1" ] || bisectablity="--bisectability"
+[ "$pcfg_sparse" != "1" ] || sparse="--sparse"
+[ "$pcfg_smatch" != "1" ] || smatch="--smatch"
+[ "$pcfg_cppcheck" != "1" ] || cppcheck="--cppcheck"
+[ "$pcfg_coccinelle" != "1" ] || coccinelle="--coccinelle"
+
 # Create the Cc list for replies that we'll be sending
 if [ "$pcfg_reply_to_all" = "1" ]; then
 	# All the patch recipients will be CCed
@@ -343,9 +313,9 @@ fi
 # Test the path (or patch-set)
 verbose "Test configs \"$pcfg_configs\" branch \"$pcfg_branch\" of \"$pcfg_path\""
 aiaiai-test-patchset $verbose $preserve \
-	$bisectability ${targets:--targets "$targets"} $sparse $smatch $cppcheck $coccinelle \
+	${pcfg_targets:--targets "$pcfg_targets"} $bisectability $sparse $smatch $cppcheck $coccinelle \
 	-i "$mbox" -j "$cfg_jobs" -c "$pcfg_branch" -w "$tmpdir" \
-	${confdir:+-C "$confdir"} \
+	${pcfg_defconfigdir:+-C "$pcfg_defconfigdir"} \
 	${pcfg_unwanted_keywords:+-K "$pcfg_unwanted_keywords"} -- \
 	${pcfg_kmake_opts:+-M "$pcfg_kmake_opts"} \
 	"$pcfg_path" "$pcfg_configs" > "$tmpdir/test-patchset.log" ||
-- 
1.8.3.1




More information about the aiaiai mailing list