From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51])
 by dpdk.org (Postfix) with ESMTP id 207044B79
 for <ci@dpdk.org>; Mon,  5 Dec 2016 14:26:24 +0100 (CET)
Received: by mail-wm0-f51.google.com with SMTP id f82so92833413wmf.1
 for <ci@dpdk.org>; Mon, 05 Dec 2016 05:26:24 -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=MkpXtunGOMZFIue47tl4EXZDaUksPH2x9eLTY2hLi+Q=;
 b=YVgZyinwltsuHDtVuIB6OPxLvrtmZT129tcF49yxsZ9z9Bkr7MthMD9kxD38mu3HS5
 Kn17vOi/8/k2UrcO8KRxDgl0UTYBXXEy3/245nMsO1uM/oQLgGh5V6n0euOxX6U1RCqS
 MKFny7g9iizYm3NHNZ5T+RivjwuwudE616D7/U1cftgfr7QzjureAgb781FkLTIk129w
 HIBfo69JuL/SGsgm2ODFRLGAT4/59rZTwTSzy37lzJk/Ix838RveydMYV1t/c2U3wxCz
 43VK14FgaacEnnjLZmJyNWBv5IASIcbIhXfHlfqEeVmP68KvThL12r4hwOw9ZAeBmBRk
 c80g==
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=MkpXtunGOMZFIue47tl4EXZDaUksPH2x9eLTY2hLi+Q=;
 b=E9EM0BxUGO9KzICE2/Kstn6Q+tJFpH/R5Mxk0OciBh+uvaCqjzO6yZE+6NtrrI3s4d
 KONrp5MH70peMg50M2iglbdKqoceKNVuXrL3doRdiSfVR0DMqa8wxX507Li5BtFcLvNQ
 U3lDtzWrbpJWh/9fRffdZhndAk/3V0Mp3i5Boh6oY8BIAUn3FL9/onC7HwKedUwjbH4v
 sVT93csW0NzK1AWKCKQxh8T7ar6sV0wHvSq4UC8zHCTkODuizB710Pm4FR+6HhfeUgiD
 0Yk6Ecn0QSmHJjT0qvk4AHJzGWT0s2rs4Wi8GOVMCzoCRw+Nv6V/Z15PBUiTGHpqZbaW
 v27Q==
X-Gm-Message-State: AKaTC02RvIdGccb1mZpSNz9959gKKmCEc9wOBj5jEt8kdpWmCZdc+4UudAemKabg/1aumXgr
X-Received: by 10.28.137.193 with SMTP id l184mr8623681wmd.88.1480944383561;
 Mon, 05 Dec 2016 05:26:23 -0800 (PST)
Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184])
 by smtp.gmail.com with ESMTPSA id gk6sm20375434wjc.46.2016.12.05.05.26.22
 for <ci@dpdk.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Mon, 05 Dec 2016 05:26:22 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: ci@dpdk.org
Date: Mon,  5 Dec 2016 14:26:13 +0100
Message-Id: <1480944373-10233-8-git-send-email-thomas.monjalon@6wind.com>
X-Mailer: git-send-email 2.7.0
In-Reply-To: <1480944373-10233-1-git-send-email-thomas.monjalon@6wind.com>
References: <1480599892-14190-1-git-send-email-thomas.monjalon@6wind.com>
 <1480944373-10233-1-git-send-email-thomas.monjalon@6wind.com>
Subject: [dpdk-ci] [PATCH v4 7/7] tests: add checkpatch
X-BeenThere: ci@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK CI discussions <ci.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/ci>,
 <mailto:ci-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/ci/>
List-Post: <mailto:ci@dpdk.org>
List-Help: <mailto:ci-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/ci>,
 <mailto:ci-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Dec 2016 13:26:24 -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 <thomas.monjalon@6wind.com>
---
 tests/checkpatch.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100755 tests/checkpatch.sh

diff --git a/tests/checkpatch.sh b/tests/checkpatch.sh
new file mode 100755
index 0000000..319da1e
--- /dev/null
+++ b/tests/checkpatch.sh
@@ -0,0 +1,70 @@
+#! /bin/sh -e
+
+# BSD LICENSE
+#
+# Copyright 2016 6WIND S.A.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of 6WIND S.A. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+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