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