Skip to content

Commit 994198b

Browse files
committed
tests: wait for /dev/ptp0 to appear
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 <pablob@amazon.com>
1 parent 2b3ec74 commit 994198b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/integration_tests/functional/test_kvm_ptp.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@
66
import pytest
77

88

9-
def test_kvm_ptp(uvm_plain_any):
9+
def test_kvm_ptp(uvm_any_booted):
1010
"""Test kvm_ptp is usable"""
1111

12-
vm = uvm_plain_any
12+
vm = uvm_any_booted
1313
if vm.guest_kernel_version[:2] < (6, 1):
1414
pytest.skip("Only supported in kernel 6.1 and after")
1515

16-
vm.spawn()
17-
vm.basic_config(vcpu_count=2, mem_size_mib=256)
18-
vm.add_net_iface()
19-
vm.start()
16+
_, dmesg, _ = vm.ssh.check_output("dmesg |grep -i ptp")
17+
assert "PTP clock support registered" in dmesg
2018

21-
vm.ssh.check_output("[ -c /dev/ptp0 ]")
19+
# wait up to 5s to see the PTP device
20+
vm.ssh.check_output("udevadm wait -t 5 /dev/ptp0")
2221

2322
# phc_ctl[14515.127]: clock time is 1697545854.728335694 or Tue Oct 17 12:30:54 2023
2423
vm.ssh.check_output("phc_ctl /dev/ptp0 -- get")

0 commit comments

Comments
 (0)