From 3815e0b5cfeb228bf466c2533134551b17bf5dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 6 Aug 2020 03:27:40 +0200 Subject: [PATCH] tests: make qvm-sync-clock test more reliable Compare the time with the "current" time retrieved from ClockVM just before comparing, not with the test start time. This should work even if the test machine is quite slow (test taking more than 30s). --- qubes/tests/integ/vm_qrexec_gui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qubes/tests/integ/vm_qrexec_gui.py b/qubes/tests/integ/vm_qrexec_gui.py index dba1fccb..28cab2db 100644 --- a/qubes/tests/integ/vm_qrexec_gui.py +++ b/qubes/tests/integ/vm_qrexec_gui.py @@ -399,10 +399,13 @@ class TC_00_AppVMMixin(object): self.assertEqual(p.returncode, 0) vm_time, _ = self.loop.run_until_complete( self.testvm2.run_for_stdio('date -u +%s')) - self.assertAlmostEquals(int(vm_time), int(start_time), delta=30) + # get current time + current_time, _ = self.loop.run_until_complete( + self.testvm1.run_for_stdio('date -u +%s')) + self.assertAlmostEquals(int(vm_time), int(current_time), delta=30) dom0_time = subprocess.check_output(['date', '-u', '+%s']) - self.assertAlmostEquals(int(dom0_time), int(start_time), delta=30) + self.assertAlmostEquals(int(dom0_time), int(current_time), delta=30) except: # reset time to some approximation of the real time