aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/testimage.bbclass
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2017-01-03 08:18:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:03:57 +0000
commit8d64ac4208e8dcb8a6fde6ea2959c9b3edfe2172 (patch)
tree95b7dd652982345b1f1664fb2a2ad1d56a0e6fd3 /meta/classes/testimage.bbclass
parentb39c61f2d442c79d03b73e8ffd104996fcb2177e (diff)
downloadopenembedded-core-contrib-8d64ac4208e8dcb8a6fde6ea2959c9b3edfe2172.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] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Diffstat (limited to 'meta/classes/testimage.bbclass')
-rw-r--r--meta/classes/testimage.bbclass53
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() {
testimage_sanity(d)
+ if (d.getVar('IMAGE_PKGTYPE') == 'rpm'
+ and 'smart' in d.getVar('TEST_SUITES')):
+ create_rpm_index(d)
+
testimage_main(d)
}
@@ -284,6 +288,55 @@ def get_runtime_paths(d):
paths.append(path)
return paths
+def create_index(arg):
+ import subprocess
+
+ index_cmd = arg
+ try:
+ bb.note("Executing '%s' ..." % index_cmd)
+ result = subprocess.check_output(index_cmd,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ result = result.decode('utf-8')
+ except subprocess.CalledProcessError as e:
+ return("Index creation command '%s' failed with return code "
+ '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8")))
+ if result:
+ bb.note(result)
+ return None
+
+def create_rpm_index(d):
+ # Index RPMs
+ rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo")
+ index_cmds = []
+ archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_')
+
+ for arch in archs.split():
+ rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch)
+ idx_path = os.path.join(d.getVar('WORKDIR'), 'rpm', arch)
+ db_path = os.path.join(d.getVar('WORKDIR'), 'rpmdb', arch)
+
+ if not os.path.isdir(rpm_dir):
+ continue
+ if os.path.exists(db_path):
+ bb.utils.remove(dbpath, True)
+
+ lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock')
+ lf = bb.utils.lockfile(lockfilename, False)
+ oe.path.copyhardlinktree(rpm_dir, idx_path)
+ # Full indexes overload a 256MB image so reduce the number of rpms
+ # in the feed. Filter to p* since we use the psplash packages and
+ # this leaves some allarch and machine arch packages too.
+ bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm")
+ bb.utils.unlockfile(lf)
+ cmd = '%s --dbpath %s --update -q %s' % (rpm_createrepo,
+ db_path, idx_path)
+
+ # Create repodata
+ result = create_index(cmd)
+ if result:
+ bb.fatal('%s' % ('\n'.join(result)))
+
def test_create_extract_dirs(d):
install_path = d.getVar("TEST_INSTALL_TMP_DIR")
package_path = d.getVar("TEST_PACKAGED_DIR")