From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 0849758EB for ; Fri, 25 Nov 2016 18:02:32 +0100 (CET) Received: by mail-wm0-f54.google.com with SMTP id f82so97466478wmf.1 for ; Fri, 25 Nov 2016 09:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=eFygx3Us94uJFp7cpMHvLcT5vI5RV/NdurKnGfHM8sc=; b=xtvMrFGGtvTRReeMJ3u5aADvgG9cldEIUpArXHFAv37liEGfQMq5ClDA2E++06yFKk HrwAYQjUycG24n+70b1c3kXNt1uwcO0dMiNOY0lBp63X7Q0NhdT4EhlqvbhLBkO6uKvU W2Ww2jdJY2cmY2k/vnNa1sM/qrKr5dKYy4iWQAH9USxOuKJrDgdpFYReoitId+mZM36o z0XwvPglYYEDQlXqPN40L0IIH8kDjLEI7oKdP6z3qw9YuoswpZaZbrRHJuwIMYEgfiNs TX34XZCwxzK7CDsZBcsO09KpoWdJo2iqzB3oMOFwmO9DWLb4P7OemOrB7f9xtC4PoytM PMqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=eFygx3Us94uJFp7cpMHvLcT5vI5RV/NdurKnGfHM8sc=; b=fT8UCAXkRORzDbG6NRsQ1p7S/eNLvn0tqJ7ON/2+hk4IEQtfJvz15DZRV3EhoENEo2 H/hnhg0yct4AUwXFnFUGTdWQg1fmBrYheXAwqmZnHd6SO9zfxkZXqGJFvHq+olbtWc61 ucgGhKCUNMwrBSgzhCSI8nEIhoxuYffAjPyEzGDU5lt5V/4RrH2fM6IP/SL5Oa0hfEem m7+bIqZvnT7RErsxvE3JoSS5gAiV114fu+cjKU3JuTSUSB5WqcejUrEOVw0tINhxyPPH q4vKax1qf/+Xxbi/f+HGY7sDEldd4zw0R6depGvRP2VDT50G47EsoYCIPiicpoChWkvN tlFg== X-Gm-Message-State: AKaTC011+Zi3yQ1MMHFSi4sz220iPFhXBs3hNQHxZFYQZXwfaIlFGzKgQ7AFxg4aE25nAB6d X-Received: by 10.28.7.130 with SMTP id 124mr8242336wmh.18.1480093351556; Fri, 25 Nov 2016 09:02:31 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id ct7sm29707757wjc.2.2016.11.25.09.02.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 09:02:30 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Fri, 25 Nov 2016 18:02:14 +0100 Message-Id: <1480093334-29957-8-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> References: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH 7/7] tests: add checkpatch X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2016 17:02:32 -0000 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 --- 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