summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py2
-rw-r--r--meta/lib/oeqa/selftest/cases/meta_ide.py4
-rw-r--r--meta/lib/oeqa/selftest/cases/overlayfs.py41
-rw-r--r--meta/lib/oeqa/selftest/cases/reproducible.py10
-rw-r--r--meta/lib/oeqa/selftest/cases/rust.py13
-rw-r--r--meta/lib/oeqa/selftest/cases/sstatetests.py2
6 files changed, 52 insertions, 20 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index fc08906117..ee75687f01 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2493,7 +2493,7 @@ class DevtoolIdeSdkTests(DevtoolBase):
2493 self.track_for_cleanup(tempdir) 2493 self.track_for_cleanup(tempdir)
2494 self.add_command_to_tearDown('bitbake -c clean %s' % recipe_name) 2494 self.add_command_to_tearDown('bitbake -c clean %s' % recipe_name)
2495 2495
2496 result = runCmd('devtool modify %s -x %s' % (recipe_name, tempdir)) 2496 result = runCmd('devtool modify %s -x %s --debug-build' % (recipe_name, tempdir))
2497 self.assertExists(os.path.join(tempdir, build_file), 2497 self.assertExists(os.path.join(tempdir, build_file),
2498 'Extracted source could not be found') 2498 'Extracted source could not be found')
2499 self.assertExists(os.path.join(self.workspacedir, 'conf', 2499 self.assertExists(os.path.join(self.workspacedir, 'conf',
diff --git a/meta/lib/oeqa/selftest/cases/meta_ide.py b/meta/lib/oeqa/selftest/cases/meta_ide.py
index ffe0d2604d..5a17ca52ea 100644
--- a/meta/lib/oeqa/selftest/cases/meta_ide.py
+++ b/meta/lib/oeqa/selftest/cases/meta_ide.py
@@ -20,8 +20,8 @@ class MetaIDE(OESelftestTestCase):
20 bitbake('meta-ide-support') 20 bitbake('meta-ide-support')
21 bitbake('build-sysroots -c build_native_sysroot') 21 bitbake('build-sysroots -c build_native_sysroot')
22 bitbake('build-sysroots -c build_target_sysroot') 22 bitbake('build-sysroots -c build_target_sysroot')
23 bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE']) 23 bb_vars = get_bb_vars(['MACHINE_ARCH', 'TARGET_VENDOR', 'TARGET_OS', 'DEPLOY_DIR_IMAGE', 'COREBASE'])
24 cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS'] 24 cls.environment_script = 'environment-setup-%s%s-%s' % (bb_vars['MACHINE_ARCH'], bb_vars['TARGET_VENDOR'], bb_vars['TARGET_OS'])
25 cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE'] 25 cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE']
26 cls.environment_script_path = '%s/%s' % (cls.deploydir, cls.environment_script) 26 cls.environment_script_path = '%s/%s' % (cls.deploydir, cls.environment_script)
27 cls.corebasedir = bb_vars['COREBASE'] 27 cls.corebasedir = bb_vars['COREBASE']
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index e31063567b..580fbdcb9c 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -5,7 +5,7 @@
5# 5#
6 6
7from oeqa.selftest.case import OESelftestTestCase 7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import bitbake, runqemu 8from oeqa.utils.commands import bitbake, runqemu, get_bb_vars
9from oeqa.core.decorator import OETestTag 9from oeqa.core.decorator import OETestTag
10from oeqa.core.decorator.data import skipIfNotMachine 10from oeqa.core.decorator.data import skipIfNotMachine
11 11
@@ -466,6 +466,45 @@ IMAGE_INSTALL:append = " overlayfs-user"
466 line = getline_qemu(output, "Read-only file system") 466 line = getline_qemu(output, "Read-only file system")
467 self.assertTrue(line, msg=output) 467 self.assertTrue(line, msg=output)
468 468
469 @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
470 def test_postinst_on_target_for_read_only_rootfs(self):
471 """
472 Summary: The purpose of this test case is to verify that post-installation
473 on target scripts are executed even if using read-only rootfs when
474 read-only-rootfs-delayed-postinsts is set
475 Expected: The test files are created on first boot
476 """
477
478 import oe.path
479
480 vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal")
481 sysconfdir = vars["sysconfdir"]
482 self.assertIsNotNone(sysconfdir)
483 # Need to use oe.path here as sysconfdir starts with /
484 targettestdir = os.path.join(sysconfdir, "postinst-test")
485
486 config = self.get_working_config()
487
488 args = {
489 'OVERLAYFS_INIT_OPTION': "",
490 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1,
491 'OVERLAYFS_ROOTFS_TYPE': "ext4",
492 'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1
493 }
494
495 # read-only-rootfs is already set in get_working_config()
496 config += 'EXTRA_IMAGE_FEATURES += "read-only-rootfs-delayed-postinsts"\n'
497 config += 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
498
499 self.write_config(config.format(**args))
500
501 res = bitbake('core-image-minimal')
502
503 with runqemu('core-image-minimal', image_fstype='wic') as qemu:
504 for filename in ("rootfs", "delayed-a", "delayed-b"):
505 status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
506 self.assertIn("found", output, "%s was not present on boot" % filename)
507
469 def get_working_config(self): 508 def get_working_config(self):
470 return """ 509 return """
471# Use systemd as init manager 510# Use systemd as init manager
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py
index 021e894012..34efa730e5 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -16,6 +16,8 @@ import os
16import datetime 16import datetime
17 17
18exclude_packages = [ 18exclude_packages = [
19 'rust-rustdoc',
20 'rust-dbg'
19 ] 21 ]
20 22
21def is_excluded(package): 23def is_excluded(package):
@@ -177,12 +179,8 @@ class ReproducibleTests(OESelftestTestCase):
177 self.sstate_targets = bb_vars['OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS'].split() 179 self.sstate_targets = bb_vars['OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS'].split()
178 180
179 self.extraresults = {} 181 self.extraresults = {}
180 self.extraresults.setdefault('reproducible.rawlogs', {})['log'] = ''
181 self.extraresults.setdefault('reproducible', {}).setdefault('files', {}) 182 self.extraresults.setdefault('reproducible', {}).setdefault('files', {})
182 183
183 def append_to_log(self, msg):
184 self.extraresults['reproducible.rawlogs']['log'] += msg
185
186 def compare_packages(self, reference_dir, test_dir, diffutils_sysroot): 184 def compare_packages(self, reference_dir, test_dir, diffutils_sysroot):
187 result = PackageCompareResults(self.oeqa_reproducible_excluded_packages) 185 result = PackageCompareResults(self.oeqa_reproducible_excluded_packages)
188 186
@@ -209,7 +207,7 @@ class ReproducibleTests(OESelftestTestCase):
209 207
210 def write_package_list(self, package_class, name, packages): 208 def write_package_list(self, package_class, name, packages):
211 self.extraresults['reproducible']['files'].setdefault(package_class, {})[name] = [ 209 self.extraresults['reproducible']['files'].setdefault(package_class, {})[name] = [
212 {'reference': p.reference, 'test': p.test} for p in packages] 210 p.reference.split("/./")[1] for p in packages]
213 211
214 def copy_file(self, source, dest): 212 def copy_file(self, source, dest):
215 bb.utils.mkdirhier(os.path.dirname(dest)) 213 bb.utils.mkdirhier(os.path.dirname(dest))
@@ -295,8 +293,6 @@ class ReproducibleTests(OESelftestTestCase):
295 293
296 self.logger.info('Reproducibility summary for %s: %s' % (c, result)) 294 self.logger.info('Reproducibility summary for %s: %s' % (c, result))
297 295
298 self.append_to_log('\n'.join("%s: %s" % (r.status, r.test) for r in result.total))
299
300 self.write_package_list(package_class, 'missing', result.missing) 296 self.write_package_list(package_class, 'missing', result.missing)
301 self.write_package_list(package_class, 'different', result.different) 297 self.write_package_list(package_class, 'different', result.different)
302 self.write_package_list(package_class, 'different_excluded', result.different_excluded) 298 self.write_package_list(package_class, 'different_excluded', result.different_excluded)
diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
index ad14189c6d..26f132edc4 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -3,6 +3,7 @@ import os
3import subprocess 3import subprocess
4import time 4import time
5from oeqa.core.decorator import OETestTag 5from oeqa.core.decorator import OETestTag
6from oeqa.core.decorator.data import skipIfArch
6from oeqa.core.case import OEPTestResultTestCase 7from oeqa.core.case import OEPTestResultTestCase
7from oeqa.selftest.case import OESelftestTestCase 8from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu, Command 9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu, Command
@@ -38,15 +39,12 @@ def parse_results(filename):
38@OETestTag("toolchain-user") 39@OETestTag("toolchain-user")
39@OETestTag("runqemu") 40@OETestTag("runqemu")
40class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): 41class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
42
43 @skipIfArch(['mips', 'mips64'])
41 def test_rust(self, *args, **kwargs): 44 def test_rust(self, *args, **kwargs):
42 # Disable Rust Oe-selftest 45 # Disable Rust Oe-selftest
43 #self.skipTest("The Rust Oe-selftest is disabled.") 46 #self.skipTest("The Rust Oe-selftest is disabled.")
44 47
45 # Skip mips32 target since it is unstable with rust tests
46 machine = get_bb_var('MACHINE')
47 if machine == "qemumips":
48 self.skipTest("The mips32 target is skipped for Rust Oe-selftest.")
49
50 # build remote-test-server before image build 48 # build remote-test-server before image build
51 recipe = "rust" 49 recipe = "rust"
52 start_time = time.time() 50 start_time = time.time()
@@ -210,9 +208,8 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
210 tmpdir = get_bb_var("TMPDIR", "rust") 208 tmpdir = get_bb_var("TMPDIR", "rust")
211 209
212 # Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools. 210 # Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools.
213 cmd = " export PATH=%s/recipe-sysroot-native/usr/bin:$PATH;" % rustlibpath 211 cmd = "export TARGET_VENDOR=\"-poky\";"
214 cmd = cmd + " export TARGET_VENDOR=\"-poky\";" 212 cmd = cmd + " export PATH=%s/recipe-sysroot-native/usr/bin/python3-native:%s/recipe-sysroot-native/usr/bin:%s/recipe-sysroot-native/usr/bin/%s:%s/hosttools:$PATH;" % (rustlibpath, rustlibpath, rustlibpath, tcpath, tmpdir)
215 cmd = cmd + " export PATH=%s/recipe-sysroot-native/usr/bin/%s:%s/hosttools:$PATH;" % (rustlibpath, tcpath, tmpdir)
216 cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath 213 cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath
217 # Trigger testing. 214 # Trigger testing.
218 cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip 215 cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index 86d6cd7464..4a2c425ac8 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -977,7 +977,7 @@ class SStateMirrors(SStateBase):
977 self.append_config(""" 977 self.append_config("""
978MACHINE = "{}" 978MACHINE = "{}"
979BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" 979BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687"
980SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" 980SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
981""".format(machine)) 981""".format(machine))
982 else: 982 else:
983 self.append_config(""" 983 self.append_config("""