diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-05-12 14:40:21 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-06 19:02:43 +0100 |
commit | 157c3be2ca93f076033f725ec1ee912df91f7488 (patch) | |
tree | 8ef896ff7adf78d63b34059cd5b017a4f0a3419a /meta/lib/oeqa/selftest/cases/eSDK.py | |
parent | 10c512b60d1167122b5fe778b93838dca3def717 (diff) | |
download | poky-157c3be2ca93f076033f725ec1ee912df91f7488.tar.gz |
oeqa/selftest/cases: Migrate test cases into the new oe-qa framework
New framework has different classes/decorators so adapt current test cases to
support these. Changes include changes on base classes and decorators.
Also include paths in selftest/__init__.py isn't needed because the
loader is the standard unittest one.
(From OE-Core rev: ddbbefdd124604d10bd47dd0266b55a764fcc0ab)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
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/lib/oeqa/selftest/cases/eSDK.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/eSDK.py | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/eSDK.py b/meta/lib/oeqa/selftest/cases/eSDK.py new file mode 100644 index 0000000000..f36c3ccd3b --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/eSDK.py | |||
@@ -0,0 +1,111 @@ | |||
1 | import tempfile | ||
2 | import shutil | ||
3 | import os | ||
4 | import glob | ||
5 | from oeqa.core.decorator.oeid import OETestID | ||
6 | from oeqa.selftest.case import OESelftestTestCase | ||
7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | ||
8 | |||
9 | class oeSDKExtSelfTest(OESelftestTestCase): | ||
10 | """ | ||
11 | # Bugzilla Test Plan: 6033 | ||
12 | # This code is planned to be part of the automation for eSDK containig | ||
13 | # Install libraries and headers, image generation binary feeds, sdk-update. | ||
14 | """ | ||
15 | |||
16 | @staticmethod | ||
17 | def get_esdk_environment(env_eSDK, tmpdir_eSDKQA): | ||
18 | # XXX: at this time use the first env need to investigate | ||
19 | # what environment load oe-selftest, i586, x86_64 | ||
20 | pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*') | ||
21 | return glob.glob(pattern)[0] | ||
22 | |||
23 | @staticmethod | ||
24 | def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options): | ||
25 | if postconfig: | ||
26 | esdk_conf_file = os.path.join(tmpdir_eSDKQA, 'conf', 'local.conf') | ||
27 | with open(esdk_conf_file, 'a+') as f: | ||
28 | f.write(postconfig) | ||
29 | if not options: | ||
30 | options = {} | ||
31 | if not 'shell' in options: | ||
32 | options['shell'] = True | ||
33 | |||
34 | runCmd("cd %s; . %s; %s" % (tmpdir_eSDKQA, env_eSDK, cmd), **options) | ||
35 | |||
36 | @staticmethod | ||
37 | def generate_eSDK(image): | ||
38 | pn_task = '%s -c populate_sdk_ext' % image | ||
39 | bitbake(pn_task) | ||
40 | |||
41 | @staticmethod | ||
42 | def get_eSDK_toolchain(image): | ||
43 | pn_task = '%s -c populate_sdk_ext' % image | ||
44 | |||
45 | bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task) | ||
46 | sdk_deploy = bb_vars['SDK_DEPLOY'] | ||
47 | toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME'] | ||
48 | return os.path.join(sdk_deploy, toolchain_name + '.sh') | ||
49 | |||
50 | @staticmethod | ||
51 | def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path): | ||
52 | sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') | ||
53 | |||
54 | oeSDKExtSelfTest.generate_eSDK(cls.image) | ||
55 | |||
56 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) | ||
57 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) | ||
58 | |||
59 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) | ||
60 | |||
61 | sstate_config=""" | ||
62 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" | ||
63 | SSTATE_MIRRORS = "file://.* file://%s/PATH" | ||
64 | CORE_IMAGE_EXTRA_INSTALL = "perl" | ||
65 | """ % sstate_dir | ||
66 | |||
67 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | ||
68 | f.write(sstate_config) | ||
69 | |||
70 | @classmethod | ||
71 | def setUpClass(cls): | ||
72 | super(oeSDKExtSelfTest, cls).setUpClass() | ||
73 | cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') | ||
74 | |||
75 | sstate_dir = get_bb_var('SSTATE_DIR') | ||
76 | |||
77 | cls.image = 'core-image-minimal' | ||
78 | oeSDKExtSelfTest.generate_eSDK(cls.image) | ||
79 | |||
80 | # Install eSDK | ||
81 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) | ||
82 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) | ||
83 | |||
84 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) | ||
85 | |||
86 | # Configure eSDK to use sstate mirror from poky | ||
87 | sstate_config=""" | ||
88 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" | ||
89 | SSTATE_MIRRORS = "file://.* file://%s/PATH" | ||
90 | """ % sstate_dir | ||
91 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | ||
92 | f.write(sstate_config) | ||
93 | |||
94 | @classmethod | ||
95 | def tearDownClass(cls): | ||
96 | shutil.rmtree(cls.tmpdir_eSDKQA) | ||
97 | super(oeSDKExtSelfTest, cls).tearDownClass() | ||
98 | |||
99 | @OETestID(1602) | ||
100 | def test_install_libraries_headers(self): | ||
101 | pn_sstate = 'bc' | ||
102 | bitbake(pn_sstate) | ||
103 | cmd = "devtool sdk-install %s " % pn_sstate | ||
104 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | ||
105 | |||
106 | @OETestID(1603) | ||
107 | def test_image_generation_binary_feeds(self): | ||
108 | image = 'core-image-minimal' | ||
109 | cmd = "devtool build-image %s" % image | ||
110 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | ||
111 | |||