Message ID | 20241105202039.2556992-1-ju.o@free.fr |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] support/testing/infra/emulator.py: add qemu version in run log | expand |
Hello Julien, All, Le 05/11/2024 à 21:20, Julien Olivain a écrit : > In some specific situations, there is subtle bugs which depends on a > specific Qemu emulator version and the code it runs. > > For example, EDK2 on Aarch64 could work with specific versions of Qemu, > EDK2 and ATF. See commit cc0823c2d "boot/edk2: bump to version > edk2-stable202405" [1]. > > Also, some Qemu bugs made the guest OS crash. See for example commit > 9534b9c00 "package/qemu: fix qemu 9.x issue for AArch32 Secure > PL1&0" [2]. > > Commit 0d4177598 "support/testing/infra/emulator.py: add build host > dir to qemu search path" added the ability for a runtime test to > select host-qemu in order to use it. It is also possible for a user > to use the "utils/run-tests" script on its host system providing its > own version of Qemu. The Buildroot CI can also use its Qemu version > included in the reference Docker image. > > This means the Qemu emulator for running a runtime test can be from > several sources: > - Buildroot Docker reference image, > - Buildroot host-qemu package version, > - Developer host OS qemu version. > > Those versions can also change in time. > > In order to help debugging of those subtle emulator bugs, this commit > adds a recording of the actual Qemu version used to run a test. > > [1] https://gitlab.com/buildroot.org/buildroot/-/commit/cc0823c2d14321b91b94801834050331f5ea28e1 > [2] https://gitlab.com/buildroot.org/buildroot/-/commit/9534b9c00c23cfd69a4e122c26fca9d3da93d329 > [3] https://gitlab.com/buildroot.org/buildroot/-/commit/0d4177598ce7e73f2b97ac58c21fb177343643e3 > > Signed-off-by: Julien Olivain <ju.o@free.fr> Nice commit log! Tested locally using the Buildroot Docker reference image: > emulator using qemu-system-arm version: QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-11+deb11u2) Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers Applied to master, thanks. Best regards, Romain > --- > support/testing/infra/emulator.py | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py > index 238e123302..ef5be2a19e 100644 > --- a/support/testing/infra/emulator.py > +++ b/support/testing/infra/emulator.py > @@ -116,15 +116,21 @@ class Emulator(object): > ldavg_str = f"{ldavg[0]:.2f}, {ldavg[1]:.2f}, {ldavg[2]:.2f}" > self.logfile.write(f"> host loadavg: {ldavg_str}\n") > self.logfile.write(f"> timeout multiplier: {self.timeout_multiplier}\n") > - self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd)) > + self.logfile.write(f"> emulator using {qemu_cmd[0]} version:\n") > host_bin = os.path.join(self.builddir, "host", "bin") > br_path = host_bin + os.pathsep + os.environ["PATH"] > + qemu_env = {"QEMU_AUDIO_DRV": "none", > + "PATH": br_path} > + pexpect.run(f"{qemu_cmd[0]} --version", > + encoding='utf-8', > + logfile=self.logfile, > + env=qemu_env) > + self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd)) > self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], > timeout=5 * self.timeout_multiplier, > encoding='utf-8', > codec_errors='replace', > - env={"QEMU_AUDIO_DRV": "none", > - "PATH": br_path}) > + env=qemu_env) > # We want only stdout into the log to avoid double echo > self.qemu.logfile_read = self.logfile >
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py index 238e123302..ef5be2a19e 100644 --- a/support/testing/infra/emulator.py +++ b/support/testing/infra/emulator.py @@ -116,15 +116,21 @@ class Emulator(object): ldavg_str = f"{ldavg[0]:.2f}, {ldavg[1]:.2f}, {ldavg[2]:.2f}" self.logfile.write(f"> host loadavg: {ldavg_str}\n") self.logfile.write(f"> timeout multiplier: {self.timeout_multiplier}\n") - self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd)) + self.logfile.write(f"> emulator using {qemu_cmd[0]} version:\n") host_bin = os.path.join(self.builddir, "host", "bin") br_path = host_bin + os.pathsep + os.environ["PATH"] + qemu_env = {"QEMU_AUDIO_DRV": "none", + "PATH": br_path} + pexpect.run(f"{qemu_cmd[0]} --version", + encoding='utf-8', + logfile=self.logfile, + env=qemu_env) + self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd)) self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], timeout=5 * self.timeout_multiplier, encoding='utf-8', codec_errors='replace', - env={"QEMU_AUDIO_DRV": "none", - "PATH": br_path}) + env=qemu_env) # We want only stdout into the log to avoid double echo self.qemu.logfile_read = self.logfile
In some specific situations, there is subtle bugs which depends on a specific Qemu emulator version and the code it runs. For example, EDK2 on Aarch64 could work with specific versions of Qemu, EDK2 and ATF. See commit cc0823c2d "boot/edk2: bump to version edk2-stable202405" [1]. Also, some Qemu bugs made the guest OS crash. See for example commit 9534b9c00 "package/qemu: fix qemu 9.x issue for AArch32 Secure PL1&0" [2]. Commit 0d4177598 "support/testing/infra/emulator.py: add build host dir to qemu search path" added the ability for a runtime test to select host-qemu in order to use it. It is also possible for a user to use the "utils/run-tests" script on its host system providing its own version of Qemu. The Buildroot CI can also use its Qemu version included in the reference Docker image. This means the Qemu emulator for running a runtime test can be from several sources: - Buildroot Docker reference image, - Buildroot host-qemu package version, - Developer host OS qemu version. Those versions can also change in time. In order to help debugging of those subtle emulator bugs, this commit adds a recording of the actual Qemu version used to run a test. [1] https://gitlab.com/buildroot.org/buildroot/-/commit/cc0823c2d14321b91b94801834050331f5ea28e1 [2] https://gitlab.com/buildroot.org/buildroot/-/commit/9534b9c00c23cfd69a4e122c26fca9d3da93d329 [3] https://gitlab.com/buildroot.org/buildroot/-/commit/0d4177598ce7e73f2b97ac58c21fb177343643e3 Signed-off-by: Julien Olivain <ju.o@free.fr> --- support/testing/infra/emulator.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)