diff mbox series

[v2,01/10] bitbake-setup: move the local source tests to the end

Message ID 20260106121033.3892596-1-alex.kanavin@gmail.com
State Accepted, archived
Commit ea760cda2aa8ec06cf5a0bbb8aeca66605d96456
Headers show
Series [v2,01/10] bitbake-setup: move the local source tests to the end | expand

Commit Message

Alexander Kanavin Jan. 6, 2026, 12:10 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

They are not a part of the main testing sequence, and logically
should not be in the middle of it.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 lib/bb/tests/setup.py | 56 +++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

Comments

Paul Barker Jan. 8, 2026, 3:17 p.m. UTC | #1
On Tue, 2026-01-06 at 13:10 +0100, Alexander Kanavin via
lists.openembedded.org wrote:
> From: Alexander Kanavin <alex@linutronix.de>
> 
> They are not a part of the main testing sequence, and logically
> should not be in the middle of it.
> 
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  lib/bb/tests/setup.py | 56 +++++++++++++++++++++----------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
> 
> diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
> index 933178c84..ad09913f4 100644
> --- a/lib/bb/tests/setup.py
> +++ b/lib/bb/tests/setup.py
> @@ -320,34 +320,6 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
>                  out = self.runbbsetup("update --update-bb-conf='yes'")
>                  self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
>  
> -        # check source overrides, local sources provided with symlinks, and custom setup dir name
> -        source_override_content = """
> -{
> -    "sources": {
> -        "test-repo": {
> -            "local": {
> -                "path": "."
> -            }
> -        }
> -    }
> -}"""
> -        override_filename = 'source-overrides.json'
> -        custom_setup_dir = 'special-setup-dir'
> -        self.add_file_to_testrepo(override_filename, source_override_content)
> -        out = self.runbbsetup("init --non-interactive --source-overrides {} --setup-dir-name {} test-config-1 gadget".format(os.path.join(self.testrepopath, override_filename), custom_setup_dir))
> -        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
> -        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
> -        self.assertTrue(os.path.islink(custom_layer_path))
> -        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
> -
> -        # same but use command line options to specify local overrides
> -        custom_setup_dir = 'special-setup-dir-with-cmdline-overrides'
> -        out = self.runbbsetup("init --non-interactive -L test-repo {} --setup-dir-name {} test-config-1 gadget".format(self.testrepopath, custom_setup_dir))
> -        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
> -        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
> -        self.assertTrue(os.path.islink(custom_layer_path))
> -        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
> -
>          # install buildtools
>          out = self.runbbsetup("install-buildtools")
>          self.assertIn("Buildtools installed into", out[0])
> @@ -428,3 +400,31 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
>              out = self.runbbsetup("update --update-bb-conf='no'")
>              sums_after = _conf_chksum(f"{setuppath}/build/conf")
>              self.assertEqual(sums_before, sums_after)
> +
> +        # check source overrides, local sources provided with symlinks, and custom setup dir name
> +        source_override_content = """
> +{
> +    "sources": {
> +        "test-repo": {
> +            "local": {
> +                "path": "."
> +            }
> +        }
> +    }
> +}"""
> +        override_filename = 'source-overrides.json'
> +        custom_setup_dir = 'special-setup-dir'
> +        self.add_file_to_testrepo(override_filename, source_override_content)
> +        out = self.runbbsetup("init --non-interactive --source-overrides {} --setup-dir-name {} test-config-1 gadget".format(os.path.join(self.testrepopath, override_filename), custom_setup_dir))
> +        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
> +        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
> +        self.assertTrue(os.path.islink(custom_layer_path))
> +        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
> +
> +        # same but use command line options to specify local overrides
> +        custom_setup_dir = 'special-setup-dir-with-cmdline-overrides'
> +        out = self.runbbsetup("init --non-interactive -L test-repo {} --setup-dir-name {} test-config-1 gadget".format(self.testrepopath, custom_setup_dir))
> +        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
> +        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
> +        self.assertTrue(os.path.islink(custom_layer_path))
> +        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))

