@samitouri / QOSamiQemu / commits / dea076926b

tests/functional: fix log placement when run directly

When running functional tests directly there are some heuristics to figure out where the build directory lives, along with the possibility to override the logic by setting the QEMU_BUILD_DIR env variable. This env var is set as part of the test env when run via Meson but not when run directly. A particular flaw with the currently logic is that it silently uses the wrong location when the build directory is a sub-dir under "./build", which is a common usage scenario for some devs. With the recent introduction of the 'run' script, we now have the MESON_BUILD_ROOT env variable set unconditionally, so we can rely on that from the functional tests to get the correct location in all scenarios. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20260310114756.146083-2-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>

Daniel P. Berrangé committed Mar 10, 2026 at 11:47 UTC dea076926b1753b5ccb1181c4f6d92f0602512ea
2 files changed +3 -3
tests/functional/meson.build
+1 -1
@@ -75,7 +75,7 @@ foreach speed : ['quick', 'thorough']
75 test_deps += [qemu_img]
76 endif
77 test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
78 - test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
78 + test_env.set('MESON_BUILD_ROOT', meson.project_build_root())
79 test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
80 meson.current_source_dir())
81
tests/functional/qemu_test/config.py
+2 -2
@@ -21,7 +21,7 @@ def _source_dir():
21 return Path(__file__).parent.parent.parent.parent
22
23 def _build_dir():
24 - root = os.getenv('QEMU_BUILD_ROOT')
24 + root = os.getenv('MESON_BUILD_ROOT')
25 if root is not None:
26 return Path(root)
27 # Makefile.mtest only exists in build dir, so if it is available, use CWD
@@ -32,7 +32,7 @@ def _build_dir():
32 if os.path.exists(root):
33 return Path(root)
34
35 - raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT")
35 + raise Exception("Cannot identify build dir, set MESON_BUILD_ROOT")
36
37 BUILD_DIR = _build_dir()
38