From 9a734700d714d799b5d42489071b0f7759552987 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Tue, 21 May 2024 21:44:41 +0200 Subject: [PATCH] support/testing: improve python-magic-wormhole test reliability The python-magic-wormhole runtime test can randomly fail on slow runners, see [1]. The issue is that the sending command is started first in background _without_ redirecting its output to /dev/null. The receiving command is started after, expecting the message to be printed on the first standard output line. On slower systems, the sending command still print messages while the test controller expect output from the receiving command. The expected string finally appear, but not on the first line. This makes the test fail. This commit fixes the issue by redirecting all outputs (stdout, stderr) of the sending command to /dev/null. To help even more, the sleep time is moved from the emulator to the test controller. The sleep time is also multiplied by the timeout_multiplier. Fixes: [1] [1] https://gitlab.com/buildroot.org/buildroot/-/jobs/6888691508 Signed-off-by: Julien Olivain Signed-off-by: Romain Naour --- .../tests/package/test_python_magic_wormhole.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/support/testing/tests/package/test_python_magic_wormhole.py b/support/testing/tests/package/test_python_magic_wormhole.py index 5a0f0277b0..180cff2e4a 100644 --- a/support/testing/tests/package/test_python_magic_wormhole.py +++ b/support/testing/tests/package/test_python_magic_wormhole.py @@ -1,4 +1,5 @@ import os +import time from tests.package.test_python import TestPythonPackageBase @@ -46,9 +47,12 @@ class TestPythonPy3MagicWormhole(TestPythonPackageBase): wormhole_cmd = "wormhole --relay-url={} --transit-helper={}".format( relay_url, transit_helper) - cmd = wormhole_cmd + " send --code={} --text=\"{}\" & ".format(code, text) - cmd += "sleep 25" - self.assertRunOk(cmd, timeout=30) + cmd = wormhole_cmd + cmd += f" send --code={code} --text=\"{text}\"" + cmd += " &> /dev/null &" + self.assertRunOk(cmd) + + time.sleep(30 * self.timeout_multiplier) wormhole_env = "_MAGIC_WORMHOLE_TEST_KEY_TIMER=100 " wormhole_env += "_MAGIC_WORMHOLE_TEST_VERIFY_TIMER=100 "