diff options
Diffstat (limited to 'poky/meta/lib/oeqa')
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/parselogs.py | 1 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/buildtools-cases/build.py | 9 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py | 29 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/buildtools-cases/https.py | 20 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/buildoptions.py | 24 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/distrodata.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/glibc.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/reproducible.py | 6 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/runtime_test.py | 6 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/wic.py | 58 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/utils/qemurunner.py | 7 |
11 files changed, 157 insertions, 7 deletions
diff --git a/poky/meta/lib/oeqa/runtime/cases/parselogs.py b/poky/meta/lib/oeqa/runtime/cases/parselogs.py index af8a8d67b..5db021659 100644 --- a/poky/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/poky/meta/lib/oeqa/runtime/cases/parselogs.py @@ -98,6 +98,7 @@ ignore_errors = { 'qemux86' : [ 'Failed to access perfctr msr (MSR', 'pci 0000:00:00.0: [Firmware Bug]: reg 0x..: invalid BAR (can\'t size)', + 'failed to IDENTIFY (I/O error, err_mask=0x4)', ] + qemux86_common, 'qemux86-64' : qemux86_common, 'qemumips' : [ diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py index 5a17ab98c..9c9a84bf8 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py @@ -3,6 +3,7 @@ # import os, tempfile +import time from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() @@ -20,4 +21,10 @@ class BuildTests(OESDKTestCase): conf.write('\n') conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR']) - self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir)) + try: + self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir)) + finally: + delay = 10 + while delay and os.path.exists(testdir + "/bitbake.lock"): + time.sleep(1) + delay = delay - 1 diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py new file mode 100644 index 000000000..36ba15b13 --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py @@ -0,0 +1,29 @@ +# +# SPDX-License-Identifier: MIT +# + +import os.path +from oeqa.sdk.case import OESDKTestCase + +class GccTests(OESDKTestCase): + def test_verify_specs(self): + """ + Verify that the compiler has been relocated successfully and isn't + looking in the hard-coded prefix. + """ + # Canonicalise the SDK root + sdk_base = os.path.realpath(self.tc.sdk_dir) + # Canonicalise the location of GCC + gcc_path = os.path.realpath(self._run("command -v gcc").strip()) + # Skip the test if the GCC didn't come from the buildtools, as it only + # comes with buildtools-extended-tarball. + if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base: + self.skipTest("Buildtools does not provide GCC") + + # This is the prefix that GCC is build with, and should be replaced at + # installation time. + sdkpath = self.td.get("SDKPATH") + self.assertTrue(sdkpath) + + for line in self._run('gcc -dumpspecs').splitlines(): + self.assertNotIn(sdkpath, line) diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py new file mode 100644 index 000000000..134879aab --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py @@ -0,0 +1,20 @@ +# +# SPDX-License-Identifier: MIT +# + +from oeqa.sdk.case import OESDKTestCase +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + +class HTTPTests(OESDKTestCase): + """ + Verify that HTTPS certificates are working correctly, as this depends on + environment variables being set correctly. + """ + + def test_wget(self): + self._run('env -i wget --debug --output-document /dev/null https://www.example.com') + + def test_python(self): + # urlopen() returns a file-like object on success and throws an exception otherwise + self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://www.example.com/")\'') diff --git a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py index be49322f9..f99881758 100644 --- a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -148,6 +148,30 @@ class BuildhistoryTests(BuildhistoryBase): self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) + def test_fileinfo(self): + self.config_buildhistory() + bitbake('hicolor-icon-theme') + history_dir = get_bb_var('BUILDHISTORY_DIR_PACKAGE', 'hicolor-icon-theme') + self.assertTrue(os.path.isdir(history_dir), 'buildhistory dir was not created.') + + def load_bh(f): + d = {} + for line in open(f): + split = [s.strip() for s in line.split('=', 1)] + if len(split) > 1: + d[split[0]] = split[1] + return d + + data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme', 'latest')) + self.assertIn('FILELIST', data) + self.assertEqual(data['FILELIST'], '/usr/share/icons/hicolor/index.theme') + self.assertGreater(int(data['PKGSIZE']), 0) + + data = load_bh(os.path.join(history_dir, 'hicolor-icon-theme-dev', 'latest')) + if 'FILELIST' in data: + self.assertEqual(data['FILELIST'], '') + self.assertEqual(int(data['PKGSIZE']), 0) + class ArchiverTest(OESelftestTestCase): def test_arch_work_dir_and_export_source(self): """ diff --git a/poky/meta/lib/oeqa/selftest/cases/distrodata.py b/poky/meta/lib/oeqa/selftest/cases/distrodata.py index 4a45855d2..908979804 100644 --- a/poky/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/poky/meta/lib/oeqa/selftest/cases/distrodata.py @@ -93,7 +93,7 @@ The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIP def is_maintainer_exception(entry): exceptions = ["musl", "newlib", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", - "cve-update-db-native"] + "cve-update-db-native", "rust"] for i in exceptions: if i in entry: return True diff --git a/poky/meta/lib/oeqa/selftest/cases/glibc.py b/poky/meta/lib/oeqa/selftest/cases/glibc.py index be9792330..6f96281ea 100644 --- a/poky/meta/lib/oeqa/selftest/cases/glibc.py +++ b/poky/meta/lib/oeqa/selftest/cases/glibc.py @@ -33,7 +33,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): ptestsuite = "glibc-user" if ssh is None else "glibc" self.ptest_section(ptestsuite) - with open(os.path.join(builddir, "tests.sum"), "r") as f: + with open(os.path.join(builddir, "tests.sum"), "r", errors='replace') as f: for test, result in parse_values(f): self.ptest_result(ptestsuite, test, result) diff --git a/poky/meta/lib/oeqa/selftest/cases/reproducible.py b/poky/meta/lib/oeqa/selftest/cases/reproducible.py index 910ef0d30..e4582cb82 100644 --- a/poky/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/poky/meta/lib/oeqa/selftest/cases/reproducible.py @@ -27,13 +27,17 @@ import datetime # ruby-ri-docs, meson: #https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20210215-0_td9la2/packages/diff-html/ +# rust-llvm: +#https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20210825-kaihham6/ exclude_packages = [ 'glide', 'go-helloworld', 'go-runtime', 'go_', 'go-', - 'ruby-ri-docs' + 'ruby-ri-docs', + 'rust-llvm-liblto', + 'rust-llvm-staticdev' ] def is_excluded(package): diff --git a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py index 4cfec94d8..129503de6 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -212,12 +212,14 @@ class TestImage(OESelftestTestCase): Author: Alexander Kanavin <alex.kanavin@gmail.com> """ import subprocess, os + + render_hint = """If /dev/dri/renderD* is absent due to lack of suitable GPU, 'modprobe vgem' will create one sutable for mesa llvmpipe sofware renderer.""" try: content = os.listdir("/dev/dri") if len([i for i in content if i.startswith('render')]) == 0: - self.skipTest("No render nodes found in /dev/dri: %s" %(content)) + self.skipTest("No render nodes found in /dev/dri: %s. %s" %(content, render_hint)) except FileNotFoundError: - self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.") + self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine. %s" %(render_hint)) try: dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) except subprocess.CalledProcessError as e: diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py index 2efbe514c..3b4143414 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wic.py +++ b/poky/meta/lib/oeqa/selftest/cases/wic.py @@ -11,6 +11,7 @@ import os import sys import unittest +import hashlib from glob import glob from shutil import rmtree, copy @@ -686,6 +687,63 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc % (wks_file, self.resultdir), ignore_status=True).status) os.remove(wks_file) + def test_no_fstab_update(self): + """Test --no-fstab-update wks option.""" + + oldpath = os.environ['PATH'] + os.environ['PATH'] = get_bb_var("PATH", "wic-tools") + + # Get stock fstab from base-files recipe + self.assertEqual(0, bitbake('base-files -c do_install').status) + bf_fstab = os.path.join(get_bb_var('D', 'base-files'), 'etc/fstab') + self.assertEqual(True, os.path.exists(bf_fstab)) + bf_fstab_md5sum = runCmd('md5sum %s 2>/dev/null' % bf_fstab).output.split(" ")[0] + + try: + no_fstab_update_path = os.path.join(self.resultdir, 'test-no-fstab-update') + os.makedirs(no_fstab_update_path) + wks_file = os.path.join(no_fstab_update_path, 'temp.wks') + with open(wks_file, 'w') as wks: + wks.writelines(['part / --source rootfs --fstype=ext4 --label rootfs\n', + 'part /mnt/p2 --source rootfs --rootfs-dir=core-image-minimal ', + '--fstype=ext4 --label p2 --no-fstab-update\n']) + runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wks_file, self.resultdir)) + + part_fstab_md5sum = [] + for i in range(1, 3): + part = glob(os.path.join(self.resultdir, 'temp-*.direct.p') + str(i))[0] + part_fstab = runCmd("debugfs -R 'cat etc/fstab' %s 2>/dev/null" % (part)) + part_fstab_md5sum.append(hashlib.md5((part_fstab.output + "\n\n").encode('utf-8')).hexdigest()) + + # '/etc/fstab' in partition 2 should contain the same stock fstab file + # as the one installed by the base-file recipe. + self.assertEqual(bf_fstab_md5sum, part_fstab_md5sum[1]) + + # '/etc/fstab' in partition 1 should contain an updated fstab file. + self.assertNotEqual(bf_fstab_md5sum, part_fstab_md5sum[0]) + + finally: + os.environ['PATH'] = oldpath + + def test_no_fstab_update_errors(self): + """Test --no-fstab-update wks option error handling.""" + wks_file = 'temp.wks' + + # Absolute argument. + with open(wks_file, 'w') as wks: + wks.write("part / --source rootfs --fstype=ext4 --no-fstab-update /etc") + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wks_file, self.resultdir), ignore_status=True).status) + os.remove(wks_file) + + # Argument pointing to parent directory. + with open(wks_file, 'w') as wks: + wks.write("part / --source rootfs --fstype=ext4 --no-fstab-update ././..") + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wks_file, self.resultdir), ignore_status=True).status) + os.remove(wks_file) + class Wic2(WicTestCase): def test_bmap_short(self): diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py index 5c9d2b24a..d55248c49 100644 --- a/poky/meta/lib/oeqa/utils/qemurunner.py +++ b/poky/meta/lib/oeqa/utils/qemurunner.py @@ -123,7 +123,10 @@ class QemuRunner: import fcntl fl = fcntl.fcntl(o, fcntl.F_GETFL) fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK) - return os.read(o.fileno(), 1000000).decode("utf-8") + try: + return os.read(o.fileno(), 1000000).decode("utf-8") + except BlockingIOError: + return "" def handleSIGCHLD(self, signum, frame): @@ -535,6 +538,8 @@ class QemuRunner: if self.runqemu.poll() is None: self.logger.debug("Sending SIGKILL to runqemu") os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL) + if not self.runqemu.stdout.closed: + self.logger.info("Output from runqemu:\n%s" % self.getOutput(self.runqemu.stdout)) self.runqemu.stdin.close() self.runqemu.stdout.close() self.runqemu_exited = True |