diff options
Diffstat (limited to 'poky/meta/lib/oeqa')
20 files changed, 128 insertions, 42 deletions
diff --git a/poky/meta/lib/oeqa/runtime/cases/multilib.py b/poky/meta/lib/oeqa/runtime/cases/multilib.py index 62e662b01..0d1b9ae2c 100644 --- a/poky/meta/lib/oeqa/runtime/cases/multilib.py +++ b/poky/meta/lib/oeqa/runtime/cases/multilib.py @@ -7,6 +7,8 @@ from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.data import skipIfNotInDataVar from oeqa.runtime.decorator.package import OEHasPackage +import subprocess + class MultilibTest(OERuntimeTestCase): def archtest(self, binary, arch): @@ -14,8 +16,10 @@ class MultilibTest(OERuntimeTestCase): Check that ``binary`` has the ELF class ``arch`` (e.g. ELF32/ELF64). """ - status, output = self.target.run('readelf -h %s' % binary) - self.assertEqual(status, 0, 'Failed to readelf %s' % binary) + dest = "{}/test_binary".format(self.td.get('T', '')) + self.target.copyFrom(binary, dest) + output = subprocess.check_output("readelf -h {}".format(dest), shell=True).decode() + os.remove(dest) l = [l.split()[1] for l in output.split('\n') if "Class:" in l] if l: @@ -29,7 +33,6 @@ class MultilibTest(OERuntimeTestCase): @skipIfNotInDataVar('MULTILIBS', 'multilib:lib32', "This isn't a multilib:lib32 image") @OETestDepends(['ssh.SSHTest.test_ssh']) - @OEHasPackage(['binutils']) @OEHasPackage(['lib32-libc6']) def test_check_multilib_libc(self): """ @@ -39,6 +42,6 @@ class MultilibTest(OERuntimeTestCase): self.archtest("/lib64/libc.so.6", "ELF64") @OETestDepends(['multilib.MultilibTest.test_check_multilib_libc']) - @OEHasPackage(['lib32-connman', '!connman']) + @OEHasPackage(['lib32-connman']) def test_file_connman(self): self.archtest("/usr/sbin/connmand", "ELF32") diff --git a/poky/meta/lib/oeqa/runtime/cases/terminal.py b/poky/meta/lib/oeqa/runtime/cases/terminal.py new file mode 100644 index 000000000..a268f2688 --- /dev/null +++ b/poky/meta/lib/oeqa/runtime/cases/terminal.py @@ -0,0 +1,18 @@ +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +import threading +import time + +class TerminalTest(OERuntimeTestCase): + + @OEHasPackage(['matchbox-terminal']) + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_terminal_running(self): + t_thread = threading.Thread(target=self.target.run, args=('export DISPLAY=:0 && matchbox-terminal',)) + t_thread.start() + time.sleep(2) + status, output = self.target.run('pidof matchbox-terminal') + self.target.run('kill -9 %s' % output) + self.assertEqual(status, 0, msg='Not able to find process that runs terminal.') diff --git a/poky/meta/lib/oeqa/runtime/cases/weston.py b/poky/meta/lib/oeqa/runtime/cases/weston.py index ac29eca6e..36b4f9e37 100644 --- a/poky/meta/lib/oeqa/runtime/cases/weston.py +++ b/poky/meta/lib/oeqa/runtime/cases/weston.py @@ -34,7 +34,10 @@ class WestonTest(OERuntimeTestCase): return 'export XDG_RUNTIME_DIR=/run/user/0; export WAYLAND_DISPLAY=wayland-0; %s' % cmd def run_weston_init(self): - self.target.run(self.get_weston_command('weston --log=%s' % self.weston_log_file)) + if 'systemd' in self.tc.td['DISTRO_FEATURES']: + 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)) def get_new_wayland_processes(self, existing_wl_processes): try_cnt = 0 @@ -63,7 +66,10 @@ class WestonTest(OERuntimeTestCase): new_wl_processes, try_cnt = self.get_new_wayland_processes(existing_wl_processes) existing_and_new_weston_processes = self.get_processes_of('weston', 'existing and new') new_weston_processes = [x for x in existing_and_new_weston_processes if x not in existing_weston_processes] - for w in new_weston_processes: - self.target.run('kill -9 %s' % w) + if 'systemd' in self.tc.td['DISTRO_FEATURES']: + self.target.run('systemctl stop weston-ptest.service') + else: + for w in new_weston_processes: + self.target.run('kill -9 %s' % w) __, weston_log = self.target.run('cat %s' % self.weston_log_file) self.assertTrue(new_wl_processes, msg='Could not get new weston-desktop-shell processes (%s, try_cnt:%s) weston log: %s' % (new_wl_processes, try_cnt, weston_log)) diff --git a/poky/meta/lib/oeqa/runtime/cases/x32lib.py b/poky/meta/lib/oeqa/runtime/cases/x32lib.py index ddf220140..f419c8f18 100644 --- a/poky/meta/lib/oeqa/runtime/cases/x32lib.py +++ b/poky/meta/lib/oeqa/runtime/cases/x32lib.py @@ -6,16 +6,21 @@ from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.data import skipIfNotInDataVar +import subprocess + class X32libTest(OERuntimeTestCase): @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32', 'DEFAULTTUNE is not set to x86-64-x32') @OETestDepends(['ssh.SSHTest.test_ssh']) def test_x32_file(self): - cmd = 'readelf -h /bin/ls | grep Class | grep ELF32' - status1 = self.target.run(cmd)[0] - cmd = 'readelf -h /bin/ls | grep Machine | grep X86-64' - status2 = self.target.run(cmd)[0] - msg = ("/bin/ls isn't an X86-64 ELF32 binary. readelf says: %s" % - self.target.run("readelf -h /bin/ls")[1]) + dest = self.td.get('T', '') + "/ls.x32test" + self.target.copyFrom("/bin/ls", dest) + cmd = 'readelf -h {} | grep Class | grep ELF32'.format(dest) + status1 = subprocess.call(cmd, shell=True) + cmd = 'readelf -h {} | grep Machine | grep X86-64'.format(dest) + status2 = subprocess.call(cmd, shell=True) + msg = ("/bin/ls isn't an X86-64 ELF32 binary. readelf says:\n{}".format( + subprocess.check_output("readelf -h {}".format(dest), shell=True).decode())) + os.remove(dest) self.assertTrue(status1 == 0 and status2 == 0, msg=msg) diff --git a/poky/meta/lib/oeqa/sdk/case.py b/poky/meta/lib/oeqa/sdk/case.py index ebb03af9e..c45882689 100644 --- a/poky/meta/lib/oeqa/sdk/case.py +++ b/poky/meta/lib/oeqa/sdk/case.py @@ -26,7 +26,7 @@ class OESDKTestCase(OETestCase): return tarball tarball = os.path.join(workdir, archive) - subprocess.check_output(["wget", "-O", tarball, url]) + subprocess.check_output(["wget", "-O", tarball, url], stderr=subprocess.STDOUT) return tarball def check_elf(self, path, target_os=None, target_arch=None): diff --git a/poky/meta/lib/oeqa/sdk/cases/assimp.py b/poky/meta/lib/oeqa/sdk/cases/assimp.py index f26b17f2e..f166758e4 100644 --- a/poky/meta/lib/oeqa/sdk/cases/assimp.py +++ b/poky/meta/lib/oeqa/sdk/cases/assimp.py @@ -30,7 +30,7 @@ class BuildAssimp(OESDKTestCase): dirs["build"] = os.path.join(testdir, "build") dirs["install"] = os.path.join(testdir, "install") - subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) + subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) diff --git a/poky/meta/lib/oeqa/sdk/cases/buildcpio.py b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py index e56582654..e7fc211a4 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py @@ -24,7 +24,7 @@ class BuildCpioTest(OESDKTestCase): dirs["build"] = os.path.join(testdir, "build") dirs["install"] = os.path.join(testdir, "install") - subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) + subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) diff --git a/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py b/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py index 4211955f8..385f8ccca 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py @@ -28,7 +28,7 @@ class EpoxyTest(OESDKTestCase): dirs["build"] = os.path.join(testdir, "build") dirs["install"] = os.path.join(testdir, "install") - subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) + subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) diff --git a/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py index 1121ed20e..eb3c8ddf3 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py @@ -31,7 +31,7 @@ class GalculatorTest(OESDKTestCase): dirs["build"] = os.path.join(testdir, "build") dirs["install"] = os.path.join(testdir, "install") - subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) + subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) diff --git a/poky/meta/lib/oeqa/sdk/cases/buildlzip.py b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py index 515acd289..49ae756bf 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py @@ -20,7 +20,7 @@ class BuildLzipTest(OESDKTestCase): dirs["build"] = os.path.join(testdir, "build") dirs["install"] = os.path.join(testdir, "install") - subprocess.check_output(["tar", "xf", tarball, "-C", testdir]) + subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) diff --git a/poky/meta/lib/oeqa/selftest/cases/diffoscope/A/file.txt b/poky/meta/lib/oeqa/selftest/cases/diffoscope/A/file.txt new file mode 100644 index 000000000..f70f10e4d --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/diffoscope/A/file.txt @@ -0,0 +1 @@ +A diff --git a/poky/meta/lib/oeqa/selftest/cases/diffoscope/B/file.txt b/poky/meta/lib/oeqa/selftest/cases/diffoscope/B/file.txt new file mode 100644 index 000000000..223b7836f --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/diffoscope/B/file.txt @@ -0,0 +1 @@ +B diff --git a/poky/meta/lib/oeqa/selftest/cases/meta_ide.py b/poky/meta/lib/oeqa/selftest/cases/meta_ide.py index 809142559..6f10d30dc 100644 --- a/poky/meta/lib/oeqa/selftest/cases/meta_ide.py +++ b/poky/meta/lib/oeqa/selftest/cases/meta_ide.py @@ -43,7 +43,7 @@ class MetaIDE(OESelftestTestCase): "https://ftp.gnu.org/gnu/cpio/cpio-2.13.tar.gz", self.tmpdir_metaideQA, self.td['DATETIME'], dl_dir=dl_dir) self.project.download_archive() - self.assertEqual(self.project.run_configure(), 0, + self.assertEqual(self.project.run_configure('$CONFIGURE_FLAGS --disable-maintainer-mode','sed -i -e "/char \*program_name/d" src/global.c;'), 0, msg="Running configure failed") self.assertEqual(self.project.run_make(), 0, msg="Running make failed") diff --git a/poky/meta/lib/oeqa/selftest/cases/prservice.py b/poky/meta/lib/oeqa/selftest/cases/prservice.py index fe1f24ea6..578b2b4dd 100644 --- a/poky/meta/lib/oeqa/selftest/cases/prservice.py +++ b/poky/meta/lib/oeqa/selftest/cases/prservice.py @@ -23,7 +23,7 @@ class BitbakePrTests(OESelftestTestCase): package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name) package_data = ftools.read_file(package_data_file) find_pr = re.search(r"PKGR: r[0-9]+\.([0-9]+)", package_data) - self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file) + self.assertTrue(find_pr, "No PKG revision found via regex 'PKGR: r[0-9]+\.([0-9]+)' in %s" % package_data_file) return int(find_pr.group(1)) def get_task_stamp(self, package_name, recipe_task): @@ -40,7 +40,7 @@ class BitbakePrTests(OESelftestTestCase): return str(stamps[0]) def increment_package_pr(self, package_name): - inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\"\n}" % datetime.datetime.now() + inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\" > ${PKGDESTWORK}/${PN}.datestamp\n}" % datetime.datetime.now() self.write_recipeinc(package_name, inc_data) res = bitbake(package_name, ignore_status=True) self.delete_recipeinc(package_name) @@ -63,7 +63,7 @@ class BitbakePrTests(OESelftestTestCase): pr_2 = self.get_pr_version(package_name) stamp_2 = self.get_task_stamp(package_name, track_task) - self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") + self.assertTrue(pr_2 - pr_1 == 1, "New PR %s did not increment as expected (from %s), difference should be 1" % (pr_2, pr_1)) self.assertTrue(stamp_1 != stamp_2, "Different pkg rev. but same stamp: %s" % stamp_1) def run_test_pr_export_import(self, package_name, replace_current_db=True): @@ -89,7 +89,7 @@ class BitbakePrTests(OESelftestTestCase): self.increment_package_pr(package_name) pr_2 = self.get_pr_version(package_name) - self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") + self.assertTrue(pr_2 - pr_1 == 1, "New PR %s did not increment as expected (from %s), difference should be 1" % (pr_2, pr_1)) def test_import_export_replace_db(self): self.run_test_pr_export_import('m4') diff --git a/poky/meta/lib/oeqa/selftest/cases/recipetool.py b/poky/meta/lib/oeqa/selftest/cases/recipetool.py index c2ade2543..6bac53cf3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/poky/meta/lib/oeqa/selftest/cases/recipetool.py @@ -226,19 +226,6 @@ class RecipetoolTests(RecipetoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) self.assertNotIn('WARNING: ', output) - def test_recipetool_appendfile_src_glob(self): - # A file that's in SRC_URI as a glob - expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', - '\n', - 'SRC_URI += "file://testfile"\n', - '\n', - 'do_install_append() {\n', - ' install -d ${D}${datadir}\n', - ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-src-globfile\n', - '}\n'] - _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-src-globfile', self.testfile, '', expectedlines, ['testfile']) - self.assertNotIn('WARNING: ', output) - def test_recipetool_appendfile_inst_glob(self): # A file that's in do_install as a glob expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', diff --git a/poky/meta/lib/oeqa/selftest/cases/reproducible.py b/poky/meta/lib/oeqa/selftest/cases/reproducible.py index 5d3959be7..a7ef33614 100644 --- a/poky/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/poky/meta/lib/oeqa/selftest/cases/reproducible.py @@ -77,6 +77,32 @@ def compare_file(reference, test, diffutils_sysroot): result.status = SAME return result +def run_diffoscope(a_dir, b_dir, html_dir, **kwargs): + return runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', 'yes', '--html-dir', html_dir, a_dir, b_dir], + **kwargs) + +class DiffoscopeTests(OESelftestTestCase): + diffoscope_test_files = os.path.join(os.path.dirname(os.path.abspath(__file__)), "diffoscope") + + def test_diffoscope(self): + bitbake("diffoscope-native -c addto_recipe_sysroot") + diffoscope_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffoscope-native") + + # Check that diffoscope doesn't return an error when the files compare + # the same (a general check that diffoscope is working) + with tempfile.TemporaryDirectory() as tmpdir: + run_diffoscope('A', 'A', tmpdir, + native_sysroot=diffoscope_sysroot, cwd=self.diffoscope_test_files) + + # Check that diffoscope generates an index.html file when the files are + # different + with tempfile.TemporaryDirectory() as tmpdir: + r = run_diffoscope('A', 'B', tmpdir, + native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=self.diffoscope_test_files) + + self.assertNotEqual(r.status, 0, msg="diffoscope was successful when an error was expected") + self.assertTrue(os.path.exists(os.path.join(tmpdir, 'index.html')), "HTML index not found!") + class ReproducibleTests(OESelftestTestCase): package_classes = ['deb', 'ipk'] images = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline'] @@ -232,7 +258,7 @@ class ReproducibleTests(OESelftestTestCase): # Copy jquery to improve the diffoscope output usability self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js')) - runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', '--html-dir', package_html_dir, 'reproducibleA', 'reproducibleB'], + run_diffoscope('reproducibleA', 'reproducibleB', package_html_dir, native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir) if fails: diff --git a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py index 793c98a33..d89731c69 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -156,7 +156,7 @@ class TestImage(OESelftestTestCase): self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-") self.track_for_cleanup(self.gpg_home) signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing') - runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native")) + runCmd('gpgconf --list-dirs --homedir %s; gpg -v --batch --homedir %s --import %s' % (self.gpg_home, self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"), shell=True) features += 'INHERIT += "sign_package_feed"\n' features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n' features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase') diff --git a/poky/meta/lib/oeqa/selftest/cases/signing.py b/poky/meta/lib/oeqa/selftest/cases/signing.py index 202d54994..a28c7eb19 100644 --- a/poky/meta/lib/oeqa/selftest/cases/signing.py +++ b/poky/meta/lib/oeqa/selftest/cases/signing.py @@ -44,7 +44,9 @@ class Signing(OESelftestTestCase): origenv = os.environ.copy() for e in os.environ: - if builddir in os.environ[e]: + if builddir + "/" in os.environ[e]: + os.environ[e] = os.environ[e].replace(builddir + "/", newbuilddir + "/") + if os.environ[e].endswith(builddir): os.environ[e] = os.environ[e].replace(builddir, newbuilddir) os.chdir(newbuilddir) diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py index 8b58285c3..714637ec1 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wic.py +++ b/poky/meta/lib/oeqa/selftest/cases/wic.py @@ -235,6 +235,17 @@ class Wic(WicTestCase): runCmd(cmd) self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct"))) + def test_efi_bootpart(self): + """Test creation of efi-bootpart image""" + cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir + kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') + self.append_config('IMAGE_EFI_BOOT_FILES = "%s;kernel"\n' % kimgtype) + runCmd(cmd) + sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') + images = glob(self.resultdir + "mkefidisk-*.direct") + result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot)) + self.assertIn("kernel",result.output) + def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir @@ -689,7 +700,7 @@ class Wic2(WicTestCase): wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE', 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME', - 'APPEND')) + 'APPEND', 'IMAGE_EFI_BOOT_FILES')) with open(path) as envfile: content = dict(line.split("=", 1) for line in envfile) # test if variables used by wic present in the .env file @@ -890,6 +901,30 @@ class Wic2(WicTestCase): ]) with NamedTemporaryFile("w", suffix=".wks") as tempf: + # Test that partitions can be placed on a 512 byte sector boundary + tempf.write("bootloader --ptable gpt\n" \ + "part / --source rootfs --ondisk hda --offset 65s --fixed-size 99M --fstype=ext4\n" \ + "part /bar --ondisk hda --offset 102432 --fixed-size 100M --fstype=ext4\n") + tempf.flush() + + _, partlns = self._get_wic_partitions(tempf.name, native_sysroot) + self.assertEqual(partlns, [ + "1:32.5kiB:101408kiB:101376kiB:ext4:primary:;", + "2:102432kiB:204832kiB:102400kiB:ext4:primary:;", + ]) + + with NamedTemporaryFile("w", suffix=".wks") as tempf: + # Test that a partition can be placed immediately after a MSDOS partition table + tempf.write("bootloader --ptable msdos\n" \ + "part / --source rootfs --ondisk hda --offset 1s --fixed-size 100M --fstype=ext4\n") + tempf.flush() + + _, partlns = self._get_wic_partitions(tempf.name, native_sysroot) + self.assertEqual(partlns, [ + "1:0.50kiB:102400kiB:102400kiB:ext4::;", + ]) + + with NamedTemporaryFile("w", suffix=".wks") as tempf: # Test that image creation fails if the partitions would overlap tempf.write("bootloader --ptable gpt\n" \ "part / --source rootfs --ondisk hda --offset 32 --fixed-size 100M --fstype=ext4\n" \ diff --git a/poky/meta/lib/oeqa/selftest/context.py b/poky/meta/lib/oeqa/selftest/context.py index 23f7d71bd..dd3609c1d 100644 --- a/poky/meta/lib/oeqa/selftest/context.py +++ b/poky/meta/lib/oeqa/selftest/context.py @@ -82,7 +82,9 @@ class OESelftestTestContext(OETestContext): oe.path.copytree(selftestdir, newselftestdir) for e in os.environ: - if builddir + "/" in os.environ[e] or os.environ[e].endswith(builddir): + if builddir + "/" in os.environ[e]: + os.environ[e] = os.environ[e].replace(builddir + "/", newbuilddir + "/") + if os.environ[e].endswith(builddir): os.environ[e] = os.environ[e].replace(builddir, newbuilddir) subprocess.check_output("git init; git add *; git commit -a -m 'initial'", cwd=newselftestdir, shell=True) |