diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2016-11-30 11:33:26 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:19 +0000 |
commit | 14eee4fdf844e70966124bd3b1677e79a76d16a2 (patch) | |
tree | e55456a86be40635948c39307dc97584ce9a77ff /meta | |
parent | 55f05fab2b2b72b3e254ff02c1e294d53691a1fc (diff) | |
download | poky-14eee4fdf844e70966124bd3b1677e79a76d16a2.tar.gz |
oeqa/sdkext: Adds case and context modules.
The extensible sdk context and case modules extends the sdk ones,
this means that the tests from sdk are run also the sdkext tests.
Enables support in context for use oe-test esdk command for run
the test suites, the same options of sdk are required for run esdk tests.
Removes old related to case and context inside oetest.py.
[YOCTO #10599]
(From OE-Core rev: 1f0bb99249744b87dd39227a4cf37f2341f5499c)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/oetest.py | 40 | ||||
-rw-r--r-- | meta/lib/oeqa/sdkext/case.py | 21 | ||||
-rw-r--r-- | meta/lib/oeqa/sdkext/context.py | 21 |
3 files changed, 42 insertions, 40 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py index d7c358844f..503f6fc10f 100644 --- a/meta/lib/oeqa/oetest.py +++ b/meta/lib/oeqa/oetest.py | |||
@@ -27,7 +27,6 @@ try: | |||
27 | except ImportError: | 27 | except ImportError: |
28 | pass | 28 | pass |
29 | from oeqa.utils.decorators import LogResults, gettag, getResults | 29 | from oeqa.utils.decorators import LogResults, gettag, getResults |
30 | from oeqa.utils import avoid_paths_in_environ | ||
31 | 30 | ||
32 | logger = logging.getLogger("BitBake") | 31 | logger = logging.getLogger("BitBake") |
33 | 32 | ||
@@ -145,18 +144,6 @@ class OETestCalledProcessError(subprocess.CalledProcessError): | |||
145 | 144 | ||
146 | subprocess.CalledProcessError = OETestCalledProcessError | 145 | subprocess.CalledProcessError = OETestCalledProcessError |
147 | 146 | ||
148 | class oeSDKExtTest(oeSDKTest): | ||
149 | def _run(self, cmd): | ||
150 | # extensible sdk shows a warning if found bitbake in the path | ||
151 | # because can cause contamination, i.e. use devtool from | ||
152 | # poky/scripts instead of eSDK one. | ||
153 | env = os.environ.copy() | ||
154 | paths_to_avoid = ['bitbake/bin', 'poky/scripts'] | ||
155 | env['PATH'] = avoid_paths_in_environ(paths_to_avoid) | ||
156 | |||
157 | return subprocess.check_output(". %s > /dev/null;"\ | ||
158 | " %s;" % (self.tc.sdkenv, cmd), stderr=subprocess.STDOUT, shell=True, env=env).decode("utf-8") | ||
159 | |||
160 | def getmodule(pos=2): | 147 | def getmodule(pos=2): |
161 | # stack returns a list of tuples containg frame information | 148 | # stack returns a list of tuples containg frame information |
162 | # First element of the list the is current frame, caller is 1 | 149 | # First element of the list the is current frame, caller is 1 |
@@ -642,30 +629,3 @@ class ExportTestContext(RuntimeTestContext): | |||
642 | extracted_dir = self.d.getVar("TEST_EXPORT_EXTRACTED_DIR") | 629 | extracted_dir = self.d.getVar("TEST_EXPORT_EXTRACTED_DIR") |
643 | pkg_dir = os.path.join(export_dir, extracted_dir) | 630 | pkg_dir = os.path.join(export_dir, extracted_dir) |
644 | super(ExportTestContext, self).install_uninstall_packages(test_id, pkg_dir, install) | 631 | super(ExportTestContext, self).install_uninstall_packages(test_id, pkg_dir, install) |
645 | |||
646 | class SDKExtTestContext(SDKTestContext): | ||
647 | def __init__(self, d, sdktestdir, sdkenv, tcname, *args): | ||
648 | self.target_manifest = d.getVar("SDK_EXT_TARGET_MANIFEST") | ||
649 | self.host_manifest = d.getVar("SDK_EXT_HOST_MANIFEST") | ||
650 | if args: | ||
651 | self.cm = args[0] # Compatibility mode for run SDK tests | ||
652 | else: | ||
653 | self.cm = False | ||
654 | |||
655 | super(SDKExtTestContext, self).__init__(d, sdktestdir, sdkenv, tcname) | ||
656 | |||
657 | self.sdkextfilesdir = os.path.join(os.path.dirname(os.path.abspath( | ||
658 | oeqa.sdkext.__file__)), "files") | ||
659 | |||
660 | def _get_test_namespace(self): | ||
661 | if self.cm: | ||
662 | return "sdk" | ||
663 | else: | ||
664 | return "sdkext" | ||
665 | |||
666 | def _get_test_suites(self): | ||
667 | return (self.d.getVar("TEST_SUITES_SDK_EXT") or "auto").split() | ||
668 | |||
669 | def _get_test_suites_required(self): | ||
670 | return [t for t in (self.d.getVar("TEST_SUITES_SDK_EXT") or \ | ||
671 | "auto").split() if t != "auto"] | ||
diff --git a/meta/lib/oeqa/sdkext/case.py b/meta/lib/oeqa/sdkext/case.py new file mode 100644 index 0000000000..6f708aa4ca --- /dev/null +++ b/meta/lib/oeqa/sdkext/case.py | |||
@@ -0,0 +1,21 @@ | |||
1 | # Copyright (C) 2016 Intel Corporation | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | import subprocess | ||
6 | |||
7 | from oeqa.utils import avoid_paths_in_environ | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | |||
10 | class OESDKExtTestCase(OESDKTestCase): | ||
11 | def _run(self, cmd): | ||
12 | # extensible sdk shows a warning if found bitbake in the path | ||
13 | # because can cause contamination, i.e. use devtool from | ||
14 | # poky/scripts instead of eSDK one. | ||
15 | env = os.environ.copy() | ||
16 | paths_to_avoid = ['bitbake/bin', 'poky/scripts'] | ||
17 | env['PATH'] = avoid_paths_in_environ(paths_to_avoid) | ||
18 | |||
19 | return subprocess.check_output(". %s > /dev/null;"\ | ||
20 | " %s;" % (self.tc.sdk_env, cmd), stderr=subprocess.STDOUT, | ||
21 | shell=True, env=env).decode("utf-8") | ||
diff --git a/meta/lib/oeqa/sdkext/context.py b/meta/lib/oeqa/sdkext/context.py new file mode 100644 index 0000000000..8dbcd807b4 --- /dev/null +++ b/meta/lib/oeqa/sdkext/context.py | |||
@@ -0,0 +1,21 @@ | |||
1 | # Copyright (C) 2016 Intel Corporation | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor | ||
6 | |||
7 | class OESDKExtTestContext(OESDKTestContext): | ||
8 | esdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files") | ||
9 | |||
10 | class OESDKExtTestContextExecutor(OESDKTestContextExecutor): | ||
11 | _context_class = OESDKExtTestContext | ||
12 | |||
13 | name = 'esdk' | ||
14 | help = 'esdk test component' | ||
15 | description = 'executes esdk tests' | ||
16 | |||
17 | default_cases = [OESDKTestContextExecutor.default_cases[0], | ||
18 | os.path.join(os.path.abspath(os.path.dirname(__file__)), 'cases')] | ||
19 | default_test_data = None | ||
20 | |||
21 | _executor_class = OESDKExtTestContextExecutor | ||