From patchwork Tue Dec 11 00:24:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 13462 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 741114C1768 for ; Tue, 11 Dec 2012 00:24:16 +0000 (UTC) Received: from mail-ia0-f171.google.com (mail-ia0-f171.google.com [209.85.210.171]) by fiordland.canonical.com (Postfix) with ESMTP id EB930A19A08 for ; Tue, 11 Dec 2012 00:24:15 +0000 (UTC) Received: by mail-ia0-f171.google.com with SMTP id k27so5448078iad.2 for ; Mon, 10 Dec 2012 16:24:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=xQ6DXkTzGfa3GhlgTQb5eluqa7F1CRTc4EAkmNgCPj0=; b=WcEuXT9ru9Kj0uItAt2yt3udt9Lg1RE/YLsYynv2fGeSla36ABsaqohM2W4wx+DQ07 E4EC/9a5Nh65/HBzj9GoVQQ+QpTk8JKFDyhqkX+m06CpvcnI1cw66S666hTsWVBD9L/J amJ/9GNLl5z5TzgjW9mKf+4TeXpgsdzpu+mTbGFm4ujxsl/N0V5CpXyjbexdxbW9OITf 4SRi1S20+KU0HCMzo1uBJQe7u7TZRJRAbME9OXhFNVqbBamLmoyZCie94oPiwvjTOEGW 8SA0beuPIneh57sv6hdhFtSkkngxPuHKAKq/8rUmjcaUl0untf3vT5566gNJ1EyaIUK7 KCkw== Received: by 10.50.152.137 with SMTP id uy9mr8170202igb.62.1355185455321; Mon, 10 Dec 2012 16:24:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp100004igt; Mon, 10 Dec 2012 16:24:14 -0800 (PST) Received: by 10.180.85.165 with SMTP id i5mr13909757wiz.11.1355185454196; Mon, 10 Dec 2012 16:24:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id p7si8246908wix.47.2012.12.10.16.24.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 16:24:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1TiDdt-0005lx-Jp for ; Tue, 11 Dec 2012 00:24:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 83260E02EA for ; Tue, 11 Dec 2012 00:24:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 492 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 492: add a way for lava-test-shell tests to add attachments to the test run Message-Id: <20121211002413.15097.55579.launchpad@ackee.canonical.com> Date: Tue, 11 Dec 2012 00:24:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16341"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 4486fd469cec3094eb76d28d24920da03ced8995 X-Gm-Message-State: ALoCoQlm3WJ5UqJIx3QQSB7oouROZQwkzkVtLICt/RKfCAZC8HRg6mY9FzfqbP7UrJFXnCvFHAUC Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/easy-test-run-attachments/+merge/139085 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 492 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2012-12-11 13:23:15 +1300 message: add a way for lava-test-shell tests to add attachments to the test run added: lava_test_shell/lava-test-run-attach modified: doc/lava_test_shell.rst lava_dispatcher/actions/lava_test_shell.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'doc/lava_test_shell.rst' --- doc/lava_test_shell.rst 2012-11-22 19:52:03 +0000 +++ doc/lava_test_shell.rst 2012-12-10 20:34:15 +0000 @@ -54,6 +54,7 @@ * ``lava-test-case`` * ``lava-test-case-attach`` + * ``lava-test-run-attach`` You need to use ``lava-test-case`` (specifically, ``lava-test-case --shell``) when you are working with `hooks, signals and external @@ -113,6 +114,22 @@ 1. test case id 2. the file to attach 3. (optional) the MIME type of the file (if no MIME type is passed, a + guess is made based on the filename + +lava-test-run-attach +-------------------- + +This attaches a file to the overall test run that lava-test-shell is +currently executing, for example:: + + steps: + - "echo content > file.txt" + - "lava-test-run-attach file.txt text/plain" + +The arguments are: + + 1. the file to attach + 2. (optional) the MIME type of the file (if no MIME type is passed, a guess is made based on the filename) === modified file 'lava_dispatcher/actions/lava_test_shell.py' --- lava_dispatcher/actions/lava_test_shell.py 2012-12-11 00:22:28 +0000 +++ lava_dispatcher/actions/lava_test_shell.py 2012-12-11 00:23:15 +0000 @@ -139,11 +139,13 @@ LAVA_TEST_SHELL = '%s/lava-test-shell' % LAVA_TEST_DIR LAVA_TEST_CASE = '%s/lava-test-case' % LAVA_TEST_DIR LAVA_TEST_CASE_ATTACH = '%s/lava-test-case-attach' % LAVA_TEST_DIR +LAVA_TEST_RUN_ATTACH = '%s/lava-test-run-attach' % LAVA_TEST_DIR Target.android_deployment_data['lava_test_runner'] = LAVA_TEST_ANDROID Target.android_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL Target.android_deployment_data['lava_test_case'] = LAVA_TEST_CASE Target.android_deployment_data['lava_test_case_attach'] = LAVA_TEST_CASE_ATTACH +Target.android_deployment_data['lava_test_run_attach'] = LAVA_TEST_RUN_ATTACH Target.android_deployment_data['lava_test_sh_cmd'] = '/system/bin/mksh' Target.android_deployment_data['lava_test_dir'] = '/data/lava' Target.android_deployment_data['lava_test_results_part_attr'] = 'data_part_android_org' @@ -152,6 +154,7 @@ Target.ubuntu_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL Target.ubuntu_deployment_data['lava_test_case'] = LAVA_TEST_CASE Target.ubuntu_deployment_data['lava_test_case_attach'] = LAVA_TEST_CASE_ATTACH +Target.ubuntu_deployment_data['lava_test_run_attach'] = LAVA_TEST_RUN_ATTACH Target.ubuntu_deployment_data['lava_test_sh_cmd'] = '/bin/bash' Target.ubuntu_deployment_data['lava_test_dir'] = '/lava' Target.ubuntu_deployment_data['lava_test_results_part_attr'] = 'root_part' @@ -160,6 +163,7 @@ Target.oe_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL Target.oe_deployment_data['lava_test_case'] = LAVA_TEST_CASE Target.oe_deployment_data['lava_test_case_attach'] = LAVA_TEST_CASE_ATTACH +Target.oe_deployment_data['lava_test_run_attach'] = LAVA_TEST_RUN_ATTACH Target.oe_deployment_data['lava_test_sh_cmd'] = '/bin/sh' Target.oe_deployment_data['lava_test_dir'] = '/lava' Target.oe_deployment_data['lava_test_results_part_attr'] = 'root_part' @@ -527,7 +531,7 @@ shcmd = target.deployment_data['lava_test_sh_cmd'] - for key in ['lava_test_shell', 'lava_test_case_attach']: + for key in ['lava_test_shell', 'lava_test_case_attach', 'lava_test_run_attach']: fname = target.deployment_data[key] with open(fname, 'r') as fin: with open('%s/bin/%s' % (mntdir, os.path.basename(fname)), 'w') as fout: === added file 'lava_test_shell/lava-test-run-attach' --- lava_test_shell/lava-test-run-attach 1970-01-01 00:00:00 +0000 +++ lava_test_shell/lava-test-run-attach 2012-12-10 23:43:42 +0000 @@ -0,0 +1,34 @@ +#NOTE the lava_test_shell_action fills in the proper interpreter path +# above during target deployment + +# basename is not present on AOSP builds, but the /*\// thing does not +# work with dash (Ubuntu builds) or busybox (OpenEmbedded). Both of +# those have basename though. +which basename > /dev/null || basename () { echo ${1/*\//}; } + +usage () { + echo "Usage: lava-test--attach FILE [MIME_TYPE]" + echo "" + echo "Attach FILE to the current test run." +} + +FILE="$1" +shift +MIMETYPE="$1" +shift +if [ $# -gt 0 ]; then + usage + exit 1 +fi +if [ ! -f "$FILE" ]; then + usage + exit 1 +fi + +# $LAVA_RESULT_DIR is set by lava-test-shell +attachment_dir="$LAVA_RESULT_DIR/attachments" +mkdir -p "$attachment_dir" +cp "$FILE" "$attachment_dir" +if [ ! -z "$MIMETYPE" ]; then + echo "$MIMETYPE" > "$attachment_dir/$(basename $FILE).mimetype" +fi