<div dir="ltr">The test fetches bitbake variables and then changes the configuration, so it fails if the user's MACHINE isn't qemux86. I've changed this locally and now its failing differently:<div><br></div><div><div>First extra element 18:</div><div>./etc/systemd/system/sysinit.target.wants/opkg-configure.service</div></div><div><br></div><div>Looks like you want to lock the configuration to sysvinit.</div><div><br></div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 January 2017 at 22:52, Randy Witt <span dir="ltr"><<a href="mailto:randy.e.witt@linux.intel.com" target="_blank">randy.e.witt@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">This test checks to make sure only the files expected exist in a<br>
container image. Currently only ROOTFS_BOOTSTRAP_INSTALL, gets added to<br>
all images without the user specifying it.<br>
<br>
But this test should help if a developer in the future ever silently<br>
adds more than just ROOTFS_BOOTSTRAP_INSTALL, and that the developer can<br>
make sure it also gets removed from a container image.<br>
<br>
[YOCTO #9502]<br>
<br>
Signed-off-by: Randy Witt <<a href="mailto:randy.e.witt@linux.intel.com">randy.e.witt@linux.intel.com</a>><br>
---<br>
.../container-image/<a href="http://container-image-testpkg.bb" rel="noreferrer" target="_blank">container-<wbr>image-testpkg.bb</a> | 8 +++<br>
.../container-image/<a href="http://container-test-image.bb" rel="noreferrer" target="_blank">container-<wbr>test-image.bb</a> | 8 +++<br>
meta/lib/oeqa/selftest/<wbr>containerimage.py | 82 ++++++++++++++++++++++<br>
3 files changed, 98 insertions(+)<br>
create mode 100644 meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-image-testpkg.bb" rel="noreferrer" target="_blank">container-<wbr>image-testpkg.bb</a><br>
create mode 100644 meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-test-image.bb" rel="noreferrer" target="_blank">container-<wbr>test-image.bb</a><br>
create mode 100644 meta/lib/oeqa/selftest/<wbr>containerimage.py<br>
<br>
diff --git a/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-image-testpkg.bb" rel="noreferrer" target="_blank">container-<wbr>image-testpkg.bb</a> b/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-image-testpkg.bb" rel="noreferrer" target="_blank">container-<wbr>image-testpkg.bb</a><br>
new file mode 100644<br>
index 0000000..f8dd229<br>
--- /dev/null<br>
+++ b/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-image-testpkg.bb" rel="noreferrer" target="_blank">container-<wbr>image-testpkg.bb</a><br>
@@ -0,0 +1,8 @@<br>
+LICENSE = "MIT"<br>
+<br>
+INHIBIT_DEFAULT_DEPS = "1"<br>
+<br>
+do_install_append() {<br>
+ install -d ${D}${bindir}<br>
+ touch ${D}${bindir}/theapp<br>
+}<br>
diff --git a/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-test-image.bb" rel="noreferrer" target="_blank">container-<wbr>test-image.bb</a> b/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-test-image.bb" rel="noreferrer" target="_blank">container-<wbr>test-image.bb</a><br>
new file mode 100644<br>
index 0000000..d5f939c<br>
--- /dev/null<br>
+++ b/meta-selftest/recipes-test/<wbr>container-image/<a href="http://container-test-image.bb" rel="noreferrer" target="_blank">container-<wbr>test-image.bb</a><br>
@@ -0,0 +1,8 @@<br>
+IMAGE_INSTALL += "container-image-testpkg"<br>
+<br>
+LICENSE = "MIT"<br>
+<br>
+IMAGE_FSTYPES = "container"<br>
+IMAGE_LINGUAS = ""<br>
+<br>
+inherit core-image<br>
diff --git a/meta/lib/oeqa/selftest/<wbr>containerimage.py b/meta/lib/oeqa/selftest/<wbr>containerimage.py<br>
new file mode 100644<br>
index 0000000..6a85222<br>
--- /dev/null<br>
+++ b/meta/lib/oeqa/selftest/<wbr>containerimage.py<br>
@@ -0,0 +1,82 @@<br>
+import os<br>
+<br>
+from oeqa.selftest.base import oeSelfTest<br>
+from oeqa.utils.commands import bitbake, get_bb_vars, runCmd<br>
+<br>
+# This test builds an image with using the "container" IMAGE_FSTYPE, and<br>
+# ensures that then files in the image are only the ones expected.<br>
+#<br>
+# The only package added to the image is container_image_testpkg, which<br>
+# contains one file. However, due to some other things not cleaning up during<br>
+# rootfs creation, there is some cruft. Ideally bugs will be filed and the<br>
+# cruft removed, but for now we whitelist some known set.<br>
+#<br>
+# Also for performance reasons we're only checking the cruft when using ipk.<br>
+# When using deb, and rpm it is a bit different and we could test all<br>
+# of them, but this test is more to catch if other packages get added by<br>
+# default other than what is in ROOTFS_BOOTSTRAP_INSTALL.<br>
+#<br>
+class ContainerImageTests(<wbr>oeSelfTest):<br>
+<br>
+ # Verify that when specifying a IMAGE_TYPEDEP_ of the form "foo.bar" that<br>
+ # the conversion type bar gets added as a dep as well<br>
+ def test_expected_files(self):<br>
+<br>
+ def get_each_path_part(path):<br>
+ if path:<br>
+ part = [ '.' + path + '/' ]<br>
+ result = get_each_path_part(path.<wbr>rsplit('/', 1)[0])<br>
+ if result:<br>
+ return part + result<br>
+ else:<br>
+ return part<br>
+ else:<br>
+ return None<br>
+<br>
+ bbvars = get_bb_vars(['bindir', 'sysconfdir', 'localstatedir',<br>
+ 'DEPLOY_DIR_IMAGE'])<br>
</div></div><span class="">+ expected_files = [<br>
+ './',<br>
</span><span class="">+ '.{bindir}/theapp',<br>
+ '.{sysconfdir}/default/',<br>
+ '.{sysconfdir}/default/<wbr>postinst',<br>
+ '.{sysconfdir}/ld.so.cache',<br>
+ '.{sysconfdir}/timestamp',<br>
</span>+ '.{sysconfdir}/version',<br>
+ './run/',<br>
<div class="HOEnZb"><div class="h5">+ '.{localstatedir}/cache/',<br>
+ '.{localstatedir}/cache/<wbr>ldconfig/',<br>
+ '.{localstatedir}/cache/<wbr>ldconfig/aux-cache',<br>
+ '.{localstatedir}/cache/opkg/'<wbr>,<br>
+ '.{localstatedir}/lib/',<br>
+ '.{localstatedir}/lib/opkg/'<br>
+ ]<br>
+<br>
+ expected_files = [ x.format(bindir=bbvars['<wbr>bindir'],<br>
+ sysconfdir=bbvars['sysconfdir'<wbr>],<br>
+ localstatedir=bbvars['<wbr>localstatedir'])<br>
+ for x in expected_files ]<br>
+<br>
+ # Since tar lists all directories individually, make sure each element<br>
+ # from bindir, sysconfdir, etc is added<br>
+ expected_files += get_each_path_part(bbvars['<wbr>bindir'])<br>
+ expected_files += get_each_path_part(bbvars['<wbr>sysconfdir'])<br>
+ expected_files += get_each_path_part(bbvars['<wbr>localstatedir'])<br>
+<br>
+ expected_files = sorted(expected_files)<br>
+<br>
+<br>
+ self.write_config('PREFERRED_<wbr>PROVIDER_virtual/kernel = "linux-dummy"')<br>
+ self.append_config('MACHINE = "qemux86"')<br>
+ self.append_config('IMAGE_<wbr>FSTYPES = "container"')<br>
+ self.append_config('PACKAGE_<wbr>CLASSES = "package_ipk"')<br>
+<br>
+ # Build the image of course<br>
+ bitbake('container-test-image'<wbr>)<br>
+<br>
+ image = os.path.join(bbvars['DEPLOY_<wbr>DIR_IMAGE'],<br>
+ 'container-test-image-qemux86.<wbr>tar.bz2')<br>
+<br>
+ # Ensure the files in the image are what we expect<br>
+ result = runCmd("tar tf {} | sort".format(image), shell=True)<br>
+ self.assertEqual(result.<wbr>output.split('\n'), expected_files)<br>
--<br>
2.9.3<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</div></div></blockquote></div><br></div>