}
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"
smatch=
cppcheck=
coccinelle=
+checkpatch=
quick_fixes=
targets="all"
keywords=
targets="$2"
shift
;;
+ --checkpatch)
+ checkpatch="yes"
+ ;;
-K|--keywords)
keywords="$(opt_check_read "$1" "$2")"
shift
# 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
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
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"
# __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.
__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
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
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
# 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"} \