diff mbox series

oeqa/selftest/runtime_test: fix postinst_rootfs_and_boot

Message ID 20171106175558.24581-1-ross.burton@intel.com
State Superseded
Headers show
Series oeqa/selftest/runtime_test: fix postinst_rootfs_and_boot | expand

Commit Message

Ross Burton Nov. 6, 2017, 5:55 p.m. UTC
This test overrides IMAGE_FEATURES but failed to include package-management,
which is essential for postinsts to work under dpkg.

Also rewrite the file existence check to use a console login not SSH for
simplicity.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Patrick Ohly Nov. 14, 2017, 12:06 p.m. UTC | #1
On Mon, 2017-11-06 at 17:55 +0000, Ross Burton wrote:
>                     testcommand = 'ls /etc/' + fileboot_name

Can't this be removed?

>                      with runqemu('core-image-minimal') as qemu:
> -                        ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog)
> -                        status, output = ssh.run(testcommand)
> +                        status, output = qemu.run_serial("-f /etc/" + fileboot_name)

Did you mean "test -f"?

>                          self.assertEqual(status, 0, 'File %s was not created at first boot (%s)' % (fileboot_name, output))

run_serial has the quirk that status == 1 on *success*. Yes, weird.

The test probably passed because it was testing for failure, and the
missing "test" ensured that the command failed.
Ross Burton Nov. 14, 2017, 12:45 p.m. UTC | #2
On 14 November 2017 at 12:06, Patrick Ohly <patrick.ohly@intel.com> wrote:

> On Mon, 2017-11-06 at 17:55 +0000, Ross Burton wrote:

> >                     testcommand = 'ls /etc/' + fileboot_name

>

> Can't this be removed?

>

> >                      with runqemu('core-image-minimal') as qemu:

> > -                        ssh = SSHControl(ip=qemu.ip,

> logfile=qemu.sshlog)

> > -                        status, output = ssh.run(testcommand)

> > +                        status, output = qemu.run_serial("-f /etc/" +

> fileboot_name)

>

> Did you mean "test -f"?



Yes! Argh.


>

> >                          self.assertEqual(status, 0, 'File %s was not

> created at first boot (%s)' % (fileboot_name, output))

>

> run_serial has the quirk that status == 1 on *success*. Yes, weird.

>


Oh <redacted>.



> The test probably passed because it was testing for failure, and the

> missing "test" ensured that the command failed.

>


Thanks.  Sorry.

Ross
<div dir="ltr">On 14 November 2017 at 12:06, Patrick Ohly <span dir="ltr">&lt;<a href="mailto:patrick.ohly@intel.com" target="_blank">patrick.ohly@intel.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, 2017-11-06 at 17:55 +0000, Ross Burton wrote:<br>
&gt;                     testcommand = &#39;ls /etc/&#39; + fileboot_name<br>
<br>
</span>Can&#39;t this be removed?<br>
<span class=""><br>
&gt;                      with runqemu(&#39;core-image-minimal&#39;) as qemu:<br>
&gt; -                        ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog)<br>
&gt; -                        status, output = ssh.run(testcommand)<br>
&gt; +                        status, output = qemu.run_serial(&quot;-f /etc/&quot; + fileboot_name)<br>
<br>
</span>Did you mean &quot;test -f&quot;?</blockquote><div><br></div><div>Yes! Argh.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
&gt;                          self.assertEqual(status, 0, &#39;File %s was not created at first boot (%s)&#39; % (fileboot_name, output))<br>
<br>
</span>run_serial has the quirk that status == 1 on *success*. Yes, weird.<br></blockquote><div><br></div><div>Oh &lt;redacted&gt;.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The test probably passed because it was testing for failure, and the<br>
missing &quot;test&quot; ensured that the command failed.<br></blockquote><div><br></div><div>Thanks.  Sorry.</div><div><br></div><div>Ross </div></div></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 7ce81c3ff0f..25270b7535b 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -244,7 +244,7 @@  postinst-delayed-t \
                 with self.subTest(init_manager=init_manager, package_class=classes):
                     features = 'MACHINE = "qemux86"\n'
                     features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg)
-                    features += 'IMAGE_FEATURES += "empty-root-password ssh-server-openssh"\n'
+                    features += 'IMAGE_FEATURES += "package-management empty-root-password"\n'
                     features += 'PACKAGE_CLASSES = "%s"\n' % classes
                     if init_manager == "systemd":
                         features += 'DISTRO_FEATURES_append = " systemd"\n'
@@ -263,6 +263,5 @@  postinst-delayed-t \
 
                     testcommand = 'ls /etc/' + fileboot_name
                     with runqemu('core-image-minimal') as qemu:
-                        ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog)
-                        status, output = ssh.run(testcommand)
+                        status, output = qemu.run_serial("-f /etc/" + fileboot_name)
                         self.assertEqual(status, 0, 'File %s was not created at first boot (%s)' % (fileboot_name, output))