diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2017-01-03 08:18:00 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:20 +0000 |
commit | 41e4db0eeaaa19f9f4d425960011b02c29f01c1c (patch) | |
tree | 8b11c1910f5fc94796ad02f7c8e2f2c856061957 /meta/classes | |
parent | b569aa0e0056a97b29577f5bda611ef3dd539db3 (diff) | |
download | poky-41e4db0eeaaa19f9f4d425960011b02c29f01c1c.tar.gz |
runtime/cases/smart.py: Migrate smart tests
This migrates the smart test from the old framework to
the new one. This has its own commit because smart
test was using bb and oe libraries that are available
when exporting the test cases to run in a different host.
Because of the removal of bb and oe libraries index and
packages feeds creation will be managed in testimage bbclass.
[YOCTO #10234]
(From OE-Core rev: 8d64ac4208e8dcb8a6fde6ea2959c9b3edfe2172)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/testimage.bbclass | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 016c1c136a..abcecca472 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
@@ -116,6 +116,10 @@ python do_testimage() { | |||
116 | 116 | ||
117 | testimage_sanity(d) | 117 | testimage_sanity(d) |
118 | 118 | ||
119 | if (d.getVar('IMAGE_PKGTYPE') == 'rpm' | ||
120 | and 'smart' in d.getVar('TEST_SUITES')): | ||
121 | create_rpm_index(d) | ||
122 | |||
119 | testimage_main(d) | 123 | testimage_main(d) |
120 | } | 124 | } |
121 | 125 | ||
@@ -284,6 +288,55 @@ def get_runtime_paths(d): | |||
284 | paths.append(path) | 288 | paths.append(path) |
285 | return paths | 289 | return paths |
286 | 290 | ||
291 | def create_index(arg): | ||
292 | import subprocess | ||
293 | |||
294 | index_cmd = arg | ||
295 | try: | ||
296 | bb.note("Executing '%s' ..." % index_cmd) | ||
297 | result = subprocess.check_output(index_cmd, | ||
298 | stderr=subprocess.STDOUT, | ||
299 | shell=True) | ||
300 | result = result.decode('utf-8') | ||
301 | except subprocess.CalledProcessError as e: | ||
302 | return("Index creation command '%s' failed with return code " | ||
303 | '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8"))) | ||
304 | if result: | ||
305 | bb.note(result) | ||
306 | return None | ||
307 | |||
308 | def create_rpm_index(d): | ||
309 | # Index RPMs | ||
310 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") | ||
311 | index_cmds = [] | ||
312 | archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_') | ||
313 | |||
314 | for arch in archs.split(): | ||
315 | rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch) | ||
316 | idx_path = os.path.join(d.getVar('WORKDIR'), 'rpm', arch) | ||
317 | db_path = os.path.join(d.getVar('WORKDIR'), 'rpmdb', arch) | ||
318 | |||
319 | if not os.path.isdir(rpm_dir): | ||
320 | continue | ||
321 | if os.path.exists(db_path): | ||
322 | bb.utils.remove(dbpath, True) | ||
323 | |||
324 | lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock') | ||
325 | lf = bb.utils.lockfile(lockfilename, False) | ||
326 | oe.path.copyhardlinktree(rpm_dir, idx_path) | ||
327 | # Full indexes overload a 256MB image so reduce the number of rpms | ||
328 | # in the feed. Filter to p* since we use the psplash packages and | ||
329 | # this leaves some allarch and machine arch packages too. | ||
330 | bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm") | ||
331 | bb.utils.unlockfile(lf) | ||
332 | cmd = '%s --dbpath %s --update -q %s' % (rpm_createrepo, | ||
333 | db_path, idx_path) | ||
334 | |||
335 | # Create repodata | ||
336 | result = create_index(cmd) | ||
337 | if result: | ||
338 | bb.fatal('%s' % ('\n'.join(result))) | ||
339 | |||
287 | def test_create_extract_dirs(d): | 340 | def test_create_extract_dirs(d): |
288 | install_path = d.getVar("TEST_INSTALL_TMP_DIR") | 341 | install_path = d.getVar("TEST_INSTALL_TMP_DIR") |
289 | package_path = d.getVar("TEST_PACKAGED_DIR") | 342 | package_path = d.getVar("TEST_PACKAGED_DIR") |