qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Helge Deller <deller@gmx.de>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Sven Schnelle" <svens@stackframe.org>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH] tests/boot-serial-test: Allow the HPPA machine to shudown
Date: Thu, 23 Jan 2020 01:36:03 +0100	[thread overview]
Message-ID: <20200123003603.11610-1-f4bug@amsat.org> (raw)

The boot-serial test uses SeaBIOS on HPPA, and expects to read the
"SeaBIOS wants SYSTEM HALT" string, see [*]:

 122 void __VISIBLE __noreturn hlt(void)
 123 {
 124     if (pdc_debug)
 125         printf("HALT initiated from %p\n",  __builtin_return_address(0));
 126     printf("SeaBIOS wants SYSTEM HALT.\n\n");
 127     asm volatile("\t.word 0xfffdead0": : :"memory");
 128     while (1);
 129 }

A 'SYSTEM HALT' would really halts the CPU, but SeaBIOS implements
it as an infinite loop.

If SeaBIOS does not use the expected serial port but another device,
we might poll the console indefinitely while the machine is halted.

Allow the HPPA machine to 'shutdown'. When it does, we'll get
a qtest error:

  $ make check-qtest-hppa
    TEST    check-qtest-hppa: tests/qtest/boot-serial-test
  ** (tests/qtest/boot-serial-test:31924): ERROR **: 01:12:37.604: Failed to find expected string. Please check '/tmp/qtest-boot-serial-sjxoM6Q'
  ERROR - Bail out! FATAL-ERROR: Failed to find expected string. Please check '/tmp/qtest-boot-serial-sjxoM6Q'
  make: *** [tests/Makefile.include:628: check-qtest-hppa] Error 1

[*] https://github.com/qemu/seabios-hppa/blob/1630ac7d65/src/parisc/parisc.c#L138

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
I first used:

    shutdown = !strcmp(test->arch, "hppa");

Then remembered we'll have other HPPA machines soon.

Instead of:

    shutdown = !strcmp(test->machine, "hppa");

I find the check on the SeaBIOS specific string more accurate
(since someone might add some assembly lines as the other tests).
---
 tests/qtest/boot-serial-test.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 05c7f44457..4e92f292f5 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -188,6 +188,17 @@ static void test_machine(const void *data)
     const uint8_t *code = NULL;
     QTestState *qts;
     int ser_fd;
+    bool shutdown;
+
+    /*
+     * This test uses SeaBIOS on HPPA, and expects to read the
+     * "SeaBIOS wants SYSTEM HALT" string. A 'SYSTEM HALT' really
+     * halts the CPU. If SeaBIOS does not use the expected serial
+     * port but another device, we might poll the console
+     * indefinitely while the machine is halted.
+     * Keep using this option for all the other tests.
+     */
+    shutdown = !strcmp(test->expect, "SeaBIOS wants SYSTEM HALT");
 
     ser_fd = mkstemp(serialtmp);
     g_assert(ser_fd != -1);
@@ -215,10 +226,11 @@ static void test_machine(const void *data)
      * Make sure that this test uses tcg if available: It is used as a
      * fast-enough smoketest for that.
      */
-    qts = qtest_initf("%s %s -M %s -no-shutdown "
+    qts = qtest_initf("%s %s -M %s %s "
                       "-chardev file,id=serial0,path=%s "
                       "-serial chardev:serial0 -accel tcg -accel kvm %s",
                       codeparam, code ? codetmp : "", test->machine,
+                      shutdown ? "" : "-no-shutdown",
                       serialtmp, test->extra);
     if (code) {
         unlink(codetmp);
-- 
2.21.1



             reply	other threads:[~2020-01-23  0:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  0:36 Philippe Mathieu-Daudé [this message]
2020-01-23  3:27 ` [PATCH] tests/boot-serial-test: Allow the HPPA machine to shudown Richard Henderson
2020-01-23 18:37   ` Philippe Mathieu-Daudé
2020-01-23  4:39 ` Thomas Huth
2020-01-23 18:29   ` Philippe Mathieu-Daudé
2020-01-23 21:37     ` Philippe Mathieu-Daudé
2020-01-24  7:02       ` Thomas Huth
2020-01-24 10:33         ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200123003603.11610-1-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=deller@gmx.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=svens@stackframe.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).