<div dir="ltr">The test fetches bitbake variables and then changes the configuration, so it fails if the user&#39;s MACHINE isn&#39;t qemux86.  I&#39;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">&lt;<a href="mailto:randy.e.witt@linux.intel.com" target="_blank">randy.e.witt@linux.intel.com</a>&gt;</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 &lt;<a href="mailto:randy.e.witt@linux.intel.com">randy.e.witt@linux.intel.com</a>&gt;<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 = &quot;MIT&quot;<br>
+<br>
+INHIBIT_DEFAULT_DEPS = &quot;1&quot;<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 += &quot;container-image-testpkg&quot;<br>
+<br>
+LICENSE = &quot;MIT&quot;<br>
+<br>
+IMAGE_FSTYPES = &quot;container&quot;<br>
+IMAGE_LINGUAS = &quot;&quot;<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 &quot;container&quot; 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&#39;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 &quot;foo.bar&quot; 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 = [ &#39;.&#39; + path + &#39;/&#39; ]<br>
+                result = get_each_path_part(path.<wbr>rsplit(&#39;/&#39;, 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([&#39;bindir&#39;, &#39;sysconfdir&#39;, &#39;localstatedir&#39;,<br>
+                              &#39;DEPLOY_DIR_IMAGE&#39;])<br>
</div></div><span class="">+        expected_files = [<br>
+                    &#39;./&#39;,<br>
</span><span class="">+                    &#39;.{bindir}/theapp&#39;,<br>
+                    &#39;.{sysconfdir}/default/&#39;,<br>
+                    &#39;.{sysconfdir}/default/<wbr>postinst&#39;,<br>
+                    &#39;.{sysconfdir}/ld.so.cache&#39;,<br>
+                    &#39;.{sysconfdir}/timestamp&#39;,<br>
</span>+                    &#39;.{sysconfdir}/version&#39;,<br>
+                    &#39;./run/&#39;,<br>
<div class="HOEnZb"><div class="h5">+                    &#39;.{localstatedir}/cache/&#39;,<br>
+                    &#39;.{localstatedir}/cache/<wbr>ldconfig/&#39;,<br>
+                    &#39;.{localstatedir}/cache/<wbr>ldconfig/aux-cache&#39;,<br>
+                    &#39;.{localstatedir}/cache/opkg/&#39;<wbr>,<br>
+                    &#39;.{localstatedir}/lib/&#39;,<br>
+                    &#39;.{localstatedir}/lib/opkg/&#39;<br>
+                ]<br>
+<br>
+        expected_files = [ x.format(bindir=bbvars[&#39;<wbr>bindir&#39;],<br>
+                                    sysconfdir=bbvars[&#39;sysconfdir&#39;<wbr>],<br>
+                                    localstatedir=bbvars[&#39;<wbr>localstatedir&#39;])<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[&#39;<wbr>bindir&#39;])<br>
+        expected_files += get_each_path_part(bbvars[&#39;<wbr>sysconfdir&#39;])<br>
+        expected_files += get_each_path_part(bbvars[&#39;<wbr>localstatedir&#39;])<br>
+<br>
+        expected_files = sorted(expected_files)<br>
+<br>
+<br>
+        self.write_config(&#39;PREFERRED_<wbr>PROVIDER_virtual/kernel = &quot;linux-dummy&quot;&#39;)<br>
+        self.append_config(&#39;MACHINE = &quot;qemux86&quot;&#39;)<br>
+        self.append_config(&#39;IMAGE_<wbr>FSTYPES = &quot;container&quot;&#39;)<br>
+        self.append_config(&#39;PACKAGE_<wbr>CLASSES = &quot;package_ipk&quot;&#39;)<br>
+<br>
+        # Build the image of course<br>
+        bitbake(&#39;container-test-image&#39;<wbr>)<br>
+<br>
+        image = os.path.join(bbvars[&#39;DEPLOY_<wbr>DIR_IMAGE&#39;],<br>
+                             &#39;container-test-image-qemux86.<wbr>tar.bz2&#39;)<br>
+<br>
+        # Ensure the files in the image are what we expect<br>
+        result = runCmd(&quot;tar tf {} | sort&quot;.format(image), shell=True)<br>
+        self.assertEqual(result.<wbr>output.split(&#39;\n&#39;), 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>