From 0f7fa6ffd43b50b0b753bebe933060fd274eb083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Mon, 20 Jan 2025 14:25:29 +0100 Subject: [PATCH] tests: wait for /dev/ptp0 to appear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have sometimes seen that this test can fail. In theory it could happen that udev has not created the /dev/ptp0 file before we run the ssh command. So let's wait in udev for the device to appear up to 5 seconds. Signed-off-by: Pablo Barbáchano --- tests/integration_tests/functional/test_kvm_ptp.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/integration_tests/functional/test_kvm_ptp.py b/tests/integration_tests/functional/test_kvm_ptp.py index 70b5bb877bc..4b44ca124eb 100644 --- a/tests/integration_tests/functional/test_kvm_ptp.py +++ b/tests/integration_tests/functional/test_kvm_ptp.py @@ -6,19 +6,18 @@ import pytest -def test_kvm_ptp(uvm_plain_any): +def test_kvm_ptp(uvm_any_booted): """Test kvm_ptp is usable""" - vm = uvm_plain_any + vm = uvm_any_booted if vm.guest_kernel_version[:2] < (6, 1): pytest.skip("Only supported in kernel 6.1 and after") - vm.spawn() - vm.basic_config(vcpu_count=2, mem_size_mib=256) - vm.add_net_iface() - vm.start() + _, dmesg, _ = vm.ssh.check_output("dmesg |grep -i ptp") + assert "PTP clock support registered" in dmesg - vm.ssh.check_output("[ -c /dev/ptp0 ]") + # wait up to 5s to see the PTP device + vm.ssh.check_output("udevadm wait -t 5 /dev/ptp0") # phc_ctl[14515.127]: clock time is 1697545854.728335694 or Tue Oct 17 12:30:54 2023 vm.ssh.check_output("phc_ctl /dev/ptp0 -- get")