]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ci: Detect shell prompt with higher specificity
authorMichal Koutný <mkoutny@suse.com>
Mon, 21 Jun 2021 15:18:54 +0000 (17:18 +0200)
committerMichal Koutný <mkoutny@suse.com>
Wed, 4 Aug 2021 09:16:48 +0000 (11:16 +0200)
The current pattern '#' triggers on the openSUSE kernel version that is
printed early during boot when no actual prompt is ready
> [    0.000000] Linux version 5.12.10-1-default (geeko@buildhost) (gcc (SUSE Linux) 11.1.1 20210510 [revision 23855a176609fe8dda6abaf2b21846b4517966eb], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.36.1.20210326-4) #1 SMP Fri Jun 11 05:05:06 UTC 2021 (b92eaf7)

Instead wait for pattern that: a) should have fewer false positives, b)
still be with working on distro shells:

openSUSE (red color)
^[[1m^[[31mimage:~ #^[[m^O

arch
[root@image ~]#

debian
root@image:~#

ubuntu
root@image:~#

fedora
[root@image ~]#

.github/workflows/test_mkosi_boot.py

index 3418fd3a51398c6ab877fa03ea2536ab8f10eace..3ea769a69f151011e16c897de3f897793d6940f0 100755 (executable)
@@ -2,13 +2,15 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
 import pexpect
+import re
 import sys
 
 
 def run() -> None:
     p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=300)
 
-    p.expect("#")
+    # distro-independent root prompt
+    p.expect(re.compile("~[^#]{0,3}#"))
     p.sendline("systemctl poweroff")
 
     p.expect(pexpect.EOF)