diff mbox series

[2/2] bitbake-selftest: setup: default to cwd for top-dir-prefix

Message ID 20251112220301.3651499-2-adrian.freihofer@siemens.com
State New
Headers show
Series [1/2] bitbake-setup: default top-dir-prefix to cwd | expand

Commit Message

AdrianF Nov. 12, 2025, 10:03 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Change to tempdir before the test starts. Then check if the tests run
from cwd which is now the default top-dir-prefix.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 lib/bb/tests/setup.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
index 6e9bf0365..73ba3b2bc 100644
--- a/lib/bb/tests/setup.py
+++ b/lib/bb/tests/setup.py
@@ -239,12 +239,15 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
         # check that --help works
         self.runbbsetup("--help")
 
-        # set up global location for top-dir-prefix
-        out = self.runbbsetup("settings set --global default top-dir-prefix {}".format(self.tempdir))
+        # change to self.tempdir to work with cwd-based default settings
+        os.chdir(self.tempdir)
+
+        # check that the default top-dir-prefix is cwd (now self.tempdir) with no global settings
+        out = self.runbbsetup("settings list")
+        self.assertIn("default top-dir-prefix {}".format(os.getcwd()), out[0])
+
+        # set up global location for dl-dir
         settings_path = "{}/global-config".format(self.tempdir)
-        self.assertIn(settings_path, out[0])
-        self.assertIn("From section 'default' the setting 'top-dir-prefix' was changed to", out[0])
-        self.assertIn("Settings written to".format(settings_path), out[0])
         out = self.runbbsetup("settings set --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
         self.assertIn("From section 'default' the setting 'dl-dir' was changed to", out[0])
         self.assertIn("Settings written to".format(settings_path), out[0])