Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 5D31F431FAF for ; Mon, 24 Dec 2012 05:47:47 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CZNhqIcdADMD for ; Mon, 24 Dec 2012 05:47:46 -0800 (PST) Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D1199431FAE for ; Mon, 24 Dec 2012 05:47:46 -0800 (PST) Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net ([156.34.82.78] helo=zancas.localnet) by tesseract.cs.unb.ca with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Tn8Nb-0000RI-Cx; Mon, 24 Dec 2012 09:47:43 -0400 Received: from bremner by zancas.localnet with local (Exim 4.80) (envelope-from ) id 1Tn8NV-0006l0-Kp; Mon, 24 Dec 2012 09:47:37 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Subject: [PATCH] devel: add script to run tests on a patch series. Date: Mon, 24 Dec 2012 09:47:33 -0400 Message-Id: <1356356853-25746-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.10.4 X-Spam_bar: - Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2012 13:47:47 -0000 From: David Bremner This script is a thin wrapper around git rebase --interactive, that allows the user to fine tune patches if they break the test suite, or violate the coding style guidelines. The user can always run "git rebase --continue" to ignore false positives. I decided to use perl because inplace editing with sed is non-portable. --- I have caught several formatting violations and at least one real bug using this as "last step before sending to the list". No doubt the more talented shell-scripters / perl-hackers in the crowd can can suggest some improvements. devel/check-commit | 10 ++++++++++ devel/check-series | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 devel/check-commit create mode 100755 devel/check-series diff --git a/devel/check-commit b/devel/check-commit new file mode 100755 index 0000000..86648b8 --- /dev/null +++ b/devel/check-commit @@ -0,0 +1,10 @@ +# This script is mainly intended to be used by the check-series script +# but you are welcome to use it as a standalone tool. It takes no +# parameters and operates on the latest git commit (HEAD). + +set -e +make test +for file in $(git diff --name-only HEAD^ | grep '[.]\(c\|h\|cc\|hh\)'); do + uncrustify --replace -c devel/uncrustify.cfg $file +done +git diff --quiet diff --git a/devel/check-series b/devel/check-series new file mode 100755 index 0000000..d48e70f --- /dev/null +++ b/devel/check-series @@ -0,0 +1,33 @@ +#/bin/sh + +# Usage: check-series [upstream-commit] + +# Checks each commit in a patch series (topic branch) by running the +# script devel/check-commit. If check-commit fails (exits with +# non-zero status), the user is left in the middle of a git rebase, and +# can fix the commit, e.g. using git commit --amend, followed by +# "git rebase --continue". If all else fails, "git rebase --abort" should +# get you back to where you started. +# +# NOTE: this runs "make test" many times, so it can take a while. +# + +trap cleanup EXIT + +cleanup () { + if [ -n "$tmpdir" ]; then + rm -rf $tmpdir + fi +} + +upstream=master +if [ -n "$1" ]; then + upstream="$1" +fi + +# make sure we always run the most recent version of check-commit +# in particular cope with it going away. +tmpdir=$(mktemp -d) +cp devel/check-commit $tmpdir + +GIT_SEQUENCE_EDITOR="perl -pi -e 's,^\s*([^#\s].*)$,\1\nexec $tmpdir/check-commit,'" git rebase -i $upstream -- 1.7.10.4