Skip to contentSkip to conversation

support/scripts/boot-qemu-image.py: wait before using expect

PATCH Superseded Romain Naour 2 participants 5 messages Apr 17, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/scripts/boot-qemu-image.py: wait before using expect

As reported by a gitlab runtime test [1] and on the mailing list [2], some runtime tests are failing on slow host machines when the qemu-system-<arch> is missing on the host.

The boot-qemu-image.py script need to wait some time after calling pexpect.spawn() in order to make sure that the qemu process has been executed in start-qemu.sh.

If start-qemu.sh failed due to missing qemu-system binary an exception will be thrown by child.expect() and catched by the error handling (pexpect.EOF).

Thanks to Yann for the help while investigating the issue.

Tested:
https://gitlab.com/kubu93/buildroot/pipelines/136431059

[1] https://gitlab.com/kubu93/buildroot/pipelines/135487475
[2] http://lists.busybox.net/pipermail/buildroot/2020-April/280037.html

Fixes:
https://gitlab.com/kubu93/buildroot/-/jobs/509053135

---
 support/scripts/boot-qemu-image.py | 5 +++++
 1 file changed, 5 insertions(+)
support/scripts/boot-qemu-image.py +5 -0
index 2c1afba398..721bc38ecc 100755
@@ -5,6 +5,7 @@
 import pexpect
 import sys
 import os
+import time
 
 
 def main():
@@ -26,6 +27,10 @@ def main():
     # We want only stdout into the log to avoid double echo
     child.logfile = sys.stdout
 
+    # Let the spawn actually try to fork+exec to the wrapper, and then
+    # let the wrapper exec the qemu process.
+    time.sleep(5)
+
     try:
         child.expect(["buildroot login:", pexpect.TIMEOUT], timeout=60)
     except pexpect.EOF as e:
Signature · 1 line
2.25.2
#1 lore raw

PATCH 1/1 support/testing: import rootfs-overlay for systemd testsuite

comment PS1 customization: the testsuite require a non customized PS1

 # /usr/lib/systemd/tests/run-unit-tests.py
 PASS: test-acl-util
 PASS: test-af-list

La testsuite Buildroot se lance de cette mani?re et seul le test systemd est test?:
./support/testing/run-tests -o testsuite/ -k -d dl/ tests.package.test_systemd.TestSystemd
16:12:42 TestSystemd Starting
16:13:04 TestSystemd Cleaning up
.
----------------------------------------------------------------------
Ran 1 test in 22.384s

OK

Pour l'instant la testsuite de systemd n'est pas lanc?e automatiquement. Il faut lancer le script:
/lib/systemd/tests/run-unit-tests.py

On a besoin d'un niveau d'entropie suffisant pour certain tests. On test avec cgroupv2
On test avec un kernel 5.4 LTS.

SKIP: test-barrier
SKIP: test-bus-chat

FAIL: test-execute

OK: 197 SKIP: 2 FAIL: 1

---
 .../package/br2-external/systemd/Config.in    |   0
 .../br2-external/systemd/external.desc        |   2 +
 .../package/br2-external/systemd/external.mk  |   5 +
 support/testing/tests/package/test_systemd.py |  92 +++++++++++++++
 .../rootfs-overlay/etc/locale.conf            |   1 +
 .../rootfs-overlay/etc/nsswitch.conf          |  13 ++
 .../test_systemd/rootfs-overlay/etc/profile   |  20 ++++
 .../test_systemd/rootfs-overlay/etc/shells    |   1 +
 .../rootfs-overlay/etc/vconsole.conf          |   1 +
 .../test_systemd/rootfs-overlay/myinit.sh     |   3 +
 .../test_systemd/rootfs-overlay/root/.profile |  36 ++++++
 .../test_systemd/systemd-kernel.config        | 111 ++++++++++++++++++
 12 files changed, 285 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/systemd/Config.in
 create mode 100644 support/testing/tests/package/br2-external/systemd/external.desc
 create mode 100644 support/testing/tests/package/br2-external/systemd/external.mk
 create mode 100644 support/testing/tests/package/test_systemd.py
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/etc/locale.conf
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/etc/nsswitch.conf
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/etc/profile
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/etc/shells
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/etc/vconsole.conf
 create mode 100755 support/testing/tests/package/test_systemd/rootfs-overlay/myinit.sh
 create mode 100644 support/testing/tests/package/test_systemd/rootfs-overlay/root/.profile
 create mode 100644 support/testing/tests/package/test_systemd/systemd-kernel.config
support/testing/tests/package/br2-external/systemd/Config.in new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
support/testing/tests/package/br2-external/systemd/external.desc new file +2 -0
new file mode 100644
index 0000000000..2c7317f301
@@ -0,0 +1,2 @@
+name: BUILDROOT_SYSTEMD_TESTSUITE
+desc: Buildroot to easily test systemd changes or changes to the systemd recipe in buildroot
support/testing/tests/package/br2-external/systemd/external.mk new file +5 -0
new file mode 100644
index 0000000000..780d79153b
@@ -0,0 +1,5 @@
+# Append SYSTEMD_CONF_OPTS from this BR2_EXTERNAL due to include order in the Buildroot main Makefile:
+# -include $(PACKAGE_OVERRIDE_FILE)
+# -include $(sort $(wildcard package/*/*.mk))
+# include $(BR2_EXTERNAL_FILE)
+SYSTEMD_CONF_OPTS += -Dslow-tests=true -Dinstall-tests=true -Dtests=true
support/testing/tests/package/test_systemd.py new file +92 -0

92 lines not on this page · raw message

