summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorFrancisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>2016-08-24 15:55:23 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-03 23:45:54 +0100
commit0e38688bca3bc52bd95181eb05370d452c447dc7 (patch)
tree78354f3e965bab6f0b2f2c9a381284842a4ffd62 /meta/lib/oeqa/selftest
parent1da953d631ab1574c6a9242f2c8ff9cd6b74bcd0 (diff)
downloadpoky-0e38688bca3bc52bd95181eb05370d452c447dc7.tar.gz
oeqa/selftest Adds eSDK test cases to devtool verification.
The covered functions are, install libraries headers and image generation binary feeds. (From OE-Core rev: 994f8a41a16d0b82a1f7dfbcbbcc1df08225b14e) Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/eSDK.py103
1 files changed, 103 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py
new file mode 100644
index 0000000000..9d5c680948
--- /dev/null
+++ b/meta/lib/oeqa/selftest/eSDK.py
@@ -0,0 +1,103 @@
1import unittest
2import tempfile
3import shutil
4import os
5import glob
6import logging
7import subprocess
8import oeqa.utils.ftools as ftools
9from oeqa.utils.decorators import testcase
10from oeqa.selftest.base import oeSelfTest
11from oeqa.utils.commands import runCmd, bitbake, get_bb_var
12from oeqa.utils.httpserver import HTTPService
13
14class oeSDKExtSelfTest(oeSelfTest):
15 """
16 # Bugzilla Test Plan: 6033
17 # This code is planned to be part of the automation for eSDK containig
18 # Install libraries and headers, image generation binary feeds.
19 """
20
21 @staticmethod
22 def get_esdk_environment(env_eSDK, tmpdir_eSDKQA):
23 # XXX: at this time use the first env need to investigate
24 # what environment load oe-selftest, i586, x86_64
25 pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*')
26 return glob.glob(pattern)[0]
27
28 @staticmethod
29 def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options):
30 if postconfig:
31 esdk_conf_file = os.path.join(tmpdir_eSDKQA, 'conf', 'local.conf')
32 with open(esdk_conf_file, 'a+') as f:
33 f.write(postconfig)
34 if not options:
35 options = {}
36 if not 'shell' in options:
37 options['shell'] = True
38
39 runCmd("cd %s; . %s; %s" % (tmpdir_eSDKQA, env_eSDK, cmd), **options)
40
41 @staticmethod
42 def generate_eSDK(image):
43 pn_task = '%s -c populate_sdk_ext' % image
44 bitbake(pn_task)
45
46 @staticmethod
47 def get_eSDK_toolchain(image):
48 pn_task = '%s -c populate_sdk_ext' % image
49
50 sdk_deploy = get_bb_var('SDK_DEPLOY', pn_task)
51 toolchain_name = get_bb_var('TOOLCHAINEXT_OUTPUTNAME', pn_task)
52 return os.path.join(sdk_deploy, toolchain_name + '.sh')
53
54
55 @classmethod
56 def setUpClass(cls):
57 # Start to serve sstate dir
58 sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache')
59 cls.http_service = HTTPService(sstate_dir)
60 cls.http_service.start()
61
62 http_url = "127.0.0.1:%d" % cls.http_service.port
63
64 image = 'core-image-minimal'
65
66 cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')
67 oeSDKExtSelfTest.generate_eSDK(image)
68
69 # Install eSDK
70 ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(image)
71 runCmd("%s -y -d \"%s\"" % (ext_sdk_path, cls.tmpdir_eSDKQA))
72
73 cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)
74
75 # Configure eSDK to use sstate mirror from poky
76 sstate_config="""
77SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
78SSTATE_MIRRORS = "file://.* http://%s/PATH"
79 """ % http_url
80 with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
81 f.write(sstate_config)
82
83
84 @classmethod
85 def tearDownClass(cls):
86 shutil.rmtree(cls.tmpdir_eSDKQA)
87 cls.http_service.stop()
88
89 @testcase (1471)
90 def test_install_libraries_headers(self):
91 pn_sstate = 'bc'
92 bitbake(pn_sstate)
93 cmd = "devtool sdk-install %s " % pn_sstate
94 oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
95
96 @testcase(1472)
97 def test_image_generation_binary_feeds(self):
98 image = 'core-image-minimal'
99 cmd = "devtool build-image %s" % image
100 oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
101
102if __name__ == '__main__':
103 unittest.main()