From patchwork Wed Jun 21 14:13:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 9801931 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 C60E060329 for ; Wed, 21 Jun 2017 14:16:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B686326222 for ; Wed, 21 Jun 2017 14:16:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAC4E28389; Wed, 21 Jun 2017 14:16:27 +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 37724269A3 for ; Wed, 21 Jun 2017 14:16:25 +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 1dNgOj-0004rb-LX; Wed, 21 Jun 2017 14:14:21 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNgOi-0004oI-5w for xen-devel@lists.xenproject.org; Wed, 21 Jun 2017 14:14:20 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 84/47-03696-B3F7A495; Wed, 21 Jun 2017 14:14:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeJIrShJLcpLzFFi42JxWrrBXte63iv SYGqrmMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmnHx5Bm2gk3KFfv7PrM3MN6S7GLk5JAQ8JeY +fgBI4jNJqAr0bTlL1sXIweHiICKxO29BiAms0CoxI4XliAVwgKREo9u/mQGsVkEVCW+/fzFA mLzCnhK7G49yQoxUU7i/HGQGg4OTgEvicWP/EFMIaCS+af8IEw1ibnr4yEaBSVOznwCNoRZQE Li4IsXzBMYeWchSc1CklrAyLSKUaM4tagstUjX0FIvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NSc xqVgvOT93EyMwZBiAYAfjj2UBhxglOZiURHnLvb0ihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw 6tUB5QSLUtNTK9Iyc4DBC5OW4OBREuFdUwKU5i0uSMwtzkyHSJ1iVJQS53UF6RMASWSU5sG1w SLmEqOslDAvI9AhQjwFqUW5mSWo8q8YxTkYlYR5D9YATeHJzCuBm/4KaDET0OIXRzxAFpckIq SkGhjZNcyPqi8Ps4r5IbPtbudlnf5V8h73Wlo/7bbKc9/uLDjL+c0pq1fVhsJWNhlinUacvlJ 8Sl9/KKkXHyktk8qUDpsTvsdqqrvgwSlPOqfq7ElqZhczdf15w/32hMgLQk4rTPy7tr54ekj5 wv9q7nvvzzdfU7qcEFj++qtunqHqib8XsuyS9ZRYijMSDbWYi4oTAa//YFWTAgAA X-Env-Sender: prvs=33896ecda=Ian.Jackson@citrix.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1498054457!75035220!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50758 invoked from network); 21 Jun 2017 14:14:19 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jun 2017 14:14:19 -0000 X-IronPort-AV: E=Sophos;i="5.39,369,1493683200"; d="scan'208";a="437315093" From: Ian Jackson To: Date: Wed, 21 Jun 2017 15:13:56 +0100 Message-ID: <1498054447-11281-5-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1498054447-11281-1-git-send-email-ian.jackson@eu.citrix.com> References: <1498054447-11281-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Cc: Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH 04/15] sg-run-job: Document run-ts and spawn-ts argument syntaxes 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 --- v2: More accurate explanation of ! in IFFAIL; and mention $ok. --- sg-run-job | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/sg-run-job b/sg-run-job index 4b98e2b..b820642 100755 --- a/sg-run-job +++ b/sg-run-job @@ -146,6 +146,103 @@ proc testid_matches_globs {testid globs} { #---------- test script handling ---------- +# spwan-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Spawns the test script as a test step, and leaves it running. +# Returns token to pass to reap-ts. +# +# reap-ts TOKEN [WANTSTATUS] +# +# Waits for the test script to finish. +# +# The step status is set to "pass" (if the script exits zero) or +# IFFAIL (otherwise). (But it is not set if the script, +# or something else, already set it to "aborted" or "broken".) +# +# Return value is true if that step status matches the glob +# WANTSTATUS (which defaults to "pass"). Test failures do not +# become Tcl exceptions and do not affect other test execution. +# +# run-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Runs the test script, waiting for it to finish. +# The step status is set as for reap-ts. +# +# If that step status is not "pass", throws a Tcl exception. +# +# Normally (eg, within the recipe), an exception causes the job +# to be stopped as a failure (and proceed to log collection). +# Specifically: +# "ok" is set to "0" (which prevents most other +# general steps from running) +# The job status is set to IFFAIL. +# +# per-host-ts IFFAIL TESTID SCRIPT-ARGS... +# +# Runs the script (as a separate step) for each test host ident. +# The host ident is appended to SCRIPT-ARGS. (SCRIPT-ARGS +# should contain an even number of + items for proper testid +# generation.) +# +# The scripts are run in parallel for all host idents. +# +# If any of the step statuses is not "pass", sets the job +# status to IFFAIL and stops the job as a failure (as above). +# +# per-host-ts does nothing if the job is no longer $ok +# (subject to IFFAIL starting with !, see below) +# +# IFFAIL can be +# +# [-][!]. +# [-][!]STATUS +# +# where STATUS is the job/step status to be used if the step +# status is not as expected, and the special meanings are: +# +# - Only for run-ts; suprresses exception on failure. +# ! Run this even if the job is being truncated. +# (for per-host-ts, even if the job is no longer $ok) +# . Shorthand for "fail" +# +# TESTID specifies the unique ID for this test step. +# +# The testid must be unique within the job; but for steps which +# actual tests (ie, which might be subject to regression +# analsysis, or bisection) must be stable - ie, it must not +# change due to races nor due to future osstest changes. +# Normally this is acheived by computing it from the +# SCRIPT-ARGS by specifying something involving "=" or "/@". +# +# TESTID is processed with some substitutions (in this order): +# +# = at the start is replaced with "SCRIPTBASIS/@" +# where SCRIPTBASIS is the first entry in SCRIPT-ARGS +# with ts- removed. +# +# * as the whole TESTID is replaced with "SCRIPTBASIS/@(*)" +# +# /@ anywhere is replaced with "/ARG/ARG..." +# (ie, "/ARG" for each ARG in SCRIPT-ARGS after the +# script name, but see note about "+" in SCRIPT-ARGS, +# below.) +# +# (*) at the end is replaced by (STEPNO) +# where STEPNO is the step number within the job (which +# is unique within the job, but not stable). +# +# SCRIPT-ARGS is the script name and its arguments, but is also +# subject to some special processing: +# +# The script name should not include the ./ which is necessary +# to find the script in the current directory. This will be +# added implicitly. +# +# An argument which is precisely "+" toggles whether the +# subsequent items in SCRIPT-ARGS are added to the expansion of +# /@ in TESTID. (The "+" itself is not added to the arguments +# or the testid.) + proc run-ts {iffail args} { set wantstatus pass if {[regsub {^-} $iffail {} iffail]} { set wantstatus * }