All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH v2] oe-selftest: Add bitbake-layer create-layer test
Date: Sat, 30 Jun 2018 11:20:22 -0500	[thread overview]
Message-ID: <CAJdd5GYqC70snX0nz50dap7-w=0WVEpP_Q57beub5xgnYP8EdQ@mail.gmail.com> (raw)
In-Reply-To: <7fa47b1ad1e01ac0e5d5606ae69ae29a06e94b00.camel@linuxfoundation.org>

On Sat, Jun 30, 2018 at 4:57 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Fri, 2018-06-29 at 12:54 -0500, Joshua Watt wrote:
> > Adds a test that creates a layer, adds it to bblayers.conf, then
> > ensure
> > that it appears properly in bitbake-layers show-layers.
> >
> > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> > ---
> >  meta/lib/oeqa/selftest/cases/bblayers.py | 26
> > +++++++++++++++++++++++-
> >  1 file changed, 25 insertions(+), 1 deletion(-)
>
> I ran this on the autobuilder and it showed:
>
> https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/1154/steps/Running%20oe-selftest/logs/stdio
>
> Tests were working, it runs this test, then everything fails:
>
> 2018-06-29 23:50:23,781 - oe-selftest - INFO -  ... OK (719.550s)
> 2018-06-29 23:50:23,783 - oe-selftest - INFO -   test_bitbakelayers_add_remove (bblayers.BitbakeLayers)
> 2018-06-29 23:50:39,742 - oe-selftest - INFO -  ... OK (15.959s)
> 2018-06-29 23:50:39,742 - oe-selftest - INFO -   test_bitbakelayers_createlayer (bblayers.BitbakeLayers)
> 2018-06-29 23:50:49,526 - oe-selftest - INFO -  ... OK (9.783s)
> 2018-06-29 23:50:49,526 - oe-selftest - INFO -   test_bitbakelayers_flatten (bblayers.BitbakeLayers)
> 2018-06-29 23:50:49,971 - oe-selftest - INFO -  ... FAIL (0.445s)
> 2018-06-29 23:50:49,971 - oe-selftest - INFO -   test_bitbakelayers_showappends (bblayers.BitbakeLayers)
> 2018-06-29 23:50:50,356 - oe-selftest - INFO -  ... FAIL (0.385s)
> 2018-06-29 23:50:50,356 - oe-selftest - INFO -   test_bitbakelayers_showcrossdepends (bblayers.BitbakeLayers)
> 2018-06-29 23:50:50,761 - oe-selftest - INFO -  ... FAIL (0.405s)
>
> Later you can see the error:
>
> ERROR: Layer directory '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/test-bitbakelayer-layercreate' does not exist! Please check BBLAYERS in /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/build/conf/bblayers.conf
>
> so I think something in the cleanup of the test is wrong...

Oops, sorry about that. I think I saw that my bblayer.conf file was
correctly restored after oe-selftest completed, and assumed that was
being done between each test case. It should be fixed now in V3.

I wonder if you could make oe-selftest issue a warning when it exists
if the original bblayer.conf doesn't match the current one....

>
> Cheers,
>
> Richard
>
> > diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py
> > b/meta/lib/oeqa/selftest/cases/bblayers.py
> > index 90a2249b081..f2fc8327647 100644
> > --- a/meta/lib/oeqa/selftest/cases/bblayers.py
> > +++ b/meta/lib/oeqa/selftest/cases/bblayers.py
> > @@ -2,7 +2,7 @@ import os
> >  import re
> >
> >  import oeqa.utils.ftools as ftools
> > -from oeqa.utils.commands import runCmd, get_bb_var
> > +from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars
> >
> >  from oeqa.selftest.case import OESelftestTestCase
> >  from oeqa.core.decorator.oeid import OETestID
> > @@ -85,6 +85,30 @@ class BitbakeLayers(OESelftestTestCase):
> >          self.assertNotEqual(result.status, 0, 'bitbake-layers show-
> > recipes -i nonexistentclass should have failed')
> >          self.assertIn('ERROR:', result.output)
> >
> > +    def test_bitbakelayers_createlayer(self):
> > +        priority = 10
> > +        layername = 'test-bitbakelayer-layercreate'
> > +        layerpath = os.path.join(get_bb_var('COREBASE'), layername)
> > +        self.assertFalse(os.path.exists(layerpath), '%s should not
> > exist at this point in time' % layerpath)
> > +        result = runCmd('bitbake-layers create-layer --priority=%d
> > %s' % (priority, layerpath))
> > +        self.track_for_cleanup(layerpath)
> > +        result = runCmd('bitbake-layers add-layer %s' % layerpath)
> > +        result = runCmd('bitbake-layers show-layers')
> > +        find_in_contents = re.search(re.escape(layername) + r'\s+' +
> > re.escape(layerpath) + r'\s+' + re.escape(str(priority)),
> > result.output)
> > +        self.assertTrue(find_in_contents, "%s not found in
> > layers\n%s" % (layername, result.output))
> > +
> > +        layervars = ['BBFILE_PRIORITY', 'BBFILE_PATTERN',
> > 'LAYERDEPENDS', 'LAYERSERIES_COMPAT']
> > +        bb_vars = get_bb_vars(['BBFILE_COLLECTIONS'] + ['%s_%s' %
> > (v, layername) for v in layervars])
> > +
> > +        for v in layervars:
> > +            varname = '%s_%s' % (v, layername)
> > +            self.assertIsNotNone(bb_vars[varname], "%s not found" %
> > varname)
> > +
> > +        find_in_contents = re.search(r'(^|\s)' +
> > re.escape(layername) + r'($|\s)', bb_vars['BBFILE_COLLECTIONS'])
> > +        self.assertTrue(find_in_contents, "%s not in
> > BBFILE_COLLECTIONS" % layername)
> > +
> > +        self.assertEqual(bb_vars['BBFILE_PRIORITY_%s' % layername],
> > str(priority), 'BBFILE_PRIORITY_%s != %d' % (layername, priority))
> > +
> >      def get_recipe_basename(self, recipe):
> >          recipe_file = ""
> >          result = runCmd("bitbake-layers show-recipes -f %s" %
> > recipe)


  reply	other threads:[~2018-06-30 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 17:53 [PATCH 1/2] bitbake-bblayers/create: Fix layer name generation Joshua Watt
2018-06-28 17:53 ` [PATCH 2/2] oe-selftest: Add bitbake-layer create-layer test Joshua Watt
2018-06-28 21:54   ` Richard Purdie
2018-06-29 17:54 ` [PATCH v2] " Joshua Watt
2018-06-30  9:57   ` Richard Purdie
2018-06-30 16:20     ` Joshua Watt [this message]
2018-06-30 16:16   ` [PATCH v3] " Joshua Watt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJdd5GYqC70snX0nz50dap7-w=0WVEpP_Q57beub5xgnYP8EdQ@mail.gmail.com' \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.