support/testing/tests/package/test_systemd/rootfs-overlay/etc/locale.conf new file +1 -0
new file mode 100644
index 0000000000..e4026ae2be
@@ -0,0 +1 @@
+LANG=fr_FR.utf8
support/testing/tests/package/test_systemd/rootfs-overlay/etc/nsswitch.conf new file +13 -0
new file mode 100644
index 0000000000..48c6200f3d
@@ -0,0 +1,13 @@
+# /etc/nsswitch.conf
+
+passwd:         files mymachines systemd
+group:          files mymachines systemd
+shadow:         files
+
+hosts:          files mymachines resolve [!UNAVAIL=return] dns myhostname
+networks:       files dns
+
+protocols:      files
+services:       files
+ethers:         files
+rpc:            files
support/testing/tests/package/test_systemd/rootfs-overlay/etc/profile new file +20 -0
new file mode 100644
index 0000000000..ca7565fd5b
@@ -0,0 +1,20 @@
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+if [ "$PS1" ]; then
+	if [ "`id -u`" -eq 0 ]; then
+		export PS1='# '
+	else
+		export PS1='$ '
+	fi
+fi
+
+#export PAGER='/bin/more '
+export EDITOR='/bin/vi'
+
+# Source configuration files from /etc/profile.d
+for i in /etc/profile.d/*.sh ; do
+	if [ -r "$i" ]; then
+		. $i
+	fi
+	unset i
+done
support/testing/tests/package/test_systemd/rootfs-overlay/etc/shells new file +1 -0
new file mode 100644
index 0000000000..01dca2d74b
@@ -0,0 +1 @@
+/bin/bash
support/testing/tests/package/test_systemd/rootfs-overlay/etc/vconsole.conf new file +1 -0
new file mode 100644
index 0000000000..dfbf4a6eba
@@ -0,0 +1 @@
+KEYMAP=fr
support/testing/tests/package/test_systemd/rootfs-overlay/myinit.sh new file +3 -0
new file mode 100755
index 0000000000..203a557743
@@ -0,0 +1,3 @@
+#!/bin/sh
+mount -o rw /dev/vdb /var
+exec /usr/lib/systemd/systemd
support/testing/tests/package/test_systemd/rootfs-overlay/root/.profile new file +36 -0
new file mode 100644
index 0000000000..1415d1062a
@@ -0,0 +1,36 @@
+# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
+# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
+
+if [ "`id -u`" -eq 0 ]; then
+  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+else
+  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
+fi
+export PATH
+
+if [ "${PS1-}" ]; then
+  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
+    # The file bash.bashrc already sets the default PS1.
+    # PS1='\h:\w\$ '
+    if [ -f /etc/bash.bashrc ]; then
+      . /etc/bash.bashrc
+    fi
+  else
+    if [ "`id -u`" -eq 0 ]; then
+      PS1='# '
+    else
+      PS1='$ '
+    fi
+  fi
+fi
+
+#PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
+if [ -d /etc/profile.d ]; then
+  for i in /etc/profile.d/*.sh; do
+    if [ -r $i ]; then
+      . $i
+    fi
+  done
+  unset i
+fi
+. /usr/share/bash-completion/bash_completion
support/testing/tests/package/test_systemd/systemd-kernel.config new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.25.2
#2 lore raw

PATCH 1/1 support/testing: import rootfs-overlay for systemd testsuite

Hello,

Oops, there is some spoil about my current work on the qemu runtime testing with Buildroot :)

This patch is a WIP and not intended to be published yet on the mailing list, please ignore.

Best regards,
Romain

#3 lore raw

PATCH 1/1 package/qemu: enable or1k support in host-qemu

In reply to Romain Naour

This change enables host qemu support for or1k which among other things allows to test this architecture in gitlab.

The or1k support was nammed or32 in qemu < 2.9.0 and renamed or1k by [1]. But only the qemu 4.2.0 has been tested with qemu_or1k_defconfig.
So we may consider the or1k support was added by [1].

Tested using qemu_or1k_defconfig.

[1] https://git.qemu.org/?p=qemu.git;a=commit;h=4a09d0bb34ab030e09e87173b2e3ec0fd7616cff

---
 package/qemu/Config.in.host | 1 +
 package/qemu/qemu.mk        | 1 +
 2 files changed, 2 insertions(+)
package/qemu/Config.in.host +1 -0
index ea9281c5fb..5ed160159a 100644
@@ -11,6 +11,7 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 	default y if BR2_mips
 	default y if BR2_mipsel
 	default y if BR2_nios2
+	default y if BR2_or1k
 	default y if BR2_powerpc
 	default y if BR2_powerpc64
 	default y if BR2_powerpc64le
package/qemu/qemu.mk +1 -0
index 712491a208..e8b43d3b36 100644
@@ -199,6 +199,7 @@ HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman host-p
 #       mips64          mips64
 #       mips64el        mips64el
 #       nios2           nios2
+#       or1k            or1k
 #       powerpc         ppc
 #       powerpc64       ppc64
 #       powerpc64le     ppc64 (system) / ppc64le (usermode)
Signature · 1 line
2.25.2
#4 lore raw

PATCH 1/1 package/qemu: enable or1k support in host-qemu

Quoted 7 lines · On Fri, 17 Apr 2020 22:16:26 +0200 Romain Naour <[email protected]> wrote:

This change enables host qemu support for or1k which among other things allows to test this architecture in gitlab.

The or1k support was nammed or32 in qemu < 2.9.0 and renamed or1k by [1]. But only the qemu 4.2.0 has been tested with qemu_or1k_defconfig.
So we may consider the or1k support was added by [1].

I was a bit confused by these last two sentences, and was not sure how relevant this was. I reworded this paragraph slightly and applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com