The ordering definitely makes more sense now so this is good.

We do have a single very long test case covering bitbake-setup here. We
should think about splitting it up into separate test cases in the
future so that pass/fail results are more specific and easier to triage.

Best regards,
Alexander Kanavin Jan. 8, 2026, 9:12 p.m. UTC | #2
On Thu, 8 Jan 2026 at 16:17, Paul Barker <paul@pbarker.dev> wrote:

> We do have a single very long test case covering bitbake-setup here. We
> should think about splitting it up into separate test cases in the
> future so that pass/fail results are more specific and easier to triage.

Yes. Writing elegant, well-structured test cases is hard, especially
if it's been growing ad hoc.

It's not immediately obvious how to split into test cases: the test
sequence is very linear in the sense that it sets up synthetic input
data, then runs init on a number of configurations, then tries various
update scenarios on those configurations. I'd like to cross out
everything on TODO (and fix the timestamp bug), then I'll look into
it. Or you can take it up!

Alex
diff mbox series

Patch

diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
index 933178c84..ad09913f4 100644
--- a/lib/bb/tests/setup.py
+++ b/lib/bb/tests/setup.py
@@ -320,34 +320,6 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                 out = self.runbbsetup("update --update-bb-conf='yes'")
                 self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
 
-        # check source overrides, local sources provided with symlinks, and custom setup dir name
-        source_override_content = """
-{
-    "sources": {
-        "test-repo": {
-            "local": {
-                "path": "."
-            }
-        }
-    }
-}"""
-        override_filename = 'source-overrides.json'
-        custom_setup_dir = 'special-setup-dir'
-        self.add_file_to_testrepo(override_filename, source_override_content)
-        out = self.runbbsetup("init --non-interactive --source-overrides {} --setup-dir-name {} test-config-1 gadget".format(os.path.join(self.testrepopath, override_filename), custom_setup_dir))
-        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
-        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
-        self.assertTrue(os.path.islink(custom_layer_path))
-        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
-
-        # same but use command line options to specify local overrides
-        custom_setup_dir = 'special-setup-dir-with-cmdline-overrides'
-        out = self.runbbsetup("init --non-interactive -L test-repo {} --setup-dir-name {} test-config-1 gadget".format(self.testrepopath, custom_setup_dir))
-        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
-        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
-        self.assertTrue(os.path.islink(custom_layer_path))
-        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
-
         # install buildtools
         out = self.runbbsetup("install-buildtools")
         self.assertIn("Buildtools installed into", out[0])
@@ -428,3 +400,31 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
             out = self.runbbsetup("update --update-bb-conf='no'")
             sums_after = _conf_chksum(f"{setuppath}/build/conf")
             self.assertEqual(sums_before, sums_after)
+
+        # check source overrides, local sources provided with symlinks, and custom setup dir name
+        source_override_content = """
+{
+    "sources": {
+        "test-repo": {
+            "local": {
+                "path": "."
+            }
+        }
+    }
+}"""
+        override_filename = 'source-overrides.json'
+        custom_setup_dir = 'special-setup-dir'
+        self.add_file_to_testrepo(override_filename, source_override_content)
+        out = self.runbbsetup("init --non-interactive --source-overrides {} --setup-dir-name {} test-config-1 gadget".format(os.path.join(self.testrepopath, override_filename), custom_setup_dir))
+        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
+        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
+        self.assertTrue(os.path.islink(custom_layer_path))
+        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))
+
+        # same but use command line options to specify local overrides
+        custom_setup_dir = 'special-setup-dir-with-cmdline-overrides'
+        out = self.runbbsetup("init --non-interactive -L test-repo {} --setup-dir-name {} test-config-1 gadget".format(self.testrepopath, custom_setup_dir))
+        custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir)
+        custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo')
+        self.assertTrue(os.path.islink(custom_layer_path))
+        self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path))