[PATCH 08/14] Revert "Remove --check-only option support"

Artem Bityutskiy dedekind1 at gmail.com
Tue Feb 4 09:28:04 PST 2014


From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>

This reverts commit dbaf970c857e2a6fda9f6fd418bc873e5eb391cb.

The idea to revert was stupid. This option is used internally to optimize
Aiaiai and only check those files which were modified by the patch under test.
Thus, reverting the change.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 aiaiai-checker     | 19 ++++++++++++++++++-
 aiaiai-make-kernel | 10 ++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/aiaiai-checker b/aiaiai-checker
index 8811b6a..929423a 100755
--- a/aiaiai-checker
+++ b/aiaiai-checker
@@ -31,6 +31,7 @@ Options:
       --smatch           check with smatch;
       --cppcheck         check with cppcheck;
       --coccinelle       check with coccinelle (spatch);
+      --check-only=FILE  check only files listed in FILE;
   -h, --help             show this text and exit.
 EOF
 }
@@ -89,7 +90,7 @@ cleanup_handler()
 }
 set_cleanup_handler cleanup_handler
 
-TEMP=`getopt -n $PROG -o h --long sparse,smatch,cppcheck,coccinelle,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o h --long sparse,smatch,cppcheck,coccinelle,check-only:,help -- "$@"` ||
 	fail_usage ""
 eval set -- "$TEMP"
 
@@ -99,6 +100,7 @@ run_sparse=
 run_smatch=
 run_cppcheck=
 run_coccinelle=
+check_only=
 
 while true; do
 	case "$1" in
@@ -118,6 +120,10 @@ while true; do
 		run_coccinelle=1
 		program_required "spatch" "Usually Linux distribution provide a 'spatch' or 'coccinelle' package"
 		;;
+	--check-only)
+		check_only="$(opt_check_read "$1" "$2")"
+		shift
+		;;
 	-h|--help)
 		show_usage
 		exit 0
@@ -142,6 +148,17 @@ if [ -z "$run_sparse" ] && [ -z "$run_smatch" ] && [ -z "$run_cppcheck" ] &&
 	exit 0
 fi
 
+if [ -n "$check_only" ]; then
+	match=
+	files="$(cat "$check_only")"
+	for file in $files; do
+		match="$(printf "%s" "$@" | sed -n "/$(quote_sed_regexp "$file")/p")"
+		[ -z "$match" ] || break
+	done
+
+	[ -n "$match" ] || exit 0
+fi
+
 # Run all the tools in background
 
 if [ -n "$run_sparse" ]; then
diff --git a/aiaiai-make-kernel b/aiaiai-make-kernel
index edab96a..bba9957 100755
--- a/aiaiai-make-kernel
+++ b/aiaiai-make-kernel
@@ -46,6 +46,7 @@ Options:
       --smatch           check with smatch while building;
       --cppcheck         check with cppcheck while building;
       --coccinelle       check with coccinelle (spatch) while building;
+      --check-only=FILE  check only files listed in FILE;
   -M, --kmake-opts       additional options to append to the final kernel
                          compilation 'make' command
                          (e.g., W=2 KALLSYMS_EXTRA_PASS=1)
@@ -107,7 +108,7 @@ make_target()
 	aiaiai-locker $split -l "$lockfile" -c \
 		"make $keep_going -j $jobs -C $kernel_tree ${arch:+ARCH="$arch"} \
 		${cross:+CROSS_COMPILE="$cross"} ${objdir:+O="$objdir"} \
-		CHECK=\"aiaiai-checker $sparse $smatch $cppcheck $coccinelle --\" \
+		CHECK=\"aiaiai-checker $sparse $smatch $cppcheck $coccinelle $check_only --\" \
 		KCFLAGS='-Wno-missing-field-initializers -Wno-sign-compare' \
 		C=$check ${check:+CF="-D__CHECK_ENDIAN__"} W=1 SHELL=\"aiaiai-locker $split -l $lockfile\" \
 		$kmake_opts $target"
@@ -128,7 +129,7 @@ cleanup_handler()
 }
 set_cleanup_handler cleanup_handler
 
-TEMP=`getopt -n $PROG -o o:,D:,j:,O:,E:,k:,a:,M:,v,h --long objdir:,defconfig:,jobs:,stdout:,stderr:,keep-going,arch:,sparse,smatch,cppcheck,coccinelle,kmake-opts:,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o o:,D:,j:,O:,E:,k:,a:,M:,v,h --long objdir:,defconfig:,jobs:,stdout:,stderr:,keep-going,arch:,sparse,smatch,cppcheck,coccinelle,check-only:,kmake-opts:,verbose,help -- "$@"` ||
 	fail_usage ""
 eval set -- "$TEMP"
 
@@ -142,6 +143,7 @@ sparse=
 smatch=
 cppcheck=
 coccinelle=
+check_only=
 check=0
 kmake_opts=
 verbose=
@@ -197,6 +199,10 @@ while true; do
 		coccinelle="--coccinelle"
 		check=1
 		;;
+	--check-only)
+		check_only="--check-only $(opt_check_read "$1" "$2")"
+		shift
+		;;
 	-M|--kmake-opts)
 		kmake_opts="$2"
 		shift
-- 
1.8.5.2




More information about the aiaiai mailing list