diff mbox series

runqemu: match .rootfs. in image names instead of -image-

Message ID 20240103101615.1874481-1-mikko.rapeli@linaro.org
State New
Headers show
Series runqemu: match .rootfs. in image names instead of -image- | expand

Commit Message

Mikko Rapeli Jan. 3, 2024, 10:16 a.m. UTC
Don't expect image file names to include "-image-" but
expect them to have the ".rootfs." postfix which is the
default.

Enables running tests against image recipes which are not called
"bla-image" but plain "bla". Currently they fail with do_testimage/runqemu
error:

runqemu - ERROR - Unknown path arg /home/builder/src/base/build/tmp_qemuarm64/deploy/images/qemuarm64/img-qemuarm64.rootfs.wic

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 scripts/runqemu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Jansa Jan. 3, 2024, 2:54 p.m. UTC | #1
On Wed, Jan 3, 2024 at 11:16 AM Mikko Rapeli <mikko.rapeli@linaro.org>
wrote:

> Don't expect image file names to include "-image-" but
> expect them to have the ".rootfs." postfix which is the
> default.
>

It's the current default, but whole runqemu won't work when someone changes:

meta/classes-recipe/image-artifact-names.bbclass:IMAGE_NAME_SUFFIX ??=
".rootfs"

So you should probably read IMAGE_NAME_SUFFIX variable first, but the most
likely change someone will have in local.conf would be to drop this suffix
and set this to empty and then the check for empty string in basename won't
be very useful as well.

Regards,
Mikko Rapeli Jan. 4, 2024, 6:59 a.m. UTC | #2
Hi,

On Wed, Jan 03, 2024 at 03:54:02PM +0100, Martin Jansa wrote:
> On Wed, Jan 3, 2024 at 11:16 AM Mikko Rapeli <mikko.rapeli@linaro.org>
> wrote:
> 
> > Don't expect image file names to include "-image-" but
> > expect them to have the ".rootfs." postfix which is the
> > default.
> >
> 
> It's the current default, but whole runqemu won't work when someone changes:
> 
> meta/classes-recipe/image-artifact-names.bbclass:IMAGE_NAME_SUFFIX ??=
> ".rootfs"
> 
> So you should probably read IMAGE_NAME_SUFFIX variable first, but the most
> likely change someone will have in local.conf would be to drop this suffix
> and set this to empty and then the check for empty string in basename won't
> be very useful as well.

So drop this file name check completely? Fine for me. I'll send an update.

Cheers,

-Mikko
Mikko Rapeli Jan. 4, 2024, 7:50 a.m. UTC | #3
Hi,

On Thu, Jan 04, 2024 at 08:59:03AM +0200, Mikko Rapeli via lists.openembedded.org wrote:
> Hi,
> 
> On Wed, Jan 03, 2024 at 03:54:02PM +0100, Martin Jansa wrote:
> > On Wed, Jan 3, 2024 at 11:16 AM Mikko Rapeli <mikko.rapeli@linaro.org>
> > wrote:
> > 
> > > Don't expect image file names to include "-image-" but
> > > expect them to have the ".rootfs." postfix which is the
> > > default.
> > >
> > 
> > It's the current default, but whole runqemu won't work when someone changes:
> > 
> > meta/classes-recipe/image-artifact-names.bbclass:IMAGE_NAME_SUFFIX ??=
> > ".rootfs"
> > 
> > So you should probably read IMAGE_NAME_SUFFIX variable first, but the most
> > likely change someone will have in local.conf would be to drop this suffix
> > and set this to empty and then the check for empty string in basename won't
> > be very useful as well.
> 
> So drop this file name check completely? Fine for me. I'll send an update.

As you said too, this doesn't work. runqemu has a bunch of heuristics to detect different
kinds of file arguments which break too easily. Test for .rootfs. in file name is IMO
better than than -image- in recipe/file name, but also not perfect. Using IMAGE_NAME_SUFFIX
would be nice but the indirection with qemuboot.conf makes this hard too, and if that variable
is set to empty then a lot of things break again on runqemu side heuristics, gah...

I have a dm-verity image recipe and a separate recipe which bakes that into a .wic image
file which I'd like to test with oeqa, testimage.bbclass and qemu.

It's either this patch or I rename all image recipes to have -image in their names.

Cheers,

