]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
aiaiai-test-patchset: make checkpatch optional like other checkers
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 17 Apr 2014 23:27:35 +0000 (16:27 -0700)
committerJacob Keller <jacob.e.keller@intel.com>
Tue, 27 May 2014 18:41:00 +0000 (11:41 -0700)
This modifies behavior of aiaiai such that checkpatch will be an option
much like sparse and coccinelle. In addition, only work if checkpatch.pl
is found in the project at the requested location. Will disable
checkpatch if it cannot be found.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
aiaiai-test-patchset
doc/email/configuration.txt
doc/email/example-aiaiai.cfg
email/aiaiai-email-sh-functions
email/aiaiai-email-test-patchset

index 90c790098e388be823e1ff22d7eacfce49e0e186..d65f699c3251adf0db4f932ad56314f4ee27ad04 100755 (executable)
@@ -239,7 +239,7 @@ cleanup_handler()
 }
 set_cleanup_handler cleanup_handler
 
-TEMP=`getopt -n $PROG -o j:,c:,i:,w:,C:,p,Q:,K:,M:,v,h --long jobs:,commit-id:,input:,workdir:,logdir:,confdir:,preserve,bisectability,sparse,smatch,cppcheck,coccinelle,quick-fixes:,targets:,keywords:,kmake-opts:,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o j:,c:,i:,w:,C:,p,Q:,K:,M:,v,h --long jobs:,commit-id:,input:,workdir:,logdir:,confdir:,preserve,bisectability,sparse,smatch,cppcheck,coccinelle,checkpatch,quick-fixes:,targets:,keywords:,kmake-opts:,verbose,help -- "$@"` ||
        fail_usage ""
 eval set -- "$TEMP"
 
@@ -253,6 +253,7 @@ sparse=
 smatch=
 cppcheck=
 coccinelle=
+checkpatch=
 quick_fixes=
 targets="all"
 keywords=
@@ -317,6 +318,9 @@ while true; do
                targets="$2"
                shift
                ;;
+       --checkpatch)
+               checkpatch="yes"
+               ;;
        -K|--keywords)
                keywords="$(opt_check_read "$1" "$2")"
                shift
@@ -419,13 +423,20 @@ git diff -U0 -M "$commit_id1".."$commit_id2" > "$tmpdir/diff-for-diff-log"
 # Generate a diff for checkpatch.pl
 git diff -M "$commit_id1".."$commit_id2" > "$tmpdir/diff-for-checkpatch"
 
-# Make a copy of 'checlpatch.pl' and coccinelle scripts. This is safer than
+# Make a copy of 'checkpatch.pl' and coccinelle scripts. This is safer than
 # using them directly from the git tree because we'll apply patches under test
-# there, and the patches may also change 'checlpatch.pl' or coccinelle scripts.
-mkdir -p $verbose "$tmpdir/checkpatch" >&2
-checkpatch_pl="$tmpdir/checkpatch/checkpatch.pl"
-git show "$commit_id1:scripts/checkpatch.pl" > "$checkpatch_pl"
-chmod $verbose u+x "$checkpatch_pl" >&2
+# there, and the patches may also change 'checkpatch.pl' or coccinelle scripts.
+if [ -n "$checkpatch" ]; then
+       if git cat-file -e "$commit_id1:scripts/checkpatch.pl" 2>/dev/null; then
+               mkdir -p $verbose "$tmpdir/checkpatch" >&2
+               checkpatch_pl="$tmpdir/checkpatch/checkpatch.pl"
+               git show "$commit_id1:scripts/checkpatch.pl" > "$checkpatch_pl"
+               chmod $verbose u+x "$checkpatch_pl" >&2
+       else
+               verbose "Can't find checkpatch.pl.. disabling checkpatch tests."
+               checkpatch=
+       fi
+fi
 
 if [ -n "$coccinelle" ]; then
        if git cat-file -e "$commit_id1:scripts/coccinelle"; then
@@ -440,8 +451,10 @@ if [ -n "$coccinelle" ]; then
 fi
 
 # Run checkpatch.pl in backgound.
-test_checkpatch &
-pid_checkpatch="$!"
+if [ -n "$checkpatch" ]; then
+       test_checkpatch &
+       pid_checkpatch="$!"
+fi
 
 # Search for keywords
 if [ -n "$keywords" ]; then
@@ -464,7 +477,7 @@ for defconfig in $defconfigs; do
        test_configuration "$defconfig"
 done
 
-wait "$pid_checkpatch" || die "checkpatch failed"
+[ -z "$checkpatch" ]   || wait "$pid_checkpatch" || die "checkpatch failed"
 [ -z "$keywords" ]     || wait "$pid_keywords" || die "aiaiai-match-keywords failed"
 [ -z "$pid_bisect" ]   || wait "$pid_bisect"   || die "aiaiai-test-bisectability failed"
 
