[dpdk-ci] [PATCH 7/7] tests: add checkpatch
Thomas Monjalon
thomas.monjalon at 6wind.com
Fri Nov 25 18:02:14 CET 2016
This is the first test in this repository.
It runs on dpdk.org and use checkpatch.pl of Linux.
Note that the patch is not applied on a git tree for this basic test.
Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
tests/checkpatch.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100755 tests/checkpatch.sh
diff --git a/tests/checkpatch.sh b/tests/checkpatch.sh
new file mode 100755
index 0000000..b94aaac
--- /dev/null
+++ b/tests/checkpatch.sh
@@ -0,0 +1,42 @@
+#! /bin/sh -e
+
+# This file is in the public domain.
+
+print_usage () {
+ cat <<- END_OF_HELP
+ usage: $(basename $0) dpdk_dir < email
+
+ Check email-formatted patch from stdin.
+ This test runs checkpatch.pl of Linux via a script in dpdk_dir.
+ END_OF_HELP
+}
+
+while getopts h arg ; do
+ case $arg in
+ h ) print_usage ; exit 0 ;;
+ ? ) print_usage >&2 ; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+toolsdir=$(dirname $(readlink -m $0))/../tools
+dpdkdir=$1
+
+email=/tmp/$(basename $0 sh)$$
+$toolsdir/filter-patch-email.sh >$email
+trap "rm -f $email" INT EXIT
+
+eval $($toolsdir/parse-email.sh $email)
+# normal exit if no valid patch in the email
+[ -n "$subject" -a -n "$from" ] || exit 0
+
+failed=false
+report=$($dpdkdir/scripts/checkpatches.sh -q $email) || failed=true
+report=$(echo "$report" | sed '1,/^###/d')
+
+label='checkpatch'
+$failed && status='WARNING' || status='SUCCESS'
+$failed && desc='coding style issues' || desc='coding style OK'
+
+echo "$report" | $toolsdir/send-patch-report.sh \
+ -t "$subject" -f "$from" -m "$msgid" -p "$listid" \
+ -l "$label" -s "$status" -d "$desc"
--
2.7.0
More information about the ci
mailing list