-Mikko
Richard Purdie Jan. 4, 2024, 8:34 a.m. UTC | #4
On Thu, 2024-01-04 at 09:50 +0200, Mikko Rapeli wrote:
> Hi,
> 
> On Thu, Jan 04, 2024 at 08:59:03AM +0200, Mikko Rapeli via lists.openembedded.org wrote:
> > Hi,
> > 
> > On Wed, Jan 03, 2024 at 03:54:02PM +0100, Martin Jansa wrote:
> > > On Wed, Jan 3, 2024 at 11:16 AM Mikko Rapeli <mikko.rapeli@linaro.org>
> > > wrote:
> > > 
> > > > Don't expect image file names to include "-image-" but
> > > > expect them to have the ".rootfs." postfix which is the
> > > > default.
> > > > 
> > > 
> > > It's the current default, but whole runqemu won't work when someone changes:
> > > 
> > > meta/classes-recipe/image-artifact-names.bbclass:IMAGE_NAME_SUFFIX ??=
> > > ".rootfs"
> > > 
> > > So you should probably read IMAGE_NAME_SUFFIX variable first, but the most
> > > likely change someone will have in local.conf would be to drop this suffix
> > > and set this to empty and then the check for empty string in basename won't
> > > be very useful as well.
> > 
> > So drop this file name check completely? Fine for me. I'll send an update.
> 
> As you said too, this doesn't work. runqemu has a bunch of heuristics to detect different
> kinds of file arguments which break too easily. Test for .rootfs. in file name is IMO
> better than than -image- in recipe/file name, but also not perfect. Using IMAGE_NAME_SUFFIX
> would be nice but the indirection with qemuboot.conf makes this hard too, and if that variable
> is set to empty then a lot of things break again on runqemu side heuristics, gah...
> 
> I have a dm-verity image recipe and a separate recipe which bakes that into a .wic image
> file which I'd like to test with oeqa, testimage.bbclass and qemu.
> 
> It's either this patch or I rename all image recipes to have -image in their names.

You could change the check to check for -image- or .rootfs. ? 

Not perfect either but might be good enough...

Cheers,

Richard
Mikko Rapeli Jan. 4, 2024, 9:38 a.m. UTC | #5
Hi,

On Thu, Jan 04, 2024 at 08:34:03AM +0000, Richard Purdie wrote:
> On Thu, 2024-01-04 at 09:50 +0200, Mikko Rapeli wrote:
> > Hi,
> > 
> > On Thu, Jan 04, 2024 at 08:59:03AM +0200, Mikko Rapeli via lists.openembedded.org wrote:
> > > Hi,
> > > 
> > > On Wed, Jan 03, 2024 at 03:54:02PM +0100, Martin Jansa wrote:
> > > > On Wed, Jan 3, 2024 at 11:16 AM Mikko Rapeli <mikko.rapeli@linaro.org>
> > > > wrote:
> > > > 
> > > > > Don't expect image file names to include "-image-" but
> > > > > expect them to have the ".rootfs." postfix which is the
> > > > > default.
> > > > > 
> > > > 
> > > > It's the current default, but whole runqemu won't work when someone changes:
> > > > 
> > > > meta/classes-recipe/image-artifact-names.bbclass:IMAGE_NAME_SUFFIX ??=
> > > > ".rootfs"
> > > > 
> > > > So you should probably read IMAGE_NAME_SUFFIX variable first, but the most
> > > > likely change someone will have in local.conf would be to drop this suffix
> > > > and set this to empty and then the check for empty string in basename won't
> > > > be very useful as well.
> > > 
> > > So drop this file name check completely? Fine for me. I'll send an update.
> > 
> > As you said too, this doesn't work. runqemu has a bunch of heuristics to detect different
> > kinds of file arguments which break too easily. Test for .rootfs. in file name is IMO
> > better than than -image- in recipe/file name, but also not perfect. Using IMAGE_NAME_SUFFIX
> > would be nice but the indirection with qemuboot.conf makes this hard too, and if that variable
> > is set to empty then a lot of things break again on runqemu side heuristics, gah...
> > 
> > I have a dm-verity image recipe and a separate recipe which bakes that into a .wic image
> > file which I'd like to test with oeqa, testimage.bbclass and qemu.
> > 
> > It's either this patch or I rename all image recipes to have -image in their names.
> 
> You could change the check to check for -image- or .rootfs. ? 
> 
> Not perfect either but might be good enough...

Good idea, I'll do that.

Cheers,

-Mikko
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index 18aeb7f5f0..1575677c45 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -373,7 +373,7 @@  class BaseConfig(object):
              re.search('zImage', p) or re.search('vmlinux', p) or \
              re.search('fitImage', p) or re.search('uImage', p):
             self.kernel =  p
-        elif os.path.exists(p) and (not os.path.isdir(p)) and '-image-' in os.path.basename(p):
+        elif os.path.exists(p) and (not os.path.isdir(p)) and '.rootfs.' in os.path.basename(p):
             self.rootfs = p
             # Check filename against self.fstypes can handle <file>.cpio.gz,
             # otherwise, its type would be "gz", which is incorrect.