]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runexported.py: Fix exported test
authorMariano Lopez <mariano.lopez@linux.intel.com>
Mon, 11 Apr 2016 06:55:35 +0000 (06:55 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 12 Apr 2016 21:45:33 +0000 (22:45 +0100)
With the changes introduced to test the eSDK
the runexported test failed during the execution.

This change fix runexported test in the least invasive
way, because of the release cycle.

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

index fc1e8b514dfacf17944a7de9c5fee0227ad2e123..8eb84ed65d85d6707bc3df513146cfabc3111841 100644 (file)
@@ -19,7 +19,11 @@ except ImportError:
 import logging
 
 import oeqa.runtime
-import oeqa.sdkext
+# Exported test doesn't require sdkext
+try:
+    import oeqa.sdkext
+except ImportError:
+    pass
 from oeqa.utils.decorators import LogResults, gettag, getResults
 from oeqa.utils import avoid_paths_in_environ
 
index e9a29126c826cfd2deda5349d68b4d43a5f8a205..cc89e13c067b341022766486f2553328f7a49428 100755 (executable)
@@ -30,7 +30,7 @@ except ImportError:
 
 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa")))
 
-from oeqa.oetest import runTests
+from oeqa.oetest import TestContext
 from oeqa.utils.sshcontrol import SSHControl
 from oeqa.utils.dump import get_host_dumper
 
@@ -49,7 +49,7 @@ class FakeTarget(object):
     def exportStart(self):
         self.sshlog = os.path.join(self.testdir, "ssh_target_log.%s" % self.datetime)
         sshloglink = os.path.join(self.testdir, "ssh_target_log")
-        if os.path.exists(sshloglink):
+        if os.path.lexists(sshloglink):
             os.remove(sshloglink)
         os.symlink(self.sshlog, sshloglink)
         print("SSH log file: %s" %  self.sshlog)
@@ -69,10 +69,9 @@ class MyDataDict(dict):
     def getVar(self, key, unused = None):
         return self.get(key, "")
 
-class TestContext(object):
-    def __init__(self):
-        self.d = None
-        self.target = None
+class ExportTestContext(TestContext):
+    def __init__(self, d):
+        self.d = d
 
 def main():
 
@@ -121,7 +120,9 @@ def main():
     host_dumper.parent_dir = loaded["host_dumper"]["parent_dir"]
     host_dumper.cmds = loaded["host_dumper"]["cmds"]
 
-    tc = TestContext()
+    target.exportStart()
+    tc = ExportTestContext(d)
+
     setattr(tc, "d", d)
     setattr(tc, "target", target)
     setattr(tc, "host_dumper", host_dumper)
@@ -129,8 +130,8 @@ def main():
         if key != "d" and key != "target" and key != "host_dumper":
             setattr(tc, key, loaded[key])
 
-    target.exportStart()
-    runTests(tc)
+    tc.loadTests()
+    tc.runTests()
 
     return 0
 
index 32e001c6b5d5adcb969509be9ce4cdff8d3fda22..48f64412901f2cc9d46b42dcfba119eae52f02df 100644 (file)
@@ -18,7 +18,11 @@ from oeqa.utils import CommandError
 from oeqa.utils import ftools
 import re
 import contextlib
-import bb
+# Export test doesn't require bb
+try:
+    import bb
+except ImportError:
+    pass
 
 class Command(object):
     def __init__(self, command, bg=False, timeout=None, data=None, **options):