diff mbox series

oeqa/selftest/sanity: add test case for the recipe-naming sanity check

Message ID 20250610104115.2291973-1-ross.burton@arm.com
State New
Headers show
Series oeqa/selftest/sanity: add test case for the recipe-naming sanity check | expand

Commit Message

Ross Burton June 10, 2025, 10:41 a.m. UTC
Add a pair of test recipes to meta-selftest, and a new test module to
collect test cases for the recipe_qa/package_qa checks.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../recipename/nativesdk-recipename-test.bb   |  6 +++++
 .../recipename/recipename-test-native.bb      |  6 +++++
 meta/lib/oeqa/selftest/cases/sanity.py        | 27 +++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 meta-selftest/recipes-test/recipename/nativesdk-recipename-test.bb
 create mode 100644 meta-selftest/recipes-test/recipename/recipename-test-native.bb
 create mode 100644 meta/lib/oeqa/selftest/cases/sanity.py

Comments

Mathieu Dubois-Briand June 10, 2025, 12:09 p.m. UTC | #1
On Tue Jun 10, 2025 at 12:41 PM CEST, Ross Burton via lists.openembedded.org wrote:
> Add a pair of test recipes to meta-selftest, and a new test module to
> collect test cases for the recipe_qa/package_qa checks.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---

Hi Ross,

We get this error:

ERROR: recipename-test-native-1.0-r0 do_recipe_qa: QA Issue: Recipe recipename-test-native appears native but is not, should inherit native [recipe-naming]

https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/1775
Ross Burton June 10, 2025, 1:09 p.m. UTC | #2
On 10 Jun 2025, at 13:09, Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> wrote:
> 
> On Tue Jun 10, 2025 at 12:41 PM CEST, Ross Burton via lists.openembedded.org wrote:
>> Add a pair of test recipes to meta-selftest, and a new test module to
>> collect test cases for the recipe_qa/package_qa checks.
>> 
>> Signed-off-by: Ross Burton <ross.burton@arm.com>
>> ---
> 
> Hi Ross,
> 
> We get this error:
> 
> ERROR: recipename-test-native-1.0-r0 do_recipe_qa: QA Issue: Recipe recipename-test-native appears native but is not, should inherit native [recipe-naming]
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/1775

Well that’s just annoying.

Sorry for the noise, I’ll go back to the drawing board and figure out how to make a test.

Ross
diff mbox series

Patch

diff --git a/meta-selftest/recipes-test/recipename/nativesdk-recipename-test.bb b/meta-selftest/recipes-test/recipename/nativesdk-recipename-test.bb
new file mode 100644
index 00000000000..c5342150b23
--- /dev/null
+++ b/meta-selftest/recipes-test/recipename/nativesdk-recipename-test.bb
@@ -0,0 +1,6 @@ 
+SUMMARY = "Recipe that is called nativesdk- but does not inherit nativesdk"
+LICENSE = "CLOSED"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/meta-selftest/recipes-test/recipename/recipename-test-native.bb b/meta-selftest/recipes-test/recipename/recipename-test-native.bb
new file mode 100644
index 00000000000..2a05f6c617b
--- /dev/null
+++ b/meta-selftest/recipes-test/recipename/recipename-test-native.bb
@@ -0,0 +1,6 @@ 
+SUMMARY = "Recipe that is called -native but does not inherit native"
+LICENSE = "CLOSED"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/lib/oeqa/selftest/cases/sanity.py b/meta/lib/oeqa/selftest/cases/sanity.py
new file mode 100644
index 00000000000..50ad0a141da
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/sanity.py
@@ -0,0 +1,27 @@ 
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake
+
+class RecipeQaTests(OESelftestTestCase):
+    """
+    Tests to exercise the recipe_qa checks.
+    """
+
+    def test_recipe_naming(self):
+        """
+        Exercise the recipe-naming check.
+        """
+        self.write_config('ERROR_QA = "recipe-naming"')
+
+        for recipe in ("recipename-test-native", "nativesdk-recipename-test"):
+            with self.subTest(recipe=recipe):
+                res = bitbake(f"{recipe} -c recipe_qa -f", ignore_status=True)
+                # bitbake should have failed
+                self.assertNotEqual(res.status, 0)
+                # The recipe-naming test should be in the output
+                self.assertRegex(res.output, fr"do_recipe_qa.*{recipe}.*\[recipe-naming\]")