diff mbox series

bbtests.py: Add test for unexpanded variables in the dirname

Message ID 20231208113813.766894-1-pavel@zhukoff.net
State New
Headers show
Series bbtests.py: Add test for unexpanded variables in the dirname | expand

Commit Message

Pavel Zhukov Dec. 8, 2023, 11:38 a.m. UTC
Regression test for [Yocto #15255]

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
---
 meta/lib/oeqa/selftest/cases/bbtests.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Richard Purdie Dec. 8, 2023, 12:24 p.m. UTC | #1
On Fri, 2023-12-08 at 12:38 +0100, Pavel Zhukov wrote:
> Regression test for [Yocto #15255]
> 
> Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
> ---
>  meta/lib/oeqa/selftest/cases/bbtests.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
> index d242352ea2..03faf1a881 100644
> --- a/meta/lib/oeqa/selftest/cases/bbtests.py
> +++ b/meta/lib/oeqa/selftest/cases/bbtests.py
> @@ -362,3 +362,12 @@ INHERIT:remove = \"report-error\"
>  
>          result = bitbake('gitunpackoffline-fail -c fetch', ignore_status=True)
>          self.assertTrue(re.search("Recipe uses a floating tag/branch .* for repo .* without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev()", result.output), msg = "Recipe without PV set to SRCPV should have failed: %s" % result.output)
> +
> +    def test_unexpanded_variable_in_path(self):
> +        """
> +            Test if typo SRC_URI => SRC_URL causes bitbake to explode

This is a little confusing since this isn't what the test actually
does!

> +        """
> +        recipe_name = "gitunpackoffline"
> +        self.write_config('PV:pn-gitunpackoffline:append = "+${UNDEFVAL}"')
> +        result = bitbake('{}'.format(recipe_name), ignore_status=True)
> +        self.assertTrue(re.search("ERROR: Directory name /.* contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution", result.output), msg = "mkdirhier with unexpanded variable should have failed: %s" % result.output)

We also want to check the result was an error (failed) build?

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index d242352ea2..03faf1a881 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -362,3 +362,12 @@  INHERIT:remove = \"report-error\"
 
         result = bitbake('gitunpackoffline-fail -c fetch', ignore_status=True)
         self.assertTrue(re.search("Recipe uses a floating tag/branch .* for repo .* without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev()", result.output), msg = "Recipe without PV set to SRCPV should have failed: %s" % result.output)
+
+    def test_unexpanded_variable_in_path(self):
+        """
+            Test if typo SRC_URI => SRC_URL causes bitbake to explode
+        """
+        recipe_name = "gitunpackoffline"
+        self.write_config('PV:pn-gitunpackoffline:append = "+${UNDEFVAL}"')
+        result = bitbake('{}'.format(recipe_name), ignore_status=True)
+        self.assertTrue(re.search("ERROR: Directory name /.* contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution", result.output), msg = "mkdirhier with unexpanded variable should have failed: %s" % result.output)