qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Shalini Chellathurai Saroja <shalini@linux.ibm.com>,
	qemu-s390x mailing list <qemu-s390x@nongnu.org>
Cc: Sebastian Mitterle <smitterl@redhat.com>,
	qemu-devel mailing list <qemu-devel@nongnu.org>,
	Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
	Hendrik Brueckner <brueckner@linux.ibm.com>,
	Michael Mueller <mimu@linux.ibm.com>
Subject: Re: [PATCH v2 2/2] tests/functional: add tests for SCLP event CPI
Date: Thu, 16 Oct 2025 09:17:59 +0200	[thread overview]
Message-ID: <f4ec5b8c-2bdb-43a2-a100-cfb1685aeb52@redhat.com> (raw)
In-Reply-To: <20251013133902.111233-2-shalini@linux.ibm.com>

On 13/10/2025 15.39, Shalini Chellathurai Saroja wrote:
> Add tests for SCLP event type Control-Program Identification.
> 
> Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
> Suggested-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/functional/s390x/test_ccw_virtio.py | 25 +++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 
> diff --git a/tests/functional/s390x/test_ccw_virtio.py b/tests/functional/s390x/test_ccw_virtio.py
> index 453711aa0f..82e73ecf5e 100755
> --- a/tests/functional/s390x/test_ccw_virtio.py
> +++ b/tests/functional/s390x/test_ccw_virtio.py
> @@ -15,6 +15,7 @@
>   import tempfile
>   
>   from qemu_test import QemuSystemTest, Asset
> +from qemu_test import exec_command
>   from qemu_test import exec_command_and_wait_for_pattern
>   from qemu_test import wait_for_console_pattern
>   
> @@ -270,5 +271,29 @@ def test_s390x_fedora(self):
>                           'while ! (dmesg -c | grep Start.virtcrypto_remove) ; do'
>                           ' sleep 1 ; done', 'Start virtcrypto_remove.')
>   
> +        # Test SCLP event Control-Program Identification (CPI)
> +        cpi = '/sys/firmware/cpi/'
> +        sclpcpi = '/machine/sclp/s390-sclp-event-facility/sclpcpi'
> +        self.log.info("Test SCLP event CPI")
> +        exec_command(self, 'echo TESTVM > ' + cpi + 'system_name')
> +        exec_command(self, 'echo LINUX > ' + cpi + 'system_type')
> +        exec_command(self, 'echo TESTPLEX > ' + cpi + 'sysplex_name')
> +        exec_command(self, 'echo 0x001a000000060b00 > ' + cpi + 'system_level')
> +        exec_command(self, 'echo 1 > ' + cpi + 'set')

I think at least the last statement should be replaced by 
exec_command_and_wait_for_pattern, waiting for the shell prompt. Otherwise 
there is a small race condition here that the exec_command() has been sent, 
but not executed yet. Ok, the event_wait() will wait for a while, so it's 
very unlikely, but let's better play save and wait for the shell prompt 
first, before waiting for the event.

> +        try:
> +            event = self.vm.event_wait('SCLP_CPI_INFO_AVAILABLE')
> +        except TimeoutError:
> +            self.skipTest('SCLP Event type CPI is not supported')

Should we rather fail the test in case we don't receive the event?

> +        ts = self.vm.cmd('qom-get', path=sclpcpi, property='timestamp')
> +        self.assertNotEqual(ts, 0)
> +        name = self.vm.cmd('qom-get', path=sclpcpi, property='system_name')
> +        self.assertEqual(name.strip(), 'TESTVM')
> +        typ = self.vm.cmd('qom-get', path=sclpcpi, property='system_type')
> +        self.assertEqual(typ.strip(), 'LINUX')
> +        sysplex = self.vm.cmd('qom-get', path=sclpcpi, property='sysplex_name')
> +        self.assertEqual(sysplex.strip(), 'TESTPLEX')
> +        level = self.vm.cmd('qom-get', path=sclpcpi, property='system_level')
> +        self.assertEqual(level, 0x001a000000060b00)

  Thomas



  reply	other threads:[~2025-10-16  7:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 13:39 [PATCH v2 1/2] qapi/machine-s390x: add QAPI event SCLP_CPI_INFO_AVAILABLE Shalini Chellathurai Saroja
2025-10-13 13:39 ` [PATCH v2 2/2] tests/functional: add tests for SCLP event CPI Shalini Chellathurai Saroja
2025-10-16  7:17   ` Thomas Huth [this message]
2025-10-16 11:50     ` Shalini Chellathurai Saroja
2025-10-13 16:50 ` [PATCH v2 1/2] qapi/machine-s390x: add QAPI event SCLP_CPI_INFO_AVAILABLE Nina Schoetterl-Glausch
2025-10-14  8:45   ` Shalini Chellathurai Saroja
  -- strict thread matches above, loose matches on Subject: below --
2025-10-13 13:32 Shalini Chellathurai Saroja
2025-10-13 13:32 ` [PATCH v2 2/2] tests/functional: add tests for SCLP event CPI Shalini Chellathurai Saroja

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=f4ec5b8c-2bdb-43a2-a100-cfb1685aeb52@redhat.com \
    --to=thuth@redhat.com \
    --cc=brueckner@linux.ibm.com \
    --cc=mimu@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=shalini@linux.ibm.com \
    --cc=smitterl@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).