Skip to content

Conversation

@mvo5
Copy link
Contributor

@mvo5 mvo5 commented Aug 19, 2021

Do a very basic check that the snap is valid after the building.
Thanks to Sergio for the suggestion.

Do a very basic check that the snap is valid after the building.
Thanks to Sergio for the suggestion.
sudo cp -a Makefile snapcraft.yaml hooks live-build extra-files $CHROOT/build
sudo chroot $CHROOT sh -c 'mount -t proc proc /proc; mount -t sysfs sys /sys; cd build; snapcraft'
# basic smoke testing
unsquashfs -ll core*.snap | grep /usr/lib/snapd/snapd$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the $ at the end of the line? Also I feel like a more efficient way to check this is:

Suggested change
unsquashfs -ll core*.snap | grep /usr/lib/snapd/snapd$
unsquashfs -ll core*.snap /usr/lib/snapd/snapd | grep /usr/lib/snapd/snapd

otherwise grep will check every single file in the snap

Copy link

@mardy mardy Aug 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $ ensures that the test will fail if the snapd binary is replaced by a directory (like /usr/lib/snapd/snapd/foo), which is highly unlikely but it still makes the test more robust, so I'd vote for keeping it. Your suggestion about limiting the filtering in unsquashfs itself is also good.

Copy link

@mardy mardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

sudo cp -a Makefile snapcraft.yaml hooks live-build extra-files $CHROOT/build
sudo chroot $CHROOT sh -c 'mount -t proc proc /proc; mount -t sysfs sys /sys; cd build; snapcraft'
# basic smoke testing
unsquashfs -ll core*.snap | grep /usr/lib/snapd/snapd$
Copy link

@mardy mardy Aug 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $ ensures that the test will fail if the snapd binary is replaced by a directory (like /usr/lib/snapd/snapd/foo), which is highly unlikely but it still makes the test more robust, so I'd vote for keeping it. Your suggestion about limiting the filtering in unsquashfs itself is also good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants