aboutsummaryrefslogtreecommitdiff
path: root/scripts/device-crash-test
diff options
context:
space:
mode:
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 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
-
-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