diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/eSDK.py')
| -rw-r--r-- | meta/lib/oeqa/selftest/eSDK.py | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py index a66ff92140..1596c6e9d6 100644 --- a/meta/lib/oeqa/selftest/eSDK.py +++ b/meta/lib/oeqa/selftest/eSDK.py | |||
| @@ -9,7 +9,6 @@ import oeqa.utils.ftools as ftools | |||
| 9 | from oeqa.utils.decorators import testcase | 9 | from oeqa.utils.decorators import testcase |
| 10 | from oeqa.selftest.base import oeSelfTest | 10 | from oeqa.selftest.base import oeSelfTest |
| 11 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 11 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
| 12 | from oeqa.utils.httpserver import HTTPService | ||
| 13 | 12 | ||
| 14 | class oeSDKExtSelfTest(oeSelfTest): | 13 | class oeSDKExtSelfTest(oeSelfTest): |
| 15 | """ | 14 | """ |
| @@ -55,9 +54,6 @@ class oeSDKExtSelfTest(oeSelfTest): | |||
| 55 | @staticmethod | 54 | @staticmethod |
| 56 | def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path): | 55 | def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path): |
| 57 | sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') | 56 | sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') |
| 58 | cls.http_service = HTTPService(sstate_dir) | ||
| 59 | cls.http_service.start() | ||
| 60 | cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port | ||
| 61 | 57 | ||
| 62 | oeSDKExtSelfTest.generate_eSDK(cls.image) | 58 | oeSDKExtSelfTest.generate_eSDK(cls.image) |
| 63 | 59 | ||
| @@ -68,51 +64,39 @@ class oeSDKExtSelfTest(oeSelfTest): | |||
| 68 | 64 | ||
| 69 | sstate_config=""" | 65 | sstate_config=""" |
| 70 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" | 66 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" |
| 71 | SSTATE_MIRRORS = "file://.* http://%s/PATH" | 67 | SSTATE_MIRRORS = "file://.* file://%s/PATH" |
| 72 | CORE_IMAGE_EXTRA_INSTALL = "perl" | 68 | CORE_IMAGE_EXTRA_INSTALL = "perl" |
| 73 | """ % cls.http_url | 69 | """ % sstate_dir |
| 74 | 70 | ||
| 75 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | 71 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: |
| 76 | f.write(sstate_config) | 72 | f.write(sstate_config) |
| 77 | 73 | ||
| 78 | @classmethod | 74 | @classmethod |
| 79 | def setUpClass(cls): | 75 | def setUpClass(cls): |
| 80 | # If there is an exception in setUpClass it will not run tearDownClass | 76 | cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') |
| 81 | # method and it leaves HTTP server running forever, so we need to be | ||
| 82 | # sure tearDownClass is run. | ||
| 83 | try: | ||
| 84 | cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') | ||
| 85 | 77 | ||
| 86 | # Start to serve sstate dir | 78 | sstate_dir = get_bb_var('SSTATE_DIR') |
| 87 | sstate_dir = get_bb_var('SSTATE_DIR') | ||
| 88 | cls.http_service = HTTPService(sstate_dir) | ||
| 89 | cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port | ||
| 90 | cls.http_service.start() | ||
| 91 | 79 | ||
| 92 | cls.image = 'core-image-minimal' | 80 | cls.image = 'core-image-minimal' |
| 93 | oeSDKExtSelfTest.generate_eSDK(cls.image) | 81 | oeSDKExtSelfTest.generate_eSDK(cls.image) |
| 94 | 82 | ||
| 95 | # Install eSDK | 83 | # Install eSDK |
| 96 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) | 84 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) |
| 97 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) | 85 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) |
| 98 | 86 | ||
| 99 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) | 87 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) |
| 100 | 88 | ||
| 101 | # Configure eSDK to use sstate mirror from poky | 89 | # Configure eSDK to use sstate mirror from poky |
| 102 | sstate_config=""" | 90 | sstate_config=""" |
| 103 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" | 91 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" |
| 104 | SSTATE_MIRRORS = "file://.* http://%s/PATH" | 92 | SSTATE_MIRRORS = "file://.* file://%s/PATH" |
| 105 | """ % cls.http_url | 93 | """ % sstate_dir |
| 106 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | 94 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: |
| 107 | f.write(sstate_config) | 95 | f.write(sstate_config) |
| 108 | except: | ||
| 109 | cls.tearDownClass() | ||
| 110 | raise | ||
| 111 | 96 | ||
| 112 | @classmethod | 97 | @classmethod |
| 113 | def tearDownClass(cls): | 98 | def tearDownClass(cls): |
| 114 | shutil.rmtree(cls.tmpdir_eSDKQA) | 99 | shutil.rmtree(cls.tmpdir_eSDKQA) |
| 115 | cls.http_service.stop() | ||
| 116 | 100 | ||
| 117 | @testcase (1602) | 101 | @testcase (1602) |
| 118 | def test_install_libraries_headers(self): | 102 | def test_install_libraries_headers(self): |
| @@ -127,12 +111,5 @@ SSTATE_MIRRORS = "file://.* http://%s/PATH" | |||
| 127 | cmd = "devtool build-image %s" % image | 111 | cmd = "devtool build-image %s" % image |
| 128 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | 112 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) |
| 129 | 113 | ||
| 130 | @testcase(1567) | ||
| 131 | def test_sdk_update_http(self): | ||
| 132 | cmd = "devtool sdk-update %s" % self.http_url | ||
| 133 | oeSDKExtSelfTest.update_configuration(self, self.image, self.tmpdir_eSDKQA, self.env_eSDK, self.ext_sdk_path) | ||
| 134 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | ||
| 135 | self.http_service.stop() | ||
| 136 | |||
| 137 | if __name__ == '__main__': | 114 | if __name__ == '__main__': |
| 138 | unittest.main() | 115 | unittest.main() |
