Patchwork [5/8] classes/testimage: if start fails, don't try to stop

login
register
mail settings
Submitter Paul Eggleton
Date April 30, 2014, 12:32 p.m.
Message ID <ffac00dc794434d8e00c74ebf90b0946cec1a248.1398861075.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/71271/
State Accepted, archived
Commit abdd8e708d5fd9bc1491fd041bd2072f57d9bec0
Headers show

Comments

Paul Eggleton - April 30, 2014, 12:32 p.m.
If we couldn't start the target, it doesn't make sense to try and stop
it here since logically it shouldn't now be in any kind of "started"
state. (It's the start function's job to clean up after itself if it
fails - to that end, fix up the QemuTarget class so that it does.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/testimage.bbclass | 2 +-
 meta/lib/oeqa/targetcontrol.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 691c7f6..285c6a9 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -209,8 +209,8 @@  def testimage_main(d):
 
     target.deploy()
 
+    target.start()
     try:
-        target.start()
         if export:
             exportTests(d,tc)
         else:
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 02cb370..ff1bb89 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -124,6 +124,7 @@  class QemuTarget(BaseTarget):
             self.server_ip = self.runner.server_ip
             self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
         else:
+            self.stop()
             raise bb.build.FuncFailed("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
 
     def stop(self):