diff options
| -rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 23 | ||||
| -rw-r--r-- | meta/lib/oeqa/utils/__init__.py | 3 |
2 files changed, 22 insertions, 4 deletions
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index dee38ec1d6..757f9d3d50 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py | |||
| @@ -8,18 +8,33 @@ import os | |||
| 8 | import shutil | 8 | import shutil |
| 9 | import subprocess | 9 | import subprocess |
| 10 | import bb | 10 | import bb |
| 11 | 11 | import traceback | |
| 12 | from oeqa.utils.sshcontrol import SSHControl | 12 | from oeqa.utils.sshcontrol import SSHControl |
| 13 | from oeqa.utils.qemurunner import QemuRunner | 13 | from oeqa.utils.qemurunner import QemuRunner |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | def get_target_controller(d): | 16 | def get_target_controller(d): |
| 17 | if d.getVar("TEST_TARGET", True) == "qemu": | 17 | testtarget = d.getVar("TEST_TARGET", True) |
| 18 | # old, simple names | ||
| 19 | if testtarget == "qemu": | ||
| 18 | return QemuTarget(d) | 20 | return QemuTarget(d) |
| 19 | elif d.getVar("TEST_TARGET", True) == "simpleremote": | 21 | elif testtarget == "simpleremote": |
| 20 | return SimpleRemoteTarget(d) | 22 | return SimpleRemoteTarget(d) |
| 21 | else: | 23 | else: |
| 22 | bb.fatal("Please set a valid TEST_TARGET") | 24 | # use the class name |
| 25 | try: | ||
| 26 | # is it a core class defined here? | ||
| 27 | controller = getattr(__name__, testtarget) | ||
| 28 | except AttributeError: | ||
| 29 | # nope, perhaps a layer defined one | ||
| 30 | try: | ||
| 31 | module = __import__("oeqa.utils.controllers", globals(), locals(), [testtarget]) | ||
| 32 | controller = getattr(module, testtarget) | ||
| 33 | except ImportError as e: | ||
| 34 | bb.fatal("Failed to import oeqa.utils.controllers:\n%s" % traceback.format_exc()) | ||
| 35 | except AttributeError: | ||
| 36 | bb.fatal("\"%s\" is not a valid value for TEST_TARGET" % testtarget) | ||
| 37 | return controller(d) | ||
| 23 | 38 | ||
| 24 | 39 | ||
| 25 | class BaseTarget(object): | 40 | class BaseTarget(object): |
diff --git a/meta/lib/oeqa/utils/__init__.py b/meta/lib/oeqa/utils/__init__.py index e69de29bb2..8eda92763c 100644 --- a/meta/lib/oeqa/utils/__init__.py +++ b/meta/lib/oeqa/utils/__init__.py | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Enable other layers to have modules in the same named directory | ||
| 2 | from pkgutil import extend_path | ||
| 3 | __path__ = extend_path(__path__, __name__) | ||
