From patchwork Tue Oct 4 18:31:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Larson X-Patchwork-Id: 4510 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 52B4723EF6 for ; Tue, 4 Oct 2011 18:31:22 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 37E6BA180F0 for ; Tue, 4 Oct 2011 18:31:22 +0000 (UTC) Received: by eyb6 with SMTP id 6so1076781eyb.11 for ; Tue, 04 Oct 2011 11:31:22 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr2119624fau.103.1317753080028; Tue, 04 Oct 2011 11:31:20 -0700 (PDT) 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.152.23.170 with SMTP id n10cs60199laf; Tue, 4 Oct 2011 11:31:19 -0700 (PDT) Received: by 10.216.229.5 with SMTP id g5mr5383391weq.67.1317753074492; Tue, 04 Oct 2011 11:31:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fi7si2752784wbb.108.2011.10.04.11.31.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Oct 2011 11:31:14 -0700 (PDT) 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 1RB9lp-0006sh-PP for ; Tue, 04 Oct 2011 18:31:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B06A2E06D6 for ; Tue, 4 Oct 2011 18:31:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-test X-Launchpad-Branch: ~linaro-validation/lava-test/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 98 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-test/trunk] Rev 98: fix bug 833632 - lava-test now returns fail status when the test exits Message-Id: <20111004183113.26904.28970.launchpad@ackee.canonical.com> Date: Tue, 04 Oct 2011 18:31: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="14085"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: f252a79c738b0bb68a61532940939df079deb97f Merge authors: Le Chi Thu le.chi.thu@linaro.org Related merge proposals: https://code.launchpad.net/~le-chi-thu/lava-test/fix-833632/+merge/77229 proposed by: Le Chi Thu (le-chi-thu) ------------------------------------------------------------ revno: 98 [merge] committer: Paul Larson branch nick: lava-test timestamp: Tue 2011-10-04 13:28:14 -0500 message: fix bug 833632 - lava-test now returns fail status when the test exits modified: lava_test/api/delegates.py lava_test/core/runners.py lava_test/core/tests.py lava_test/main.py --- lp:lava-test https://code.launchpad.net/~linaro-validation/lava-test/trunk You are subscribed to branch lp:lava-test. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-test/trunk/+edit-subscription === modified file 'lava_test/api/delegates.py' --- lava_test/api/delegates.py 2011-09-12 09:19:10 +0000 +++ lava_test/api/delegates.py 2011-09-27 20:07:52 +0000 @@ -80,6 +80,7 @@ performed by the test runner. :type observer: :class:`~lava_test.api.observers.ITestRunnerObserver` + :return true if any test step return none-zero return code .. versionadded:: 0.2 """ === modified file 'lava_test/core/runners.py' --- lava_test/core/runners.py 2011-09-12 09:19:10 +0000 +++ lava_test/core/runners.py 2011-09-27 20:07:52 +0000 @@ -44,14 +44,17 @@ stderr = open(artifacts.stderr_pathname, 'at') delegate = DisplayDelegate(stdout, stderr, observer) extcmd = ExternalCommandWithDelegate(delegate) + run_failed = False try: for cmd in self.steps: if observer: observer.about_to_run_shell_command(cmd) returncode = extcmd.call(cmd, shell=True) if observer: observer.did_run_shell_command(cmd, returncode) + if (returncode != 00): run_failed = True finally: stdout.close() stderr.close() + return run_failed def run(self, artifacts, observer=None): """ @@ -62,5 +65,6 @@ :meth:`~lava_test.api.delegates.TestRunner.run` """ self.starttime = datetime.datetime.utcnow() - self._run_lava_test_steps(artifacts, observer) + run_failed = self._run_lava_test_steps(artifacts, observer) self.endtime = datetime.datetime.utcnow() + return run_failed === modified file 'lava_test/core/tests.py' --- lava_test/core/tests.py 2011-09-12 09:19:10 +0000 +++ lava_test/core/tests.py 2011-09-27 20:07:52 +0000 @@ -126,7 +126,10 @@ logging.debug( "Invoking %r.run_and_store_artifacts(...)", self.runner, observer) - self.runner.run(artifacts, observer) + run_fail = self.runner.run(artifacts, observer) + if run_fail: + raise RuntimeError('Some of test steps returned non-zero exit code') + return artifacts def parse(self, artifacts): === modified file 'lava_test/main.py' --- lava_test/main.py 2011-09-13 22:43:20 +0000 +++ lava_test/main.py 2011-09-27 20:07:52 +0000 @@ -48,4 +48,5 @@ import sys arg_only = sys.argv arg_only.remove(arg_only[0]) - LAVATestDispatcher().dispatch(arg_only) \ No newline at end of file + code = LAVATestDispatcher().dispatch(arg_only) + if (code != 0): exit(code) \ No newline at end of file