diff mbox

[Branch,~linaro-validation/lava-test/trunk] Rev 99: Fix tests not parsing when failed

Message ID 20111006221813.31264.11791.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson Oct. 6, 2011, 10:18 p.m. UTC
Merge authors:
  Paul Larson (pwlars)
Related merge proposals:
  https://code.launchpad.net/~pwlars/lava-test/fix-no-parsing/+merge/78325
  proposed by: Paul Larson (pwlars)
  review: Resubmit - Paul Larson (pwlars)
  review: Disapprove - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 99 [merge]
fixes bug: https://launchpad.net/bugs/869552
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-test
timestamp: Thu 2011-10-06 17:14:55 -0500
message:
  Fix tests not parsing when failed
modified:
  lava_test/commands.py
  lava_test/core/runners.py
  lava_test/core/tests.py
  tests/test_lavatest_test.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
diff mbox

Patch

=== modified file 'lava_test/commands.py'
--- lava_test/commands.py	2011-09-12 09:19:10 +0000
+++ lava_test/commands.py	2011-10-05 21:57:34 +0000
@@ -225,7 +225,7 @@ 
         if not test.is_installed:
             raise LavaCommandError("The specified test is not installed")
         try:
-            artifacts = test.run(self)
+            artifacts, run_fail = test.run(self)
         except subprocess.CalledProcessError as ex:
             if ex.returncode is None:
                 raise LavaCommandError("Command %r was aborted" % ex.cmd)
@@ -245,6 +245,9 @@ 
             if not self.args.skip_attachments:
                 artifacts.attach_standard_files_to_bundle()
             artifacts.save_bundle_as(self.args.output)
+        if run_fail:
+            raise LavaCommandError(
+                'Some of test steps returned non-zero exit code')
 
 
 class parse(TestAffectingCommand):

=== modified file 'lava_test/core/runners.py'
--- lava_test/core/runners.py	2011-09-27 20:07:52 +0000
+++ lava_test/core/runners.py	2011-10-05 21:57:34 +0000
@@ -50,7 +50,7 @@ 
                 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
+                if (returncode != 0): run_failed = True
         finally:
             stdout.close()
             stderr.close()

=== modified file 'lava_test/core/tests.py'
--- lava_test/core/tests.py	2011-09-27 20:07:52 +0000
+++ lava_test/core/tests.py	2011-10-05 21:57:34 +0000
@@ -127,10 +127,8 @@ 
                 "Invoking %r.run_and_store_artifacts(...)",
                 self.runner, observer)
             run_fail = self.runner.run(artifacts, observer)
-            if run_fail:
-                raise RuntimeError('Some of test steps returned non-zero exit code')
-            
-        return artifacts
+
+        return artifacts, run_fail
 
     def parse(self, artifacts):
         if self.parser:

=== modified file 'tests/test_lavatest_test.py'
--- tests/test_lavatest_test.py	2011-09-12 09:19:10 +0000
+++ tests/test_lavatest_test.py	2011-10-06 22:13:51 +0000
@@ -44,7 +44,7 @@ 
         self.assertFalse(test.is_installed)
         test.install()
         self.assertTrue(test.is_installed)
-        artifacts = test.run()
+        artifacts, fail_run = test.run()
         std_out = open(artifacts.stdout_pathname).read()
         self.assertTrue("foo" in std_out)