diff mbox series

oeqa/selftest/bbtests: add unexisting prefile/postfile tests

Message ID 20230612084423.13122-1-fabien.mahot@smile.fr
State New
Headers show
Series oeqa/selftest/bbtests: add unexisting prefile/postfile tests | expand

Commit Message

Fabien Mahot June 12, 2023, 8:44 a.m. UTC
Fixes [YOCTO #10725]

Signed-off-by: Fabien Mahot <fabien.mahot@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/lib/oeqa/selftest/cases/bbtests.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Richard Purdie June 13, 2023, 9:24 p.m. UTC | #1
On Mon, 2023-06-12 at 10:44 +0200, Fabien Mahot wrote:
> Fixes [YOCTO #10725]
> 
> Signed-off-by: Fabien Mahot <fabien.mahot@smile.fr>
> Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  meta/lib/oeqa/selftest/cases/bbtests.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
> index 1dd2839c8d..7ca1c306bb 100644
> --- a/meta/lib/oeqa/selftest/cases/bbtests.py
> +++ b/meta/lib/oeqa/selftest/cases/bbtests.py
> @@ -188,6 +188,10 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
>          self.assertTrue(find, "No version returned for searched recipe. bitbake output: %s" % result.output)
>  
>      def test_prefile(self):
> +        # Test when the prefile does not exist
> +        result = runCmd('bitbake -r conf/prefile.conf', ignore_status=True)
> +        self.assertEqual(1, result.status, "bitbake with unexisting prefile didn't run as expected:: %s" % result.output)
> +        # Test when the prefile exists
>          preconf = os.path.join(self.builddir, 'conf/prefile.conf')
>          self.track_for_cleanup(preconf)
>          ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"")

That patch itself looks good, thanks for working on this. 

One small tweak is needed as "unexisting" isn't really a word that
sounds correct to a native English reader although they would be able
to understand the intent. "non-existent" is probably the closest word.

I'd probably phrase that message as:

"bitbake didn't error and should have when a specified prefile didn't
exist: %s"

as I'm a big fan of really clear test failure messages where we can!

Could you update the patch with a v2 and tweak the messages please,
then we should be able to test and merge if successful.

Cheers,

Richard

> @@ -198,6 +202,10 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
>          self.assertIn('localconf', result.output)
>  
>      def test_postfile(self):
> +        # Test when the postfile does not exist
> +        result = runCmd('bitbake -R conf/postfile.conf', ignore_status=True)
> +        self.assertEqual(1, result.status, "bitbake with unexisting postfile didn't run as expected: %s" % result.output)
> +        # Test when the postfile exists
>          postconf = os.path.join(self.builddir, 'conf/postfile.conf')
>          self.track_for_cleanup(postconf)
>          ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"")
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#182656): https://lists.openembedded.org/g/openembedded-core/message/182656
> Mute This Topic: https://lists.openembedded.org/mt/99478990/1686473
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [richard.purdie@linuxfoundation.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index 1dd2839c8d..7ca1c306bb 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -188,6 +188,10 @@  SSTATE_DIR = \"${TOPDIR}/download-selftest\"
         self.assertTrue(find, "No version returned for searched recipe. bitbake output: %s" % result.output)
 
     def test_prefile(self):
+        # Test when the prefile does not exist
+        result = runCmd('bitbake -r conf/prefile.conf', ignore_status=True)
+        self.assertEqual(1, result.status, "bitbake with unexisting prefile didn't run as expected:: %s" % result.output)
+        # Test when the prefile exists
         preconf = os.path.join(self.builddir, 'conf/prefile.conf')
         self.track_for_cleanup(preconf)
         ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"")
@@ -198,6 +202,10 @@  SSTATE_DIR = \"${TOPDIR}/download-selftest\"
         self.assertIn('localconf', result.output)
 
     def test_postfile(self):
+        # Test when the postfile does not exist
+        result = runCmd('bitbake -R conf/postfile.conf', ignore_status=True)
+        self.assertEqual(1, result.status, "bitbake with unexisting postfile didn't run as expected: %s" % result.output)
+        # Test when the postfile exists
         postconf = os.path.join(self.builddir, 'conf/postfile.conf')
         self.track_for_cleanup(postconf)
         ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"")