[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/27] tests/functional: remove hacky sleep from the tests
From: |
Alex Bennée |
Subject: |
[PATCH v2 19/27] tests/functional: remove hacky sleep from the tests |
Date: |
Wed, 18 Dec 2024 16:20:55 +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>
---
v2
- avoid long lines by iterating through an array
- drop time import
---
tests/functional/test_aarch64_virt.py | 29 +++++++++++++++------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/tests/functional/test_aarch64_virt.py
b/tests/functional/test_aarch64_virt.py
index c967da41b4..453e84c39f 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -10,7 +10,6 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
-import time
import os
import logging
@@ -107,18 +106,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
- [PATCH v2 01/27] tests/functional: update the arm tuxrun tests, (continued)
- [PATCH v2 01/27] tests/functional: update the arm tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 14/27] tests/functional: update the x86_64 tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 11/27] tests/functional: update the riscv64 tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 10/27] tests/functional: update the riscv32 tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 15/27] tests/functional/aarch64: add tests for FEAT_RME, Alex Bennée, 2024/12/18
- [PATCH v2 09/27] tests/functional: update the ppc64 tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 12/27] tests/functional: update the s390x tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 19/27] tests/functional: remove hacky sleep from the tests,
Alex Bennée <=
- [PATCH v2 07/27] tests/functional: update the mips64el tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 24/27] tests/vm: fix build_path based path, Alex Bennée, 2024/12/18
- [PATCH v2 23/27] tests/lcitool: remove temp workaround for debian mips64el, Alex Bennée, 2024/12/18
- [PATCH v2 21/27] tests/lcitool: bump to latest version of libvirt-ci, Alex Bennée, 2024/12/18
- [PATCH v2 13/27] tests/functional: update the sparc64 tuxrun tests, Alex Bennée, 2024/12/18
- [PATCH v2 20/27] tests/functional: extend test_aarch64_virt with vulkan test, Alex Bennée, 2024/12/18