aboutsummaryrefslogtreecommitdiff
path: root/scripts/device-crash-test
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2022-05-25 20:09:21 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-06 09:26:54 +0200
commit1d8cf47e5b8b4faa95954824cb6610d81c50d7d2 (patch)
treebd84458af018dc481f700f52020a25d418deb62c /scripts/device-crash-test
parente184036a0e12cbfb8980362cd4de18268b4d0c38 (diff)
downloadqemu-1d8cf47e5b8b4faa95954824cb6610d81c50d7d2.zip
qemu-1d8cf47e5b8b4faa95954824cb6610d81c50d7d2.tar.gz
qemu-1d8cf47e5b8b4faa95954824cb6610d81c50d7d2.tar.bz2
tests: run 'device-crash-test' from tests/venv
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>
Diffstat (limited to 'scripts/device-crash-test')
-rwxr-xr-xscripts/device-crash-test16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index a203b3f..73bcb98 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
-
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.machine import QEMUMachine
-from qemu.qmp import ConnectError
+from pathlib import Path
+
+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