From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 6AE4E58EC for ; Thu, 1 Dec 2016 14:45:09 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id f82so248894240wmf.1 for ; Thu, 01 Dec 2016 05:45:09 -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=092yEdVYj4+Q0QYDgKsUXQQKbw3Hu+Tz03IAeUaOfuT5VyvxvrqtAsoD1eeQyWjFi3 unr0gqm0STXlPNX/lTM2kjge7Vvnmxn6hgjdVpDJ1S4cKMihvRtRVYq+9L5JomzkVx7i HtmgUjhHcJgR+vXQh4NIccRrrYqnQ2BuIlUKQfPq5/6MGQ+is8shc0yZICkIycNXnpGU VBzAY1Vha37yPqzik/jH8MChW+5E9LOtpind33E4gnyWTCyNLg651cSbwep7B9/Uxu9k VUozE2m9Ay9Bp2eEzqfzQfK//c57tLSPUKBlhKKzQJg/8fTwyKS2CWery4/pRY7/jN1K 5fBA== 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=jR+T40XPp7UAA3blFGJhoKnrT6e8M7UjYFcJwbbKC5j7bds7jq2kpzGkaklBtmcjlP lvY6lzgxa9PpOeDO+VmMEKNAAf7/dqvf+gp4xH3q+KtzgDSPTzmx3ZJhuFzBRTCzC9MQ vqaT9A0bNaZC9Nu4iwVw0GMWUsFNHKhxXqNVIQix6pKcKzBGaDE8+TBRIc2fYjlD++Ol LzxNhwEL1sRvMhmzSu2wVkn/TtFxhH5fVblpbmrShpUxs7b3Dt91x2jjwExDYEAfDgeL 8Rw4uWSSV/Onm3wDyo2TrRES26S3/d/5fdurt7U/r3XzaqFVW9f/586U2zecNb15u9yb JK/w== X-Gm-Message-State: AKaTC037qJMjgqiaCqikJW3GR4e/MZSOPkKplJKVaQSPaBJzN2JcBNsGLGc2IA6wS4GGry2g X-Received: by 10.28.17.213 with SMTP id 204mr33918620wmr.17.1480599908468; Thu, 01 Dec 2016 05:45:08 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id c202sm15808333wme.1.2016.12.01.05.45.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Dec 2016 05:45:07 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Thu, 1 Dec 2016 14:44:52 +0100 Message-Id: <1480599892-14190-8-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1480599892-14190-1-git-send-email-thomas.monjalon@6wind.com> References: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> <1480599892-14190-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH v2 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: Thu, 01 Dec 2016 13:45:09 -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