From patchwork Mon Oct 30 16:01:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 10032865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22B4060291 for ; Mon, 30 Oct 2017 16:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AC0828546 for ; Mon, 30 Oct 2017 16:04:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F35D5285B5; Mon, 30 Oct 2017 16:04:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71A6E28546 for ; Mon, 30 Oct 2017 16:04:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9CVl-0005Tq-1p; Mon, 30 Oct 2017 16:02:01 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9CVj-0005Ti-Tm for xen-devel@lists.xenproject.org; Mon, 30 Oct 2017 16:02:00 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 20/57-18968-7FC47F95; Mon, 30 Oct 2017 16:01:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42JxWrohUvebz/d Ig/brWhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bnhv9MBXtFKha2d7M3MG4U6GLk5JAQ8JeY vb+ZFcRmE1CW+NnZywZiiwjoSTQdeM7YxcjFwSwwgVnicttHdpCEsIC7xP0XM8AaWARUJQ5tv 8cMYvMKmEtcfDSLBWKovMSutotgNUICChId048xQdQISpyc+QSshllAQuLgixfMExi5ZyFJzU KSWsDItIpRozi1qCy1SNfIQC+pKDM9oyQ3MTNH19DAWC83tbg4MT01JzGpWC85P3cTIzAc6hk YGHcwNp/wO8QoycGkJMq70/F7pBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3gfeQDnBotT01Iq0 zBxgYMKkJTh4lER4WYDBKcRbXJCYW5yZDpE6xWjJcejF7T9MHB037wLJZzNfNzALseTl56VKi fMygjQIgDRklObBjYNFzyVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrwfQa7iycwrgdv6Cu ggJqCDNCS/gBxUkoiQkmpg5La7u/dMVEbr+nN7Gq1Fe0Rn2nAKqjNL3/w2fxaT2sGqaZbaT36 u/mnN9G7yh6fr3c20z5deCJU/NLXjwcnHX//ujulYu/b4O4XdiVvZ1y9wvXHMysrq75ujAh6z 3C4aT214s96Qz2Uh6wTu+R9/ChQ1CTbp3PO0OOA2gTe8VEy2SVDsvs3dh0osxRmJhlrMRcWJA ApcAA6ZAgAA X-Env-Sender: prvs=469df5f04=wei.liu2@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1509379316!112627098!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 554 invoked from network); 30 Oct 2017 16:01:58 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 30 Oct 2017 16:01:58 -0000 X-IronPort-AV: E=Sophos;i="5.44,320,1505779200"; d="scan'208";a="449028852" From: Wei Liu To: Xen-devel Date: Mon, 30 Oct 2017 16:01:54 +0000 Message-ID: <20171030160154.5107-1-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Anthony PERARD Subject: [Xen-devel] [PATCH v4 for-4.10] scripts: introduce a script for build test X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ian Jackson Signed-off-by: Wei Liu Reviewed-by: Anthony PERARD --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu Cc: Julien Grall Cc: Anthony PERARD v4: 1. Check, save/restore $?. 2. Don't use trap, check exit code directly. 3. More error messages. v3: 1. Use git-clean in default rune. 2. Print more friendly message. 3. Restore HEAD automatically. --- scripts/build-test.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 scripts/build-test.sh diff --git a/scripts/build-test.sh b/scripts/build-test.sh new file mode 100755 index 0000000000..413540c13b --- /dev/null +++ b/scripts/build-test.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +# Run command on every commit within the range specified. If no command is +# provided, use the default one to clean and build the whole tree. +# +# The default rune is rather simple. To do a cross-build, please put your usual +# build rune in a shell script and invoke it with this script. + +if ! test -f xen/common/kernel.c; then + echo "Please run this script from top-level directory" + exit 1 +fi + +if test $# -lt 2 ; then + echo "Usage: $0 [CMD]" + exit 1 +fi + +status=`git status -s` +if test -n "$status"; then + echo "Tree is dirty, aborted" + exit 1 +fi + +BASE=$1; shift +TIP=$1; shift + +ORIG_BRANCH=`git symbolic-ref -q --short HEAD` +if test $? -ne 0; then + echo "Detached HEAD, aborted" + exit 1 +fi + +git rev-list $BASE..$TIP | nl -ba | tac | \ +while read num rev; do + echo "Testing $num $rev" + + git checkout $rev + ret=$? + if test $ret -ne 0; then + echo "Failed to checkout $num $rev with $ret" + exit $ret + fi + + if test $# -eq 0 ; then + git clean -fdx && ./configure && make -j4 + else + "$@" + fi + ret=$? + if test $ret -ne 0; then + echo "Failed at $num $rev with $ret" + exit $ret + fi + echo +done + +ret=$? + +echo "Restoring original HEAD" +git checkout $ORIG_BRANCH +gco_ret=$? +if test $gco_ret -ne 0; then + echo "Failed to restore orignal HEAD. Check tree status before doing anything else!" + exit $gco_ret +fi + +if test $ret -eq 0; then + echo "ok." +fi +exit $ret