index 3ba16a48ff4d56f9887fe521fc75edb369da538a..fba254cce889372e2a8d8c522376734b73020d18 100644 (file)
@@ -134,6 +134,9 @@ additive.
 * coccinelle
     A boolean (0 or 1) indicating whether to use the coccinelle scripts during
     static analysis.
+* checkpatch
+    A boolean (0 or 1) indicating whether to use checkpatch.pl for testing
+    patches. Requires kernel project with checkpatch provided.
 
 The following options do not have default settings per project and must be
 specified for each project.
index e9f7585769d4090b0164563ac59ccd2ef77b5cba..ba780de11cf4ab33c25fcbf342d6b6587a21d785 100644 (file)
        # Set to (1) to enable coccinelle scripts during kernel builds
        coccinelle = 1
 
+       # Set to (1) to enable checkpatch.pl check during testing
+       checkpatch = 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
index ad652606ed4b680a816b5307e137d27343de70a8..5656b53b42829a623dce003a3974e021260ac654 100644 (file)
@@ -257,7 +257,7 @@ parse_config()
 # __dcfg_configs, __dcfg_always_cc, __dcfg_reply_to_all, __dcfg_accept_notify,
 # __dcfg_unwanted_keywords, __dcfg_kmake_opts, __dcfg_targets,
 # __dcfg_defconfigdir, __dcfg_bisectability, __dcfg_sparse, __dcfg_smatch,
-# __dcfg_cppcheck, __dcfg_coccinelle
+# __dcfg_cppcheck, __dcfg_coccinelle, __dcfg_checkpatch
 #
 # It is expected that this is used internally by the parse_prj_config and
 # should not normally be called outside of this file.
@@ -280,6 +280,7 @@ __parse_default_config()
        __dcfg_smatch="$(ini_config_get "$cfgfile" "defaults" "smatch")"
        __dcfg_cppcheck="$(ini_config_get "$cfgfile" "defaults" "cppcheck")"
        __dcfg_coccinelle="$(ini_config_get "$cfgfile" "defaults" "coccinelle")"
+       __dcfg_checkpatch="$(ini_config_get "$cfgfile" "defaults" "checkpatch")"
 }
 
 # Similar to "parse_config", but parses a project configuration section. If the
@@ -369,6 +370,10 @@ parse_prj_config()
        pcfg_coccinelle="$(ini_config_get "$cfgfile" "prj_$prj" "coccinelle")"
        ini_config_is_set "$cfgfile" "prj_$prj" "coccinelle" || pcfg_coccinelle="$__dcfg_coccinelle"
        pcfg_coccinelle="$(config_check_boolean "coccinelle" "$pcfg_coccinelle")"
+
+       pcfg_checkpatch="$(ini_config_get "$cfgfile" "prj_$prj" "checkpatch")"
+       ini_config_is_set "$cfgfile" "prj_$prj" "checkpatch" || pcfg_checkpatch="$__dcfg_checkpatch"
+       pcfg_checkpatch="$(config_check_boolean "checkpatch" "$pcfg_checkpatch")"
 }
 
 # Compose (but not send) e-mail reply. This function assumes that the following
index 5a1cebfc3d3b2c1871c52c584612aff7b05ae081..f2a463908b43707941c571b93faa80ef05ffce6b 100755 (executable)
@@ -330,11 +330,13 @@ sparse=
 smatch=
 cppcheck=
 coccinelle=
+checkpatch=
 [ "$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"
+[ "$pcfg_checkpatch" != "1" ] || checkpatch="--checkpatch"
 
 # Create the Cc list for replies that we'll be sending
 if [ "$pcfg_reply_to_all" = "1" ]; then
@@ -358,7 +360,8 @@ commit="$(fetch_header "X-Aiaiai-Commit" < "$hookoutput")"
 # Test the path (or patch-set)
 verbose "Test configs \"$pcfg_configs\" branch \"$pcfg_branch\" of \"$pcfg_path\""
 aiaiai-test-patchset $verbose ${cfg_preserve_files:+--preserve} \
-       ${pcfg_targets:+--targets "$pcfg_targets"} $bisectability $sparse $smatch $cppcheck $coccinelle \
+       ${pcfg_targets:+--targets "$pcfg_targets"} $bisectability \
+       $sparse $smatch $cppcheck $coccinelle $checkpatch \
        -i "$mbox" -j "$cfg_jobs" -c "$commit" -w "$tmpdir" \
        ${pcfg_defconfigdir:+-C "$pcfg_defconfigdir"} \
        ${pcfg_unwanted_keywords:+-K "$pcfg_unwanted_keywords"} \