All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PULL 6/6] tests/functional: remove heuristics for finding build dir
Date: Mon, 23 Mar 2026 11:29:20 +0100	[thread overview]
Message-ID: <20260323102920.25170-7-thuth@redhat.com> (raw)
In-Reply-To: <20260323102920.25170-1-thuth@redhat.com>

From: Daniel P. Berrangé <berrange@redhat.com>

Currently some heuristics are used to locate the build dir, if the
MESON_BUILD_ROOT environment variable is not set. These are not
entirely accurate, however, especially if the developer is using
nested sub-dirs under $PWD/build/...

Since the introduction of the 'run' script, we can ensure any
direct execution of the tests will have MESON_BUILD_ROOT set.

Meanwhile when meson runs the test it will also have this env
set. The only gap is when running pre-caching, and that is easily
fixed to set MESON_BUILD_ROOT.

It can thus be assumed that MESON_BUILD_ROOT will always be set
in any supported execution scenario, which allows the heuristics
to be removed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260310114756.146083-3-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/meson.build         |  1 +
 tests/functional/qemu_test/config.py | 11 +++--------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 0f7c90bed0f..3b42299e7ce 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -96,6 +96,7 @@ foreach speed : ['quick', 'thorough']
       teststamp = testname + '.tstamp'
       test_precache_env = environment()
       test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
+      test_precache_env.set('MESON_BUILD_ROOT', meson.project_build_root())
       test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
                                           meson.current_source_dir())
       precache = custom_target('func-precache-' + testname,
diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
index 0192027233e..e0893f630ee 100644
--- a/tests/functional/qemu_test/config.py
+++ b/tests/functional/qemu_test/config.py
@@ -24,15 +24,10 @@ def _build_dir():
     root = os.getenv('MESON_BUILD_ROOT')
     if root is not None:
         return Path(root)
-    # Makefile.mtest only exists in build dir, so if it is available, use CWD
-    if os.path.exists('Makefile.mtest'):
-        return Path(os.getcwd())
 
-    root = os.path.join(_source_dir(), 'build')
-    if os.path.exists(root):
-        return Path(root)
-
-    raise Exception("Cannot identify build dir, set MESON_BUILD_ROOT")
+    raise Exception("Missing MESON_BUILD_ROOT environment variable. " +
+                    "Please use the '<BUILD-DIR>/run' script if invoking " +
+                    "directly instead of via make/meson")
 
 BUILD_DIR = _build_dir()
 
-- 
2.53.0



  parent reply	other threads:[~2026-03-23 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 10:29 [PULL 0/6] Various fixes for QEMU v11.0-rc1 Thomas Huth
2026-03-23 10:29 ` [PULL 1/6] hw/pci-host/raven: Fix crash when introspecting raven-pcihost from the CLI Thomas Huth
2026-03-23 10:29 ` [PULL 2/6] hw/display/cg3: Fix crash when introspecting cgthree " Thomas Huth
2026-03-23 10:29 ` [PULL 3/6] hw/sparc/sun4m_iommu: Fix crash when introspecting sun4m-iommu " Thomas Huth
2026-03-23 10:29 ` [PULL 4/6] hw/sparc64/sun4u_iommu: Fix crash when introspecting sun4u-iommu " Thomas Huth
2026-03-23 10:29 ` [PULL 5/6] tests/functional: fix log placement when run directly Thomas Huth
2026-03-23 10:29 ` Thomas Huth [this message]
2026-03-23 12:42 ` [PULL 0/6] Various fixes for QEMU v11.0-rc1 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260323102920.25170-7-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.