[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 18/29] tests/functional: remove hacky sleep from the tests
From: |
Alex Bennée |
Subject: |
[PATCH v3 18/29] tests/functional: remove hacky sleep from the tests |
Date: |
Tue, 7 Jan 2025 16:51:56 +0000 |
We have proper detection of prompts now so we don't need to guess with
sleep() sprinkled through the test. The extra step of calling halt is
just to flush the final bits of the log (although the last line is
still missed).
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
v2
- avoid long lines by iterating through an array
- drop time import
v3
- fix up on re-base
- drop stray import os that had sneaked in
---
tests/functional/test_aarch64_virt.py | 32 +++++++++++++++------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/tests/functional/test_aarch64_virt.py
b/tests/functional/test_aarch64_virt.py
index 08576b0694..2d9995a95d 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -10,12 +10,12 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
-import time
import logging
from subprocess import check_call, DEVNULL
from qemu_test import QemuSystemTest, Asset
-from qemu_test import exec_command, wait_for_console_pattern
+from qemu_test import exec_command_and_wait_for_pattern
+from qemu_test import wait_for_console_pattern
from qemu_test import get_qemu_img
@@ -107,18 +107,22 @@ def common_aarch64_virt(self, machine):
'virtio-blk-device,drive=scratch')
self.vm.launch()
- self.wait_for_console_pattern('Welcome to Buildroot')
- time.sleep(0.1)
- exec_command(self, 'root')
- time.sleep(0.1)
- exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4')
- time.sleep(0.1)
- exec_command(self, 'md5sum /dev/vda')
- time.sleep(0.1)
- exec_command(self, 'cat /proc/interrupts')
- time.sleep(0.1)
- exec_command(self, 'cat /proc/self/maps')
- time.sleep(0.1)
+
+ ps1='#'
+ self.wait_for_console_pattern('login:')
+
+ commands = [
+ ('root', ps1),
+ ('cat /proc/interrupts', ps1),
+ ('cat /proc/self/maps', ps1),
+ ('uname -a', ps1),
+ ('dd if=/dev/hwrng of=/dev/vda bs=512 count=4', ps1),
+ ('md5sum /dev/vda', ps1),
+ ('halt -n', 'reboot: System halted')
+ ]
+
+ for cmd, pattern in commands:
+ exec_command_and_wait_for_pattern(self, cmd, pattern)
def test_aarch64_virt_gicv3(self):
self.common_aarch64_virt("virt,gic_version=3")
--
2.39.5
- Re: [PATCH v3 16/29] tests/qtest: remove clock_steps from virtio tests, (continued)
- [PATCH v3 22/29] tests/docker: move riscv64 cross container from sid to trixie, Alex Bennée, 2025/01/07
- [PATCH v3 25/29] tests/vm: partially un-tabify help output, Alex Bennée, 2025/01/07
- [PATCH v3 28/29] dockerfiles: Remove 'MAINTAINER' entry in debian-tricore-cross.docker, Alex Bennée, 2025/01/07
- [PATCH v3 24/29] tests/vm: fix build_path based path, Alex Bennée, 2025/01/07
- [PATCH v3 29/29] MAINTAINERS: Remove myself from reviewers, Alex Bennée, 2025/01/07
- [PATCH v3 13/29] tests/functional: update the sparc64 tuxrun tests, Alex Bennée, 2025/01/07
- [PATCH v3 21/29] tests/lcitool: bump to latest version of libvirt-ci, Alex Bennée, 2025/01/07
- [PATCH v3 23/29] tests/lcitool: remove temp workaround for debian mips64el, Alex Bennée, 2025/01/07
- [PATCH v3 17/29] system/qtest: properly feedback results of clock_[step|set], Alex Bennée, 2025/01/07
- [PATCH v3 18/29] tests/functional: remove hacky sleep from the tests,
Alex Bennée <=
- [PATCH v3 20/29] tests/functional: extend test_aarch64_virt with vulkan test, Alex Bennée, 2025/01/07
- [PATCH v3 19/29] tests/functional: add zstd support to uncompress utility, Alex Bennée, 2025/01/07