]> code.ossystems Code Review - openembedded-core.git/commitdiff
runexported: Make it compatible with host dump
authorMariano Lopez <mariano.lopez@linux.intel.com>
Tue, 1 Sep 2015 07:36:30 +0000 (07:36 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Sep 2015 20:47:12 +0000 (21:47 +0100)
Currently it is not possible to run a exported test,
but this patch will allow to use the HosDumper class
when running a exported test, otherwise the HostDumper
class will break runexpored test.

[YOCTO #8118]

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/testimage.bbclass
meta/lib/oeqa/oetest.py
meta/lib/oeqa/runexported.py

index 82cb0110e320ab7121bdadaa48c91cd2b7e82999..8fa00f5fbfa6590cf0dd84d329ef6b8226ac5f02 100644 (file)
@@ -173,9 +173,10 @@ def exportTests(d,tc):
     savedata = {}
     savedata["d"] = {}
     savedata["target"] = {}
+    savedata["host_dumper"] = {}
     for key in tc.__dict__:
         # special cases
-        if key != "d" and key != "target":
+        if key != "d" and key != "target" and key != "host_dumper":
             savedata[key] = getattr(tc, key)
     savedata["target"]["ip"] = tc.target.ip or d.getVar("TEST_TARGET_IP", True)
     savedata["target"]["server_ip"] = tc.target.server_ip or d.getVar("TEST_SERVER_IP", True)
@@ -189,6 +190,9 @@ def exportTests(d,tc):
             # we don't care about those anyway
             pass
 
+    savedata["host_dumper"]["parent_dir"] = tc.host_dumper.parent_dir
+    savedata["host_dumper"]["cmds"] = tc.host_dumper.cmds
+
     with open(os.path.join(exportpath, "testdata.json"), "w") as f:
             json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True)
 
index 42242065462da41c6ca54942761dde18d5a31e43..4773bdd4d8c646597debbadec0d4b8be245263cb 100644 (file)
@@ -13,7 +13,6 @@ import inspect
 import subprocess
 import bb
 from oeqa.utils.decorators import LogResults
-from oeqa.targetcontrol import QemuTarget
 from sys import exc_info, exc_clear
 
 def loadTests(tc, type="runtime"):
@@ -124,7 +123,7 @@ class oeRuntimeTest(oeTest):
         if not exc_info() == (None, None, None):
             exc_clear()
             #Only dump for QemuTarget
-            if (isinstance(self.target, QemuTarget)):
+            if (type(self.target).__name__ == "QemuTarget"):
                 self.tc.host_dumper.create_dir(self._testMethodName)
                 self.tc.host_dumper.dump_host()
                 self.target.target_dumper.dump_target(
index e1b6642ec2a441577ecce62e7ecec03e3e6ad2df..96442b1b273b4cd007d8fe57dd9f59908d116716 100755 (executable)
@@ -32,6 +32,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa"))
 
 from oeqa.oetest import runTests
 from oeqa.utils.sshcontrol import SSHControl
+from oeqa.utils.dump import get_host_dumper
 
 # this isn't pretty but we need a fake target object
 # for running the tests externally as we don't care
@@ -118,11 +119,16 @@ def main():
     for key in loaded["target"].keys():
         setattr(target, key, loaded["target"][key])
 
+    host_dumper = get_host_dumper(d)
+    host_dumper.parent_dir = loaded["host_dumper"]["parent_dir"]
+    host_dumper.cmds = loaded["host_dumper"]["cmds"]
+
     tc = TestContext()
     setattr(tc, "d", d)
     setattr(tc, "target", target)
+    setattr(tc, "host_dumper", host_dumper)
     for key in loaded.keys():
-        if key != "d" and key != "target":
+        if key != "d" and key != "target" and key != "host_dumper":
             setattr(tc, key, loaded[key])
 
     target.exportStart()