diff options
Diffstat (limited to 'poky/meta/lib')
28 files changed, 282 insertions, 174 deletions
diff --git a/poky/meta/lib/oe/license.py b/poky/meta/lib/oe/license.py index b5d378a549..79800c2b8f 100644 --- a/poky/meta/lib/oe/license.py +++ b/poky/meta/lib/oe/license.py @@ -99,26 +99,29 @@ def flattened_licenses(licensestr, choose_licenses): raise LicenseSyntaxError(licensestr, exc) return flatten.licenses -def is_included(licensestr, whitelist=None, blacklist=None): - """Given a license string and whitelist and blacklist, determine if the - license string matches the whitelist and does not match the blacklist. - - Returns a tuple holding the boolean state and a list of the applicable - licenses that were excluded if state is False, or the licenses that were - included if the state is True. +def is_included(licensestr, include_licenses=None, exclude_licenses=None): + """Given a license a list of list to include and a list of + licenses to exclude, determine if the license string + matches the an include list and does not match the + exclude list. + + Returns a tuple holding the boolean state and a list of + the applicable licenses that were excluded if state is + False, or the licenses that were included if the state + is True. """ def include_license(license): - return any(fnmatch(license, pattern) for pattern in whitelist) + return any(fnmatch(license, pattern) for pattern in include_licenses) def exclude_license(license): - return any(fnmatch(license, pattern) for pattern in blacklist) + return any(fnmatch(license, pattern) for pattern in exclude_licenses) def choose_licenses(alpha, beta): """Select the option in an OR which is the 'best' (has the most included licenses and no excluded licenses).""" # The factor 1000 below is arbitrary, just expected to be much larger - # that the number of licenses actually specified. That way the weight + # than the number of licenses actually specified. That way the weight # will be negative if the list of licenses contains an excluded license, # but still gives a higher weight to the list with the most included # licenses. @@ -131,11 +134,11 @@ def is_included(licensestr, whitelist=None, blacklist=None): else: return beta - if not whitelist: - whitelist = ['*'] + if not include_licenses: + include_licenses = ['*'] - if not blacklist: - blacklist = [] + if not exclude_licenses: + exclude_licenses = [] licenses = flattened_licenses(licensestr, choose_licenses) excluded = [lic for lic in licenses if exclude_license(lic)] diff --git a/poky/meta/lib/oe/package_manager/ipk/rootfs.py b/poky/meta/lib/oe/package_manager/ipk/rootfs.py index 26dbee6f6a..10a831994e 100644 --- a/poky/meta/lib/oe/package_manager/ipk/rootfs.py +++ b/poky/meta/lib/oe/package_manager/ipk/rootfs.py @@ -145,51 +145,14 @@ class PkgRootfs(DpkgOpkgRootfs): self.pm.recover_packaging_data() bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) - - def _prelink_file(self, root_dir, filename): - bb.note('prelink %s in %s' % (filename, root_dir)) - prelink_cfg = oe.path.join(root_dir, - self.d.expand('${sysconfdir}/prelink.conf')) - if not os.path.exists(prelink_cfg): - shutil.copy(self.d.expand('${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf'), - prelink_cfg) - - cmd_prelink = self.d.expand('${STAGING_DIR_NATIVE}${sbindir_native}/prelink') - self._exec_shell_cmd([cmd_prelink, - '--root', - root_dir, - '-amR', - '-N', - '-c', - self.d.expand('${sysconfdir}/prelink.conf')]) - ''' Compare two files with the same key twice to see if they are equal. If they are not equal, it means they are duplicated and come from different packages. - 1st: Comapre them directly; - 2nd: While incremental image creation is enabled, one of the - files could be probaly prelinked in the previous image - creation and the file has been changed, so we need to - prelink the other one and compare them. ''' def _file_equal(self, key, f1, f2): - - # Both of them are not prelinked if filecmp.cmp(f1, f2): return True - - if bb.data.inherits_class('image-prelink', self.d): - if self.image_rootfs not in f1: - self._prelink_file(f1.replace(key, ''), f1) - - if self.image_rootfs not in f2: - self._prelink_file(f2.replace(key, ''), f2) - - # Both of them are prelinked - if filecmp.cmp(f1, f2): - return True - # Not equal return False diff --git a/poky/meta/lib/oe/patch.py b/poky/meta/lib/oe/patch.py index 950fe723dc..9034fcae03 100644 --- a/poky/meta/lib/oe/patch.py +++ b/poky/meta/lib/oe/patch.py @@ -304,14 +304,19 @@ class GitApplyTree(PatchTree): def _isInitialized(self): cmd = "git rev-parse --show-toplevel" - (status, output) = subprocess.getstatusoutput(cmd.split()) + try: + output = runcmd(cmd.split(), self.dir).strip() + except CmdError as err: + ## runcmd returned non-zero which most likely means 128 + ## Not a git directory + return False ## Make sure repo is in builddir to not break top-level git repos - return status == 0 and os.path.samedir(output, self.dir) + return os.path.samefile(output, self.dir) def _initRepo(self): runcmd("git init".split(), self.dir) runcmd("git add .".split(), self.dir) - runcmd("git commit -a --allow-empty -m Patching_started".split(), self.dir) + runcmd("git commit -a --allow-empty -m bitbake_patching_started".split(), self.dir) @staticmethod def extractPatchHeader(patchfile): diff --git a/poky/meta/lib/oe/qa.py b/poky/meta/lib/oe/qa.py index efab7e8564..89acd3ead0 100644 --- a/poky/meta/lib/oe/qa.py +++ b/poky/meta/lib/oe/qa.py @@ -48,6 +48,9 @@ class ELFFile: return self def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): if self.data: self.data.close() @@ -128,6 +131,9 @@ class ELFFile: """ return self.getShort(ELFFile.E_MACHINE) + def set_objdump(self, cmd, output): + self.objdump_output[cmd] = output + def run_objdump(self, cmd, d): import bb.process import sys diff --git a/poky/meta/lib/oe/recipeutils.py b/poky/meta/lib/oe/recipeutils.py index a0c6974f04..872ff97b89 100644 --- a/poky/meta/lib/oe/recipeutils.py +++ b/poky/meta/lib/oe/recipeutils.py @@ -1029,6 +1029,7 @@ def get_recipe_upstream_version(rd): else: ud = bb.fetch2.FetchData(src_uri, rd) if rd.getVar("UPSTREAM_CHECK_COMMITS") == "1": + bb.fetch2.get_srcrev(rd) revision = ud.method.latest_revision(ud, rd, 'default') upversion = pv if revision != rd.getVar("SRCREV"): diff --git a/poky/meta/lib/oe/sbom.py b/poky/meta/lib/oe/sbom.py index 848812c0b7..3372f13a9d 100644 --- a/poky/meta/lib/oe/sbom.py +++ b/poky/meta/lib/oe/sbom.py @@ -28,6 +28,10 @@ def get_image_spdxid(img): return "SPDXRef-Image-%s" % img +def get_sdk_spdxid(sdk): + return "SPDXRef-SDK-%s" % sdk + + def write_doc(d, spdx_doc, subdir, spdx_deploy=None): from pathlib import Path diff --git a/poky/meta/lib/oe/spdx.py b/poky/meta/lib/oe/spdx.py index 9e7ced5a15..14ca706895 100644 --- a/poky/meta/lib/oe/spdx.py +++ b/poky/meta/lib/oe/spdx.py @@ -105,10 +105,13 @@ class _ListProperty(_Property): obj._spdx[name] = [] return obj._spdx[name] + def set_helper(obj, value): + obj._spdx[name] = list(value) + def del_helper(obj): del obj._spdx[name] - attrs[name] = property(get_helper, None, del_helper) + attrs[name] = property(get_helper, set_helper, del_helper) def init(self, source): return [self.prop.init(o) for o in source] diff --git a/poky/meta/lib/oe/useradd.py b/poky/meta/lib/oe/useradd.py index 8fc77568ff..3caa3f851a 100644 --- a/poky/meta/lib/oe/useradd.py +++ b/poky/meta/lib/oe/useradd.py @@ -45,7 +45,6 @@ def build_useradd_parser(): parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False) parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true") parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account") - parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new account") parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into") parser.add_argument("-r", "--system", help="create a system account", action="store_true") parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account") @@ -63,7 +62,6 @@ def build_groupadd_parser(): parser.add_argument("-K", "--key", metavar="KEY=VALUE", help="override /etc/login.defs defaults") parser.add_argument("-o", "--non-unique", help="allow to create groups with duplicate (non-unique) GID", action="store_true") parser.add_argument("-p", "--password", metavar="PASSWORD", help="use this encrypted password for the new group") - parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new group") parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into") parser.add_argument("-r", "--system", help="create a system account", action="store_true") parser.add_argument("GROUP", help="Group name of the new group") diff --git a/poky/meta/lib/oe/utils.py b/poky/meta/lib/oe/utils.py index 136650e6f7..84790b7dff 100644 --- a/poky/meta/lib/oe/utils.py +++ b/poky/meta/lib/oe/utils.py @@ -537,17 +537,6 @@ class ThreadedPool: for worker in self.workers: worker.join() -def write_ld_so_conf(d): - # Some utils like prelink may not have the correct target library paths - # so write an ld.so.conf to help them - ldsoconf = d.expand("${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf") - if os.path.exists(ldsoconf): - bb.utils.remove(ldsoconf) - bb.utils.mkdirhier(os.path.dirname(ldsoconf)) - with open(ldsoconf, "w") as f: - f.write(d.getVar("base_libdir") + '\n') - f.write(d.getVar("libdir") + '\n') - class ImageQAFailed(Exception): def __init__(self, description, name=None, logfile=None): self.description = description diff --git a/poky/meta/lib/oeqa/controllers/masterimage.py b/poky/meta/lib/oeqa/controllers/controllerimage.py index 0bf5917e48..78a4aaff87 100644 --- a/poky/meta/lib/oeqa/controllers/masterimage.py +++ b/poky/meta/lib/oeqa/controllers/controllerimage.py @@ -3,13 +3,13 @@ # SPDX-License-Identifier: MIT # # This module adds support to testimage.bbclass to deploy images and run -# tests using a "master image" - this is a "known good" image that is +# tests using a "controller image" - this is a "known good" image that is # installed onto the device as part of initial setup and will be booted into # with no interaction; we can then use it to deploy the image to be tested # to a second partition before running the tests. # -# For an example master image, see core-image-testmaster -# (meta/recipes-extended/images/core-image-testmaster.bb) +# For an example controller image, see core-image-testcontroller +# (meta/recipes-extended/images/core-image-testcontroller.bb) import os import bb @@ -24,12 +24,12 @@ from oeqa.utils import CommandError from abc import ABCMeta, abstractmethod -class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta): +class ControllerImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta): supported_image_fstypes = ['tar.gz', 'tar.bz2'] def __init__(self, d): - super(MasterImageHardwareTarget, self).__init__(d) + super(ControllerImageHardwareTarget, self).__init__(d) # target ip addr = d.getVar("TEST_TARGET_IP") or bb.fatal('Please set TEST_TARGET_IP with the IP address of the machine you want to run the tests on.') @@ -61,8 +61,8 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta if not os.path.isfile(self.kernel): bb.fatal("No kernel found. Expected path: %s" % self.kernel) - # master ssh connection - self.master = None + # controller ssh connection + self.controller = None # if the user knows what they are doing, then by all means... self.user_cmds = d.getVar("TEST_DEPLOY_CMDS") self.deploy_cmds = None @@ -119,19 +119,19 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta def deploy(self): # base class just sets the ssh log file for us - super(MasterImageHardwareTarget, self).deploy() - self.master = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) - status, output = self.master.run("cat /etc/masterimage") + super(ControllerImageHardwareTarget, self).deploy() + self.controller = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) + status, output = self.controller.run("cat /etc/controllerimage") if status != 0: - # We're not booted into the master image, so try rebooting - bb.plain("%s - booting into the master image" % self.pn) + # We're not booted into the controller image, so try rebooting + bb.plain("%s - booting into the controller image" % self.pn) self.power_ctl("cycle") self._wait_until_booted() bb.plain("%s - deploying image on target" % self.pn) - status, output = self.master.run("cat /etc/masterimage") + status, output = self.controller.run("cat /etc/controllerimage") if status != 0: - bb.fatal("No ssh connectivity or target isn't running a master image.\n%s" % output) + bb.fatal("No ssh connectivity or target isn't running a controller image.\n%s" % output) if self.user_cmds: self.deploy_cmds = self.user_cmds.split("\n") try: @@ -156,10 +156,10 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta def stop(self): bb.plain("%s - reboot/powercycle target" % self.pn) - self.power_cycle(self.master) + self.power_cycle(self.controller) -class SystemdbootTarget(MasterImageHardwareTarget): +class SystemdbootTarget(ControllerImageHardwareTarget): def __init__(self, d): super(SystemdbootTarget, self).__init__(d) @@ -184,16 +184,16 @@ class SystemdbootTarget(MasterImageHardwareTarget): def _deploy(self): # make sure these aren't mounted - self.master.run("umount /boot; umount /mnt/testrootfs; umount /sys/firmware/efi/efivars;") + self.controller.run("umount /boot; umount /mnt/testrootfs; umount /sys/firmware/efi/efivars;") # from now on, every deploy cmd should return 0 # else an exception will be thrown by sshcontrol - self.master.ignore_status = False - self.master.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype) - self.master.copy_to(self.kernel, "~/test-kernel") + self.controller.ignore_status = False + self.controller.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype) + self.controller.copy_to(self.kernel, "~/test-kernel") for cmd in self.deploy_cmds: - self.master.run(cmd) + self.controller.run(cmd) def _start(self, params=None): - self.power_cycle(self.master) + self.power_cycle(self.controller) # there are better ways than a timeout but this should work for now time.sleep(120) diff --git a/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py b/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py index f3c2bedbaf..150b70d9f0 100644 --- a/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py +++ b/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py @@ -121,11 +121,16 @@ class SyslogTestConfig(OERuntimeTestCase): self.test_syslog_restart() - cmd = 'logger foobar && grep foobar /var/log/test' - status,output = self.target.run(cmd) - msg = 'Test log string not found. Output: %s ' % output + cmd = 'logger foobar' + status, output = self.target.run(cmd) + msg = 'Logger command failed, %s. Output: %s ' % (status, output) self.assertEqual(status, 0, msg=msg) + cmd = 'cat /var/log/test' + status, output = self.target.run(cmd) + if "foobar" not in output or status: + self.fail("'foobar' not found in logfile, status %s, contents %s" % (status, output)) + cmd = "sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf" self.target.run(cmd) self.test_syslog_restart() diff --git a/poky/meta/lib/oeqa/runtime/cases/ssh.py b/poky/meta/lib/oeqa/runtime/cases/ssh.py index 60a5fbbfbf..e31224b3af 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ssh.py +++ b/poky/meta/lib/oeqa/runtime/cases/ssh.py @@ -13,7 +13,7 @@ class SSHTest(OERuntimeTestCase): def test_ssh(self): (status, output) = self.target.run('uname -a') self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) - (status, output) = self.target.run('cat /etc/masterimage') - msg = "This isn't the right image - /etc/masterimage " \ + (status, output) = self.target.run('cat /etc/controllerimage') + msg = "This isn't the right image - /etc/controllerimage " \ "shouldn't be here %s" % output self.assertEqual(status, 1, msg=msg) diff --git a/poky/meta/lib/oeqa/runtime/cases/stap.py b/poky/meta/lib/oeqa/runtime/cases/stap.py index 615c290ce6..480eaabf2d 100644 --- a/poky/meta/lib/oeqa/runtime/cases/stap.py +++ b/poky/meta/lib/oeqa/runtime/cases/stap.py @@ -14,11 +14,19 @@ class StapTest(OERuntimeTestCase): @OEHasPackage(['gcc-symlinks']) @OEHasPackage(['kernel-devsrc']) def test_stap(self): - cmd = 'make -C /usr/src/kernel scripts prepare' - status, output = self.target.run(cmd, 900) - self.assertEqual(status, 0, msg='\n'.join([cmd, output])) + try: + cmd = 'make -j -C /usr/src/kernel scripts prepare' + status, output = self.target.run(cmd, 900) + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) - cmd = 'stap -v --disable-cache -DSTP_NO_VERREL_CHECK -s1 -e \'probe oneshot { print("Hello, "); println("world!") }\'' - status, output = self.target.run(cmd, 900) - self.assertEqual(status, 0, msg='\n'.join([cmd, output])) - self.assertIn('Hello, world!', output, msg='\n'.join([cmd, output])) + cmd = 'stap -v -p4 -m stap-hello --disable-cache -DSTP_NO_VERREL_CHECK -e \'probe oneshot { print("Hello, "); println("SystemTap!") }\'' + status, output = self.target.run(cmd, 900) + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) + + cmd = 'staprun -v -R -b1 stap-hello.ko' + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) + self.assertIn('Hello, SystemTap!', output, msg='\n'.join([cmd, output])) + except: + status, dmesg = self.target.run('dmesg') + if status == 0: + print(dmesg) diff --git a/poky/meta/lib/oeqa/runtime/cases/weston.py b/poky/meta/lib/oeqa/runtime/cases/weston.py index b3a7c2776d..b81cc299ef 100644 --- a/poky/meta/lib/oeqa/runtime/cases/weston.py +++ b/poky/meta/lib/oeqa/runtime/cases/weston.py @@ -10,7 +10,7 @@ import threading import time class WestonTest(OERuntimeTestCase): - weston_log_file = '/tmp/weston.log' + weston_log_file = '/tmp/weston-2.log' @classmethod def tearDownClass(cls): @@ -31,13 +31,13 @@ class WestonTest(OERuntimeTestCase): return output.split(" ") def get_weston_command(self, cmd): - return 'export XDG_RUNTIME_DIR=/run/user/0; export WAYLAND_DISPLAY=wayland-0; %s' % cmd + return 'export XDG_RUNTIME_DIR=/run/user/`id -u weston`; export WAYLAND_DISPLAY=wayland-1; %s' % cmd def run_weston_init(self): if 'systemd' in self.tc.td['VIRTUAL-RUNTIME_init_manager']: self.target.run('systemd-run --collect --unit=weston-ptest.service --uid=0 -p PAMName=login -p TTYPath=/dev/tty6 -E XDG_RUNTIME_DIR=/tmp -E WAYLAND_DISPLAY=wayland-0 /usr/bin/weston --socket=wayland-1 --log=%s' % self.weston_log_file) else: - self.target.run(self.get_weston_command('openvt -- weston --socket=wayland-1 --log=%s' % self.weston_log_file)) + self.target.run(self.get_weston_command('openvt -- weston --socket=wayland-2 --log=%s' % self.weston_log_file)) def get_new_wayland_processes(self, existing_wl_processes): try_cnt = 0 diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py index 134879aab3..35e549eb40 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py @@ -13,8 +13,8 @@ class HTTPTests(OESDKTestCase): """ def test_wget(self): - self._run('env -i wget --debug --output-document /dev/null https://www.example.com') + self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html') 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/")\'') + self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'') diff --git a/poky/meta/lib/oeqa/selftest/cases/bblogging.py b/poky/meta/lib/oeqa/selftest/cases/bblogging.py index ea6c3c8c77..317e68b82f 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bblogging.py +++ b/poky/meta/lib/oeqa/selftest/cases/bblogging.py @@ -11,7 +11,7 @@ class BitBakeLogging(OESelftestTestCase): def assertCount(self, item, entry, count): self.assertEqual(item.count(entry), count, msg="Output:\n'''\n%s\n'''\ndoesn't contain %d copies of:\n'''\n%s\n'''\n" % (item, count, entry)) - def test_shell_logging(self): + def test_shell_loggingA(self): # no logs, no verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c shelltest -f", ignore_status = True) @@ -19,6 +19,7 @@ class BitBakeLogging(OESelftestTestCase): self.assertNotIn("This is shell stdout", result.output) self.assertNotIn("This is shell stderr", result.output) + def test_shell_loggingB(self): # logs, no verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c shelltest -f", ignore_status = True) @@ -26,14 +27,16 @@ class BitBakeLogging(OESelftestTestCase): self.assertCount(result.output, "This is shell stdout", 1) self.assertCount(result.output, "This is shell stderr", 1) + def test_shell_loggingC(self): # no logs, verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c shelltest -f -v", ignore_status = True) self.assertIn("ERROR: Logfile of failure stored in:", result.output) - # two copies due to set +x + # two copies due to set +x self.assertCount(result.output, "This is shell stdout", 2) self.assertCount(result.output, "This is shell stderr", 2) + def test_shell_loggingD(self): # logs, verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c shelltest -f -v", ignore_status = True) @@ -42,13 +45,52 @@ class BitBakeLogging(OESelftestTestCase): self.assertCount(result.output, "This is shell stdout", 2) self.assertCount(result.output, "This is shell stderr", 2) - def test_python_exit_logging(self): + def test_python_exec_func_shell_loggingA(self): + # no logs, no verbose + self.write_config('BBINCLUDELOGS = ""') + result = bitbake("logging-test -c pythontest_exec_func_shell -f", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + self.assertNotIn("This is shell stdout", result.output) + self.assertNotIn("This is shell stderr", result.output) + + def test_python_exec_func_shell_loggingB(self): + # logs, no verbose + self.write_config('BBINCLUDELOGS = "yes"') + result = bitbake("logging-test -c pythontest_exec_func_shell -f", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + self.assertCount(result.output, "This is shell stdout", 1) + self.assertCount(result.output, "This is shell stderr", 1) + + def test_python_exec_func_shell_loggingC(self): + # no logs, verbose + self.write_config('BBINCLUDELOGS = ""') + result = bitbake("logging-test -c pythontest_exec_func_shell -f -v", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + # two copies due to set +x + self.assertCount(result.output, "This is shell stdout", 2) + self.assertCount(result.output, "This is shell stderr", 2) + + def test_python_exec_func_shell_loggingD(self): + # logs, verbose + self.write_config('BBINCLUDELOGS = "yes"') + result = bitbake("logging-test -c pythontest_exec_func_shell -f -v", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + # two copies due to set +x + self.assertCount(result.output, "This is shell stdout", 2) + self.assertCount(result.output, "This is shell stderr", 2) + + def test_python_exit_loggingA(self): # no logs, no verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c pythontest_exit -f", ignore_status = True) self.assertIn("ERROR: Logfile of failure stored in:", result.output) self.assertNotIn("This is python stdout", result.output) + def test_python_exit_loggingB(self): # logs, no verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c pythontest_exit -f", ignore_status = True) @@ -56,6 +98,7 @@ class BitBakeLogging(OESelftestTestCase): # A sys.exit() should include the output self.assertCount(result.output, "This is python stdout", 1) + def test_python_exit_loggingC(self): # no logs, verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c pythontest_exit -f -v", ignore_status = True) @@ -63,6 +106,7 @@ class BitBakeLogging(OESelftestTestCase): # python tasks don't log output with -v currently #self.assertCount(result.output, "This is python stdout", 1) + def test_python_exit_loggingD(self): # logs, verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c pythontest_exit -f -v", ignore_status = True) @@ -70,7 +114,42 @@ class BitBakeLogging(OESelftestTestCase): # python tasks don't log output with -v currently #self.assertCount(result.output, "This is python stdout", 1) - def test_python_fatal_logging(self): + def test_python_exec_func_python_loggingA(self): + # no logs, no verbose + self.write_config('BBINCLUDELOGS = ""') + result = bitbake("logging-test -c pythontest_exec_func_python -f", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + self.assertNotIn("This is python stdout", result.output) + + def test_python_exec_func_python_loggingB(self): + # logs, no verbose + self.write_config('BBINCLUDELOGS = "yes"') + result = bitbake("logging-test -c pythontest_exec_func_python -f", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + # A sys.exit() should include the output + self.assertCount(result.output, "This is python stdout", 1) + + def test_python_exec_func_python_loggingC(self): + # no logs, verbose + self.write_config('BBINCLUDELOGS = ""') + result = bitbake("logging-test -c pythontest_exec_func_python -f -v", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + # python tasks don't log output with -v currently + #self.assertCount(result.output, "This is python stdout", 1) + + def test_python_exec_func_python_loggingD(self): + # logs, verbose + self.write_config('BBINCLUDELOGS = "yes"') + result = bitbake("logging-test -c pythontest_exec_func_python -f -v", + ignore_status = True) + self.assertIn("ERROR: Logfile of failure stored in:", result.output) + # python tasks don't log output with -v currently + #self.assertCount(result.output, "This is python stdout", 1) + + def test_python_fatal_loggingA(self): # no logs, no verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c pythontest_fatal -f", ignore_status = True) @@ -78,6 +157,7 @@ class BitBakeLogging(OESelftestTestCase): self.assertNotIn("This is python fatal test stdout", result.output) self.assertCount(result.output, "This is a fatal error", 1) + def test_python_fatal_loggingB(self): # logs, no verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c pythontest_fatal -f", ignore_status = True) @@ -86,6 +166,7 @@ class BitBakeLogging(OESelftestTestCase): self.assertNotIn("This is python fatal test stdout", result.output) self.assertCount(result.output, "This is a fatal error", 1) + def test_python_fatal_loggingC(self): # no logs, verbose self.write_config('BBINCLUDELOGS = ""') result = bitbake("logging-test -c pythontest_fatal -f -v", ignore_status = True) @@ -94,6 +175,7 @@ class BitBakeLogging(OESelftestTestCase): #self.assertCount(result.output, "This is python fatal test stdout", 1) self.assertCount(result.output, "This is a fatal error", 1) + def test_python_fatal_loggingD(self): # logs, verbose self.write_config('BBINCLUDELOGS = "yes"') result = bitbake("logging-test -c pythontest_fatal -f -v", ignore_status = True) diff --git a/poky/meta/lib/oeqa/selftest/cases/bbtests.py b/poky/meta/lib/oeqa/selftest/cases/bbtests.py index 246cb032bf..35ad9f3cd6 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/poky/meta/lib/oeqa/selftest/cases/bbtests.py @@ -63,8 +63,8 @@ class BitbakeTests(OESelftestTestCase): def test_warnings_errors(self): result = bitbake('-b asdf', ignore_status=True) - find_warnings = re.search("Summary: There w.{2,3}? [1-9][0-9]* WARNING messages* shown", result.output) - find_errors = re.search("Summary: There w.{2,3}? [1-9][0-9]* ERROR messages* shown", result.output) + find_warnings = re.search("Summary: There w.{2,3}? [1-9][0-9]* WARNING messages*", result.output) + find_errors = re.search("Summary: There w.{2,3}? [1-9][0-9]* ERROR messages*", result.output) self.assertTrue(find_warnings, msg="Did not find the mumber of warnings at the end of the build:\n" + result.output) self.assertTrue(find_errors, msg="Did not find the mumber of errors at the end of the build:\n" + result.output) @@ -228,8 +228,8 @@ INHERIT:remove = \"report-error\" result = bitbake('selftest-ed', ignore_status=True) self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output)) lic_dir = get_bb_var('LICENSE_DIRECTORY') - self.assertFalse(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPLv3'))) - self.assertTrue(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPLv2'))) + self.assertFalse(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPL-3.0-or-later'))) + self.assertTrue(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPL-2.0-or-later'))) def test_setscene_only(self): """ Bitbake option to restore from sstate only within a build (i.e. execute no real tasks, only setscene)""" @@ -307,8 +307,47 @@ INHERIT:remove = \"report-error\" src = get_bb_var("SRC_URI",test_recipe) gitscm = re.search("git://", src) self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) - result = bitbake('man-db -c patch', ignore_status=False) + result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") self.delete_recipeinc(test_recipe) - bitbake('-cclean man-db') + bitbake('-cclean {}'.format(test_recipe)) + + def test_git_patchtool2(self): + """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it + """ + test_recipe = "gitrepotest" + src = get_bb_var("SRC_URI",test_recipe) + gitscm = re.search("git://", src) + self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe)) + result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) + srcdir = get_bb_var('S', test_recipe) + result = runCmd("git log", cwd = srcdir) + self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir)) + self.delete_recipeinc(test_recipe) + bitbake('-cclean {}'.format(test_recipe)) + + + def test_git_unpack_nonetwork(self): + """ + Test that a recipe with a floating tag that needs to be resolved upstream doesn't + access the network in a patch task run in a separate builld invocation + """ + + # Enable the recipe to float using a distro override + self.write_config("DISTROOVERRIDES .= \":gitunpack-enable-recipe\"") + + bitbake('gitunpackoffline -c fetch') + bitbake('gitunpackoffline -c patch') + + def test_git_unpack_nonetwork_fail(self): + """ + Test that a recipe with a floating tag which doesn't call get_srcrev() in the fetcher + raises an error when the fetcher is called. + """ + + # Enable the recipe to float using a distro override + self.write_config("DISTROOVERRIDES .= \":gitunpack-enable-recipe\"") + + result = bitbake('gitunpackoffline-fail -c fetch', ignore_status=True) + self.assertTrue("Recipe uses a floating tag/branch without a fixed SRCREV" in result.output, msg = "Recipe without PV set to SRCPV should have failed: %s" % result.output) diff --git a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py index 651bb03c7e..bfe613b847 100644 --- a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -62,9 +62,9 @@ class DiskMonTest(OESelftestTestCase): res = bitbake("delay -c delay", ignore_status = True) self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output) self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) - self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') + self.write_config('BB_DISKMON_DIRS = "HALT,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') res = bitbake("delay -c delay", ignore_status = True) - self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output) + self.assertTrue('ERROR: Immediately halt since the disk space monitor action is "HALT"!' in res.output, "Tasks should have been halted immediately. Disk monitor is set to HALT: %s" % res.output) self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"') res = bitbake("delay -c delay") diff --git a/poky/meta/lib/oeqa/selftest/cases/distrodata.py b/poky/meta/lib/oeqa/selftest/cases/distrodata.py index 908979804a..03f31e9fcb 100644 --- a/poky/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/poky/meta/lib/oeqa/selftest/cases/distrodata.py @@ -18,7 +18,7 @@ class Distrodata(OESelftestTestCase): Product: oe-core Author: Alexander Kanavin <alex.kanavin@gmail.com> """ - feature = 'LICENSE_FLAGS_WHITELIST += " commercial"\n' + feature = 'LICENSE_FLAGS_ACCEPTED += " commercial"\n' self.write_config(feature) pkgs = oe.recipeutils.get_recipe_upgrade_status() @@ -99,7 +99,7 @@ The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIP return True return False - feature = 'require conf/distro/include/maintainers.inc\nLICENSE_FLAGS_WHITELIST += " commercial"\nPARSE_ALL_RECIPES = "1"\nPACKAGE_CLASSES = "package_ipk package_deb package_rpm"\n' + feature = 'require conf/distro/include/maintainers.inc\nLICENSE_FLAGS_ACCEPTED += " commercial"\nPARSE_ALL_RECIPES = "1"\nPACKAGE_CLASSES = "package_ipk package_deb package_rpm"\n' self.write_config(feature) with bb.tinfoil.Tinfoil() as tinfoil: diff --git a/poky/meta/lib/oeqa/selftest/cases/eSDK.py b/poky/meta/lib/oeqa/selftest/cases/eSDK.py index d0c402ba8a..f7279b3230 100644 --- a/poky/meta/lib/oeqa/selftest/cases/eSDK.py +++ b/poky/meta/lib/oeqa/selftest/cases/eSDK.py @@ -63,7 +63,7 @@ class oeSDKExtSelfTest(OESelftestTestCase): cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) sstate_config=""" -SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" +ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS" SSTATE_MIRRORS = "file://.* file://%s/PATH" CORE_IMAGE_EXTRA_INSTALL = "perl" """ % sstate_dir @@ -91,7 +91,7 @@ CORE_IMAGE_EXTRA_INSTALL = "perl" # Configure eSDK to use sstate mirror from poky sstate_config=""" -SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" +ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS" SSTATE_MIRRORS = "file://.* file://%s/PATH" """ % bb_vars["SSTATE_DIR"] with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: diff --git a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py index 18f37c6d7d..d36d45c551 100644 --- a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -198,8 +198,8 @@ class ImageFeatures(OESelftestTestCase): image_name = 'core-image-minimal' all_image_types = set(get_bb_var("IMAGE_TYPES", image_name).split()) - blacklist = set(('container', 'elf', 'f2fs', 'multiubi', 'tar.zst', 'wic.zst')) - img_types = all_image_types - blacklist + skip_image_types = set(('container', 'elf', 'f2fs', 'multiubi', 'tar.zst', 'wic.zst')) + img_types = all_image_types - skip_image_types config = 'IMAGE_FSTYPES += "%s"\n'\ 'MKUBIFS_ARGS ?= "-m 2048 -e 129024 -c 2047"\n'\ @@ -245,8 +245,8 @@ VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils" VIRTUAL-RUNTIME_base-utils-hwclock = "util-linux-hwclock" VIRTUAL-RUNTIME_base-utils-syslog = "" -# Blacklist busybox -PNBLACKLIST[busybox] = "Don't build this" +# Skip busybox +SKIP_RECIPE[busybox] = "Don't build this" """ self.write_config(config) diff --git a/poky/meta/lib/oeqa/selftest/cases/newlib.py b/poky/meta/lib/oeqa/selftest/cases/newlib.py new file mode 100644 index 0000000000..999e3e78b0 --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/newlib.py @@ -0,0 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake + +class NewlibTest(OESelftestTestCase): + def test_newlib(self): + self.write_config('TCLIBC = "newlib"') + bitbake("newlib libgloss") diff --git a/poky/meta/lib/oeqa/selftest/cases/recipetool.py b/poky/meta/lib/oeqa/selftest/cases/recipetool.py index 9db1ddb532..09448bad01 100644 --- a/poky/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/poky/meta/lib/oeqa/selftest/cases/recipetool.py @@ -472,25 +472,6 @@ class RecipetoolCreateTests(RecipetoolBase): inherits = ['setuptools3'] self._test_recipe_contents(recipefile, checkvars, inherits) - def test_recipetool_create_python3_distutils(self): - # Test creating python3 package from tarball (using distutils3 class) - temprecipe = os.path.join(self.tempdir, 'recipe') - os.makedirs(temprecipe) - pn = 'docutils' - pv = '0.14' - recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, pv)) - srcuri = 'https://files.pythonhosted.org/packages/84/f4/5771e41fdf52aabebbadecc9381d11dea0fa34e4759b4071244fa094804c/docutils-%s.tar.gz' % pv - result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) - self.assertTrue(os.path.isfile(recipefile)) - checkvars = {} - checkvars['LICENSE'] = 'BSD-3-Clause & GPL & PSF' - checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING.txt;md5=35a23d42b615470583563132872c97d6' - checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/84/f4/5771e41fdf52aabebbadecc9381d11dea0fa34e4759b4071244fa094804c/docutils-${PV}.tar.gz' - checkvars['SRC_URI[md5sum]'] = 'c53768d63db3873b7d452833553469de' - checkvars['SRC_URI[sha256sum]'] = '51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274' - inherits = ['distutils3'] - self._test_recipe_contents(recipefile, checkvars, inherits) - def test_recipetool_create_github_tarball(self): # Basic test to ensure github URL mangling doesn't apply to release tarballs temprecipe = os.path.join(self.tempdir, 'recipe') diff --git a/poky/meta/lib/oeqa/selftest/cases/reproducible.py b/poky/meta/lib/oeqa/selftest/cases/reproducible.py index e539365031..7caf8c3e7d 100644 --- a/poky/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/poky/meta/lib/oeqa/selftest/cases/reproducible.py @@ -206,7 +206,7 @@ class ReproducibleTests(OESelftestTestCase): PACKAGE_CLASSES = "{package_classes}" INHIBIT_PACKAGE_STRIP = "1" TMPDIR = "{tmpdir}" - LICENSE_FLAGS_WHITELIST = "commercial" + LICENSE_FLAGS_ACCEPTED = "commercial" DISTRO_FEATURES:append = ' systemd pam' USERADDEXTENSION = "useradd-staticids" USERADD_ERROR_DYNAMIC = "skip" diff --git a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py index 96b2d115ed..3038b40021 100644 --- a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -177,7 +177,7 @@ class SStateTests(SStateBase): # QA checks for this test. It may report errors otherwise. self.append_config('ERROR_QA:remove = "version-going-backwards"') - # For not this only checks if random sstate tasks are handled correctly as a group. + # For now this only checks if random sstate tasks are handled correctly as a group. # In the future we should add control over what tasks we check for. sstate_archs_list = [] diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py index 5fc8e65142..6f3dc27743 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wic.py +++ b/poky/meta/lib/oeqa/selftest/cases/wic.py @@ -851,7 +851,7 @@ class Wic2(WicTestCase): self.assertEqual(0, bitbake('wic-image-minimal').status) self.remove_config(config) - with runqemu('wic-image-minimal', ssh=False) as qemu: + with runqemu('wic-image-minimal', ssh=False, runqemuparams='nographic') as qemu: cmd = "mount | grep '^/dev/' | cut -f1,3 -d ' ' | egrep -c -e '/dev/sda1 /boot' " \ "-e '/dev/root /|/dev/sda2 /' -e '/dev/sda3 /media' -e '/dev/sda4 /mnt'" status, output = qemu.run_serial(cmd) @@ -871,7 +871,7 @@ class Wic2(WicTestCase): self.remove_config(config) with runqemu('core-image-minimal', ssh=False, - runqemuparams='ovmf', image_fstype='wic') as qemu: + runqemuparams='nographic ovmf', image_fstype='wic') as qemu: cmd = "grep sda. /proc/partitions |wc -l" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) @@ -1059,21 +1059,21 @@ class Wic2(WicTestCase): self.assertEqual(0, bitbake('core-image-minimal-mtdutils').status) self.remove_config(config) - with runqemu('core-image-minimal-mtdutils', ssh=False, image_fstype='wic') as qemu: + with runqemu('core-image-minimal-mtdutils', ssh=False, + runqemuparams='nographic', image_fstype='wic') as qemu: cmd = "grep sda. /proc/partitions |wc -l" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '2') - def test_rawcopy_plugin(self): + def _rawcopy_plugin(self, fstype): """Test rawcopy plugin""" img = 'core-image-minimal' machine = get_bb_var('MACHINE', img) + params = ',unpack' if fstype.endswith('.gz') else '' with NamedTemporaryFile("w", suffix=".wks") as wks: - wks.writelines(['part /boot --active --source bootimg-pcbios\n', - 'part / --source rawcopy --sourceparams="file=%s-%s.ext4" --use-uuid\n'\ - % (img, machine), - 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) + wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\ + % (img, machine, fstype, params)) wks.flush() cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) runCmd(cmd) @@ -1081,6 +1081,17 @@ class Wic2(WicTestCase): out = glob(self.resultdir + "%s-*direct" % wksname) self.assertEqual(1, len(out)) + def test_rawcopy_plugin(self): + self._rawcopy_plugin('ext4') + + def test_rawcopy_plugin_unpack(self): + fstype = 'ext4.gz' + config = 'IMAGE_FSTYPES = "%s"\n' % fstype + self.append_config(config) + self.assertEqual(0, bitbake('core-image-minimal').status) + self.remove_config(config) + self._rawcopy_plugin(fstype) + def test_empty_plugin(self): """Test empty plugin""" config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n' @@ -1109,7 +1120,8 @@ class Wic2(WicTestCase): self.assertEqual(0, bitbake('core-image-minimal').status) self.remove_config(config) - with runqemu('core-image-minimal', ssh=False, image_fstype='wic') as qemu: + with runqemu('core-image-minimal', ssh=False, + runqemuparams='nographic', image_fstype='wic') as qemu: # Check that we have ONLY two /dev/sda* partitions (/boot and /) cmd = "grep sda. /proc/partitions | wc -l" status, output = qemu.run_serial(cmd) @@ -1170,7 +1182,7 @@ class Wic2(WicTestCase): self.remove_config(config) with runqemu('core-image-minimal', ssh=False, - runqemuparams='ovmf', image_fstype='wic') as qemu: + runqemuparams='nographic ovmf', image_fstype='wic') as qemu: # Check that /boot has EFI bootx64.efi (required for EFI) cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l" status, output = qemu.run_serial(cmd) @@ -1408,7 +1420,7 @@ class Wic2(WicTestCase): bb.utils.rename(new_image_path, image_path) # Check if it boots in qemu - with runqemu('core-image-minimal', ssh=False) as qemu: + with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic') as qemu: cmd = "ls /etc/" status, output = qemu.run_serial('true') self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) diff --git a/poky/meta/lib/oeqa/utils/dump.py b/poky/meta/lib/oeqa/utils/dump.py index dc8757807e..95a79a571c 100644 --- a/poky/meta/lib/oeqa/utils/dump.py +++ b/poky/meta/lib/oeqa/utils/dump.py @@ -66,6 +66,7 @@ class BaseDumper(object): def _write_dump(self, command, output): fullname = self._construct_filename(command) + os.makedirs(os.path.dirname(fullname), exist_ok=True) if isinstance(self, MonitorDumper): with open(fullname, 'w') as json_file: json.dump(output, json_file, indent=4) diff --git a/poky/meta/lib/oeqa/utils/logparser.py b/poky/meta/lib/oeqa/utils/logparser.py index 60e16d500e..879aefca33 100644 --- a/poky/meta/lib/oeqa/utils/logparser.py +++ b/poky/meta/lib/oeqa/utils/logparser.py @@ -135,30 +135,27 @@ class LtpComplianceParser(object): def parse(self, logfile): test_regex = {} - test_regex['PASSED'] = re.compile(r"^PASS") - test_regex['FAILED'] = re.compile(r"^FAIL") - test_regex['SKIPPED'] = re.compile(r"(?:UNTESTED)|(?:UNSUPPORTED)") + test_regex['FAILED'] = re.compile(r"FAIL") section_regex = {} - section_regex['test'] = re.compile(r"^Testing") + section_regex['test'] = re.compile(r"^Executing") with open(logfile, errors='replace') as f: + name = logfile + result = "PASSED" for line in f: - result = section_regex['test'].search(line) - if result: - self.name = "" - self.name = line.split()[1].strip() - self.results[self.name] = "PASSED" - failed = 0 + regex_result = section_regex['test'].search(line) + if regex_result: + name = line.split()[1].strip() - failed_result = test_regex['FAILED'].search(line) - if failed_result: - failed = line.split()[1].strip() - if int(failed) > 0: - self.results[self.name] = "FAILED" + regex_result = test_regex['FAILED'].search(line) + if regex_result: + result = "FAILED" + self.results[name] = result for test in self.results: result = self.results[test] + print (self.results) self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip())) return self.results, self.section |