[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/29] tests: run 'device-crash-test' from tests/venv
From: |
Paolo Bonzini |
Subject: |
[PULL 26/29] tests: run 'device-crash-test' from tests/venv |
Date: |
Mon, 6 Jun 2022 16:36:41 +0200 |
From: John Snow <jsnow@redhat.com>
Remove the sys.path hacking from device-crash-test, and add in a little
user-friendly message for anyone who was used to running this script
directly from the source tree.
Modify the GitLab job recipes to create the tests/venv first, then run
device-crash-test from that venv.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220526000921.1581503-10-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitlab-ci.d/buildtest.yml | 8 +++++---
scripts/device-crash-test | 14 +++++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index ecac3ec50c..544385f5be 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -110,7 +110,8 @@ crash-test-debian:
IMAGE: debian-amd64
script:
- cd build
- - scripts/device-crash-test -q ./qemu-system-i386
+ - make check-venv
+ - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-i386
build-system-fedora:
extends: .native_build_job_template
@@ -155,8 +156,9 @@ crash-test-fedora:
IMAGE: fedora
script:
- cd build
- - scripts/device-crash-test -q ./qemu-system-ppc
- - scripts/device-crash-test -q ./qemu-system-riscv32
+ - make check-venv
+ - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
+ - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
build-system-centos:
extends: .native_build_job_template
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index a203b3fdea..73bcb98693 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -33,10 +33,18 @@ import re
import random
import argparse
from itertools import chain
+from pathlib import Path
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.machine import QEMUMachine
-from qemu.qmp import ConnectError
+try:
+ from qemu.machine import QEMUMachine
+ from qemu.qmp import ConnectError
+except ModuleNotFoundError as exc:
+ path = Path(__file__).resolve()
+ print(f"Module '{exc.name}' not found.")
+ print(" Try 'make check-venv' from your build directory,")
+ print(" and then one way to run this script is like so:")
+ print(f' > $builddir/tests/venv/bin/python3 "{path}"')
+ sys.exit(1)
logger = logging.getLogger('device-crash-test')
dbg = logger.debug
--
2.36.1
- [PULL 18/29] python: update for mypy 0.950, (continued)
- [PULL 18/29] python: update for mypy 0.950, Paolo Bonzini, 2022/06/06
- [PULL 01/29] target/i386/tcg: Fix masking of real-mode addresses with A20 bit, Paolo Bonzini, 2022/06/06
- [PULL 08/29] replay: rewrite async event handling, Paolo Bonzini, 2022/06/06
- [PULL 15/29] tests/Makefile.include: Fix 'make check-help' output, Paolo Bonzini, 2022/06/06
- [PULL 20/29] tests: use python3 as the python executable name, Paolo Bonzini, 2022/06/06
- [PULL 19/29] tests: add "TESTS_PYTHON" variable to Makefile, Paolo Bonzini, 2022/06/06
- [PULL 11/29] docs: move replay docs to docs/system/replay.rst, Paolo Bonzini, 2022/06/06
- [PULL 22/29] tests: add quiet-venv-pip macro, Paolo Bonzini, 2022/06/06
- [PULL 23/29] tests: install "qemu" namespace package into venv, Paolo Bonzini, 2022/06/06
- [PULL 24/29] tests: use tests/venv to run basevm.py-based scripts, Paolo Bonzini, 2022/06/06
- [PULL 26/29] tests: run 'device-crash-test' from tests/venv,
Paolo Bonzini <=
- [PULL 21/29] tests: silence pip upgrade warnings during venv creation, Paolo Bonzini, 2022/06/06
- [PULL 16/29] x86: cpu: make sure number of addressable IDs for processor cores meets the spec, Paolo Bonzini, 2022/06/06
- [PULL 25/29] tests: add python3-venv to debian10.docker, Paolo Bonzini, 2022/06/06
- [PULL 28/29] configure: remove reference to removed option, Paolo Bonzini, 2022/06/06
- [PULL 27/29] regenerate meson-buildoptions.sh, Paolo Bonzini, 2022/06/06
- [PULL 29/29] meson: qga: do not use deprecated meson.build_root(), Paolo Bonzini, 2022/06/06
- [PULL 12/29] tests/avocado: update replay_linux test, Paolo Bonzini, 2022/06/06
- Re: [PULL 00/29] Misc patches for 2022-06-06, Richard Henderson, 2022/06/06