On 2025-10-16 09:17, Thomas Huth wrote:
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 <[email protected]>
Suggested-by: Thomas Huth <[email protected]>
---
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.
ok.
+ 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?
ok.
Hello Thomas,
I will incorporate the changes and will send the v3. Thank you for
the review.
+ 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
--
Mit freundlichen Grüßen / Kind regards
Shalini Chellathurai Saroja
Software Developer
Linux on IBM Z & KVM Development
IBM Deutschland Research & Development GmbH
Dept 1419, Schoenaicher Str. 220, 71032 Boeblingen
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht
Stuttgart, HRB 243294