From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Nicholas Piggin <npiggin@gmail.com>
Subject: [PULL 06/10] tests/functional/test_ppc64_hv: Simplify console handling
Date: Thu, 2 Jan 2025 11:31:34 +0100 [thread overview]
Message-ID: <20250102103138.354618-7-thuth@redhat.com> (raw)
In-Reply-To: <20250102103138.354618-1-thuth@redhat.com>
From: Nicholas Piggin <npiggin@gmail.com>
Since functional tests have character-based console output parsing,
there is no need for strange hacks to work around old line-based.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-ID: <20241220024617.1968556-3-npiggin@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/test_ppc64_hv.py | 43 ++++++++++++++-----------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc64_hv.py
index 037dfdf87e..2182a68c91 100755
--- a/tests/functional/test_ppc64_hv.py
+++ b/tests/functional/test_ppc64_hv.py
@@ -12,6 +12,7 @@
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern, exec_command
from qemu_test import skipIfMissingCommands, skipBigDataTest
+from qemu_test import exec_command_and_wait_for_pattern
import os
import time
import subprocess
@@ -73,31 +74,28 @@ def do_start_alpine(self):
"id=drive0,read-only=true")
self.vm.launch()
- wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
- exec_command(self, 'root')
+ ps1='localhost:~#'
wait_for_console_pattern(self, 'localhost login:')
- wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+ exec_command_and_wait_for_pattern(self, 'root', ps1)
# If the time is wrong, SSL certificates can fail.
- exec_command(self, 'date -s "' + datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S' + '"'))
- exec_command(self, 'setup-alpine -qe')
- wait_for_console_pattern(self, 'Updating repository indexes... done.')
+ exec_command_and_wait_for_pattern(self, 'date -s "' + datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S' + '"'), ps1)
+ ps1='alpine:~#'
+ exec_command_and_wait_for_pattern(self, 'setup-alpine -qe', ps1)
def do_stop_alpine(self):
- exec_command(self, 'poweroff')
+ exec_command(self, 'echo "TEST ME"')
wait_for_console_pattern(self, 'alpine:~#')
+ exec_command(self, 'poweroff')
+ wait_for_console_pattern(self, 'reboot: Power down')
self.vm.wait()
def do_setup_kvm(self):
- exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/main > /etc/apk/repositories')
- wait_for_console_pattern(self, 'alpine:~#')
- exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/community >> /etc/apk/repositories')
- wait_for_console_pattern(self, 'alpine:~#')
- exec_command(self, 'apk update')
- wait_for_console_pattern(self, 'alpine:~#')
- exec_command(self, 'apk add qemu-system-ppc64')
- wait_for_console_pattern(self, 'alpine:~#')
- exec_command(self, 'modprobe kvm-hv')
- wait_for_console_pattern(self, 'alpine:~#')
+ ps1='alpine:~#'
+ exec_command_and_wait_for_pattern(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/main > /etc/apk/repositories', ps1)
+ exec_command_and_wait_for_pattern(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/community >> /etc/apk/repositories', ps1)
+ exec_command_and_wait_for_pattern(self, 'apk update', ps1)
+ exec_command_and_wait_for_pattern(self, 'apk add qemu-system-ppc64', ps1)
+ exec_command_and_wait_for_pattern(self, 'modprobe kvm-hv', ps1)
# This uses the host's block device as the source file for guest block
# device for install media. This is a bit hacky but allows reuse of the
@@ -116,15 +114,12 @@ def do_test_kvm(self, hpt=False):
'-kernel /media/nvme0n1/boot/vmlinuz-lts '
'-append \'usbcore.nousb ' + append + '\'')
# Alpine 3.18 kernel seems to crash in XHCI USB driver.
- wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
- exec_command(self, 'root')
+ ps1='localhost:~#'
wait_for_console_pattern(self, 'localhost login:')
- wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
- exec_command(self, 'poweroff >& /dev/null')
- wait_for_console_pattern(self, 'localhost:~#')
+ exec_command_and_wait_for_pattern(self, 'root', ps1)
+ exec_command(self, 'poweroff')
wait_for_console_pattern(self, 'reboot: Power down')
- time.sleep(1)
- exec_command(self, '')
+ # Now wait for the host's prompt to come back
wait_for_console_pattern(self, 'alpine:~#')
def test_hv_pseries(self):
--
2.47.1
next prev parent reply other threads:[~2025-01-02 10:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 10:31 [PULL 00/10] Functional test improvements and fixes Thomas Huth
2025-01-02 10:31 ` [PULL 01/10] docs: update copyright date to the year 2025 Thomas Huth
2025-01-02 10:31 ` [PULL 02/10] tests/functional: Convert the vnc test Thomas Huth
2025-01-02 10:31 ` [PULL 03/10] tests/functional/test_vnc: Do not use a hard-coded VNC port Thomas Huth
2025-01-02 10:31 ` [PULL 04/10] tests/functional/test_vnc: Remove the test_no_vnc test Thomas Huth
2025-01-02 10:31 ` [PULL 05/10] tests/functional: Extract the find_free_ports() function into a helper file Thomas Huth
2025-01-02 10:31 ` Thomas Huth [this message]
2025-01-02 10:31 ` [PULL 07/10] tests/functional/test_ppc64_hv: Update repo management Thomas Huth
2025-01-02 10:31 ` [PULL 08/10] tests/functional/test_ppc64_hv: Update to Alpine 3.21.0 Thomas Huth
2025-01-02 10:31 ` [PULL 09/10] tests/functional/test_rx_gdbsim: Use stable URL for test_linux_sash Thomas Huth
2025-01-02 10:31 ` [PULL 10/10] tests/functional/test_arm_quanta_gsj: Fix broken test Thomas Huth
2025-01-03 0:52 ` [PULL 00/10] Functional test improvements and fixes Stefan Hajnoczi
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=20250102103138.354618-7-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.