From 81e6cc6d0b9ae24872b30ceeca64295314efb79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCchse?= Date: Sun, 25 Jan 2026 13:11:28 +0100 Subject: [PATCH 1/2] Fix/improve flakiness of scs-0101 tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The console output inside the VM is quite easily disrupted by concurrent processes. This makes finding the relevant output quite complicated. The heuristics for this task was not optimal; let's hope this one is better. Signed-off-by: Matthias Büchse --- Tests/iaas/scs_0101_entropy/entropy_check.py | 34 +++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Tests/iaas/scs_0101_entropy/entropy_check.py b/Tests/iaas/scs_0101_entropy/entropy_check.py index a3c3239d7..e800ab822 100644 --- a/Tests/iaas/scs_0101_entropy/entropy_check.py +++ b/Tests/iaas/scs_0101_entropy/entropy_check.py @@ -33,6 +33,8 @@ TIMEOUT = 5 * 60 # timeout in seconds after which we no longer wait for the VM to complete the run MARKER = '_scs-test-' # NOTE we mask serial-getty@ttyS0.service because the login prompt messes up the console output that we want to parse +# NOTE we use awk to prefix each relevant line so we can find it easily later +# NOTE we use >- to indicate that the following line is a string (that may contain colons), and newlines should be stripped SERVER_USERDATA_GENERIC = """ #cloud-config # apt-placeholder @@ -41,10 +43,14 @@ bootcmd: - systemctl mask serial-getty@ttyS0.service runcmd: - - echo '_scs-test-entropy-avail'; cat /proc/sys/kernel/random/entropy_avail - - echo '_scs-test-fips-test'; cat /dev/random | rngtest -c 1000 - - echo '_scs-test-rngd'; sudo systemctl status rngd - - echo '_scs-test-virtio-rng'; cat /sys/devices/virtual/misc/hw_random/rng_available; sudo /bin/sh -c 'od -vAn -N2 -tu2 < /dev/hwrng' + - >- + cat /proc/sys/kernel/random/entropy_avail | awk '$0="_scs-test-entropy-avail: "$0' + - >- + cat /dev/random | rngtest -c 1000 2>&1 | awk '$0="_scs-test-fips-test: "$0' + - >- + sudo systemctl status rngd 2>&1 | awk '$0="_scs-test-rngd: "$0' + - >- + cat /sys/devices/virtual/misc/hw_random/rng_available 2>&1 | awk '$0="_scs-test-virtio-rng: "$0'; sudo /bin/sh -c 'od -vAn -N2 -tu2 < /dev/hwrng' 2>&1 | awk '$0="_scs-test-virtio-rng: "$0' - echo '_scs-test-end' final_message: "_scs-test-end" """.strip() @@ -338,23 +344,21 @@ def compute_canonical_image(all_images): def _convert_to_collected(lines, marker=MARKER): - # parse lines from console output - # removing any "indent", stuff that looks like '[ 70.439502] cloud-init[513]: ' - # NOTE this logic can fail when something (such as a login prompt) messes up the console output - # therefore we disable the corresponding service (see cloud-init) + """parse `lines` from console output""" + # Each line usually starts with something like '[ 70.439502] cloud-init[513]: '; + # HOWEVER, concurrent processes can easily disturb this pattern, so we use a + # unique prefix on each line ourselves. section = None indent = 0 collected = {} for line in lines: idx = line.find(marker) - if idx != -1: - section = line[idx + len(marker):].strip() - if section == 'end': - section = None - indent = idx + if idx == -1: continue - if section: - collected.setdefault(section, []).append(line[indent:]) + section, *payload = line[idx + len(marker):].split(':', 1) + if not payload: + continue + collected.setdefault(section, []).append(payload[0].strip()) return collected From 4a0748f070618576b6d0eb9ff7e45878298e3bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCchse?= Date: Sun, 25 Jan 2026 13:18:51 +0100 Subject: [PATCH 2/2] Acquiesce flake8 by removing unused local MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Büchse --- Tests/iaas/scs_0101_entropy/entropy_check.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/iaas/scs_0101_entropy/entropy_check.py b/Tests/iaas/scs_0101_entropy/entropy_check.py index e800ab822..7405463fe 100644 --- a/Tests/iaas/scs_0101_entropy/entropy_check.py +++ b/Tests/iaas/scs_0101_entropy/entropy_check.py @@ -349,7 +349,6 @@ def _convert_to_collected(lines, marker=MARKER): # HOWEVER, concurrent processes can easily disturb this pattern, so we use a # unique prefix on each line ourselves. section = None - indent = 0 collected = {} for line in lines: idx = line.find(marker)