From patchwork Thu Mar 20 16:21:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 26738 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3FBAC202E0 for ; Thu, 20 Mar 2014 16:23:30 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w5sf2268186qac.4 for ; Thu, 20 Mar 2014 09:23:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=8EivOQHabkxwmM+Aua0St1vxW5JOVi3zpeQ3R2kdC80=; b=dM7B1t/dbfEJnvI0bYP0BXoPqshV7Ur8b7Q0oYHQ1IkStj10jvSOdNELPN5rQx9XfX Mi8ak35ShrkaVk7KBd1hDa5UeZeO1QlOD+9gfkvfKe3vqKzdQPB8xp5M16fittkF6LiZ Ommb+0wiVvcdM0Z5oHiSk1C+HL7RCtMt0woOqnn0jERYtdOawKsk+UBbRGVpyD4VH3IL +ed2y2ek1jXQFUVzTZu0hpwaaNMPv8/IzIW5a7/cbLdWlFdQYT51mGHVmawIv4vRJe8e 5GfLdVIrJQdIixg11VoZ/xIyKIXc6Y3hXOwVVKdSIswfm3/WPh2sixZc6Uj5PJ5KmLWi 7oBA== X-Gm-Message-State: ALoCoQn/SLQG8ocZgLnjOByCvNodSbvOFBQwk5utvdN7z5ZHzzXQ1+xjcdlN/sN0kOBpReznE5+5 X-Received: by 10.236.188.133 with SMTP id a5mr12284014yhn.24.1395332609999; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.42 with SMTP id j39ls321852qge.93.gmail; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) X-Received: by 10.52.175.166 with SMTP id cb6mr28849370vdc.1.1395332609847; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id sn5si538853vdc.173.2014.03.20.09.23.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 09:23:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ij19so1215002vcb.24 for ; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) X-Received: by 10.220.191.134 with SMTP id dm6mr34934071vcb.16.1395332609756; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp401279vck; Thu, 20 Mar 2014 09:23:29 -0700 (PDT) X-Received: by 10.140.33.136 with SMTP id j8mr3560934qgj.97.1395332608362; Thu, 20 Mar 2014 09:23:28 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id m17si1419467qga.65.2014.03.20.09.23.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Mar 2014 09:23:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQfih-0003u3-I2; Thu, 20 Mar 2014 16:21:27 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQfig-0003tk-9I for xen-devel@lists.xen.org; Thu, 20 Mar 2014 16:21:26 +0000 Received: from [193.109.254.147:8166] by server-14.bemta-14.messagelabs.com id 42/BE-08195-5851B235; Thu, 20 Mar 2014 16:21:25 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1395332483!3074169!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15521 invoked from network); 20 Mar 2014 16:21:25 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 20 Mar 2014 16:21:25 -0000 X-IronPort-AV: E=Sophos;i="4.97,695,1389744000"; d="scan'208";a="113324536" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 20 Mar 2014 16:21:23 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Thu, 20 Mar 2014 12:21:22 -0400 Received: from spare.cam.xci-test.com ([10.80.2.80] helo=kazak.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WQfic-0006Zu-6F; Thu, 20 Mar 2014 16:21:22 +0000 From: Ian Campbell To: Date: Thu, 20 Mar 2014 16:21:22 +0000 Message-ID: <1395332482-5892-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1395332482-5892-1-git-send-email-ian.campbell@citrix.com> References: <1395332482-5892-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH OSSTEST 2/2] standalone mode convenience frontend X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: I can never remember all the various env vars which I can/should set so this tool provides a command line veneer over the basics. It also does some sanity checks for things which keep tripping me up (inability to read apache logs, lack of ssh-agent) which fail in more or less obscure ways. Signed-off-by: Ian Campbell --- standalone | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100755 standalone diff --git a/standalone b/standalone new file mode 100755 index 0000000..00fb707 --- /dev/null +++ b/standalone @@ -0,0 +1,231 @@ +#!/bin/bash + +set -e + +usage() { + cat >&2 <&2 + usage + exit 1 +fi + +op=$1 ; shift + +if [ x$op = x--help ] ; then + usage + exit 0 +fi + +TEMP=$(getopt -o c:f:h:rR --long config:,flight:,host:,reuse,noreuse,reinstall,help -- "$@") + +eval set -- "$TEMP" + +config= +flight="standalone" +host= +reuse=1 # Don't blow away machines by default + +while true ; do + case "$1" in + -c|--config) config=$2; shift 2;; + -f|--flight) flight=$2; shift 2;; + -h|--host) host=$2; shift 2;; + -r|--reuse) reuse=1; shift 1;; + -R|--noreuse|--reinstall)reuse=0;shift 1;; + --help) usage; exit 0;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + + esac +done + +if [ ! -r /var/log/apache2/access.log ] ; then + echo "WARNING: Cannot read apache logs. Some tests may fail" >&2 +fi + +if ! ssh-add -l >/dev/null ] ; then + echo "WARNING: Unable to access ssh-agent. Some tests may fail" >&2 +fi + +if [ $reuse -eq 0 ]; then + echo "WARNING: Will blow away machine..." + echo "Press ENTER to confirm." + read +fi + +if [ ! -f standalone.db ] ; then + echo "No standalone.db? Run standalone-reset." >&2 + exit 1 +fi + +need_flight() { + if [ -z "$flight" ] ; then + echo "run-job: Need a flight" >&2 + exit 1 + fi +} +need_host() { + if [ -z "$host" ] ; then + echo "run-job: Need a host" >&2 + exit 1 + fi +} + +ensure_logs() { + if [ ! -d "logs" ] ; then + mkdir "logs" + fi + if [ ! -d "logs/$flight" ] ; then + mkdir "logs/$flight" + fi +} + +# other potential ops: +# - run standalone reset + +case $op in + help) + usage + exit 0 + ;; + + make-flight) + need_flight + + if [ $# -lt 1 ] ; then + echo "make-flight: Need branch" >&2 + exit 1 + fi + + branch=$1; shift + + env DAILY_BRANCH_PREEXEC_HOOK=exit\ 0 \ + OSSTEST_USE_HEAD=y \ + BRANCHES_ALWAYS="$branch" \ + OSSTEST_FLIGHT=$flight \ + OSSTEST_CONFIG=$config \ + OSSTEST_NO_BASELINE=y \ + ./cr-daily-branch $@ $branch + ;; + + set-paths) + need_flight + + if [ $# -lt 1 ] ; then + echo "set-paths: Need job" >&2 + exit 1 + fi + +#build-amd64 path_dist build/dist.tar.gz +#build-amd64 path_kerndist build/kerndist.tar.gz +#build-amd64-pvops path_kerndist build/kerndist.tar.gz +#build-amd64 path_xendist build/xendist.tar.gz + + job=$1; shift + + for d in '' xen kern ; do + runvar="path_${d}dist" + path="build/${d}dist.tar.gz" + if [ -f "logs/$flight/$job/$path" ] ; then + ./cs-adjust-flight -v $flight runvar-set $job $runvar $path + fi + done + + if [ -f "logs/$flight/$job/build/kerndist.tar.gz" ] ; then + KERNEL_VER=$(tar tzf logs/$flight/$job/build/kerndist.tar.gz |\ + sed -n -e 's,^lib/modules/\(.*\)/modules.dep$,\1,p') + if [ -n "$KERNEL_VER" ]; then + ./cs-adjust-flight -v $flight \ + runvar-set $job kernel_ver $KERNEL_VER + fi + fi + ;; + + run-job) + need_flight; need_host + + if [ $# -lt 1 ] ; then + echo "run-job: Need job" >&2 + exit 1 + fi + + job=$1; shift + + ensure_logs + + env OSSTEST_CONFIG=$config \ + OSSTEST_FLIGHT=$flight \ + OSSTEST_HOST_HOST=$host \ + OSSTEST_HOST_REUSE=$reuse \ + ./sg-run-job $job 2>&1 | tee logs/$flight/$job.log + rc=${PIPESTATUS[0]} + if [ $rc -ne 0 ] ; then + echo "FAILED rc=${rc}" >&2 + fi + ;; + run-test) + need_flight; need_host + + if [ $# -lt 2 ] ; then + echo "run-test: Need job + test" >&2 + exit 1 + fi + + job=$1; shift + ts=$1; shift + + ensure_logs + + env OSSTEST_CONFIG=$config \ + OSSTEST_FLIGHT=$flight \ + OSSTEST_CONFIG=$config \ + OSSTEST_HOST_REUSE=$reuse \ + OSSTEST_JOB=$job \ + ./$ts host=$host $@ 2>&1 | tee logs/$flight/$job.$ts.log + rc=${PIPESTATUS[0]} + if [ $rc -ne 0 ] ; then + echo "FAILED rc=${rc}" >&2 + fi + ;; + *) + echo "Unknown op $op" ; exit 1 ;; +esac