Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: several fixes to nested tests for UC24 #14761

Merged
merged 6 commits into from
Nov 29, 2024

Conversation

Meulengracht
Copy link
Member

@Meulengracht Meulengracht commented Nov 26, 2024

Rough summary of changes for some of the nested tests:

  • Make sure we write the bootstrap wrapper for core24
  • Repack gadget with core24 as a base for hybrid-remodel in core24 scenario
  • Switch back to 24-hwe, there is no such thing as 24-oem
  • Fix how we add and check for section in kernel.efi

The remodel-min-size still needs to be fixed, will do that in a separate PR
The core20-early-config also needs its own PR (#14771)

REF: SNAPDENG-33308

@Meulengracht Meulengracht added the Run nested The PR also runs tests inluded in nested suite label Nov 26, 2024
@Meulengracht Meulengracht marked this pull request as ready for review November 26, 2024 10:01
@Meulengracht Meulengracht reopened this Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.03%. Comparing base (96ea7b0) to head (b3ed2ab).
Report is 121 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14761      +/-   ##
==========================================
+ Coverage   78.95%   79.03%   +0.07%     
==========================================
  Files        1084     1087       +3     
  Lines      146638   147941    +1303     
==========================================
+ Hits       115773   116919    +1146     
- Misses      23667    23778     +111     
- Partials     7198     7244      +46     
Flag Coverage Δ
unittests 79.03% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…dget with core24 as a base for hybrid 24, fix how we add and check for section in kernel.efi
@Meulengracht Meulengracht force-pushed the bugfix/core24-nested-fixes branch from ce3232b to 284c0fc Compare November 27, 2024 08:21
@@ -17,7 +17,7 @@ snaps:
name: pc
type: gadget
-
default-channel: 24-oem/stable
Copy link
Member Author

@Meulengracht Meulengracht Nov 27, 2024

Choose a reason for hiding this comment

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

no oem track

@Meulengracht Meulengracht force-pushed the bugfix/core24-nested-fixes branch from e4261d4 to 5e156ff Compare November 27, 2024 15:00
Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

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

I don't know core parts well enough to approve. Just two random observations.

snap download --basename=pc-kernel --channel="$VERSION/stable" pc-kernel

# download beta to increase the unlikeliness that we encounter the
# same revision when remodelling.
Copy link
Contributor

Choose a reason for hiding this comment

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

So this can still randomly fail. What kind of option do we have for this to be fully robust regardless of releases?

Copy link
Member Author

@Meulengracht Meulengracht Nov 28, 2024

Choose a reason for hiding this comment

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

Idk, I was hoping someone might have a better idea - maybe repacking it and installing as an unasserted kernel would be fine.

@alfonsosanchezbeato idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do not we repack the kernel here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that we will have to rewrite this test in the FDE branch. Because we will have to repack everything and remodel from the fakestore. So maybe we do not need to do the effort twice.

tests/nested/manual/hybrid-remodel/task.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@ernestl ernestl left a comment

Choose a reason for hiding this comment

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

Looks good thanks

@@ -775,6 +775,39 @@ uc20_build_corrupt_kernel_snap() {
rm -rf "$REPACKED_DIR"
}

uc_write_bootstrap_wrapper() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@ernestl ernestl added this to the 2.67 milestone Nov 28, 2024
@ernestl ernestl mentioned this pull request Nov 28, 2024
beforeDate="$(date --utc '+%s')"
/usr/lib/snapd/snap-bootstrap.real "$@"
if [ -d /run/mnt/data/system-data ]; then
touch /run/mnt/data/system-data/the-tool-ran
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should clean that up. On 22+, it is not called the-tool anymore. And since we have systemd re-execution in 22+ we can actually ask systemd directly if and when it was run.

Copy link
Contributor

Choose a reason for hiding this comment

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

And of course, in a follow up PR

touch /run/mnt/data/system-data/the-tool-ran
fi
# also copy the time for the clock-epoch to system-data, this is
# used by a specific test but doesn't hurt anything to do this for
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to find out which "specific test" needs it and add it in the comment. I really wonder if that is still needed.

local SKELETON_PATH="$1"
local INJECT_ERR="${2:-false}"

cp -a /usr/lib/snapd/snap-bootstrap "$SKELETON_PATH"/usr/lib/snapd/snap-bootstrap.real
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel a lot of it should have been done by dropping a configuration for ExecStartPre and ExecStartPost. Maybe some clean up for the future.

Copy link
Contributor

@valentindavid valentindavid left a comment

Choose a reason for hiding this comment

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

Thank you.

Nice that you extracted uc_write_bootstrap_wrapper. We should really look at rewriting it now.

@ernestl ernestl merged commit 82c1dfc into canonical:master Nov 29, 2024
47 of 56 checks passed
ernestl pushed a commit to ernestl/snapd that referenced this pull request Nov 29, 2024
* tests: make sure we write the bootstrap wrapper for core24, repack gadget with core24 as a base for hybrid 24, fix how we add and check for section in kernel.efi

* t/nested/manual/hybrid-remodel: update core base in snap.yaml as well

* t/nested/manual/hybrid-remodel: so no reboot is happening because kernel is the same version between 24-hwe and 24. for now use beta to stable

* t/nested/manual/hybrid-remodel: undo the channel switch

* t/nested/manual/hybrid-remodel: use beta channel to increase unlikeliness to encounter same revision for UC24

* t/nested/manual/hybrid-remodel: fix the track check
ernestl pushed a commit that referenced this pull request Dec 3, 2024
* tests: make sure we write the bootstrap wrapper for core24, repack gadget with core24 as a base for hybrid 24, fix how we add and check for section in kernel.efi

* t/nested/manual/hybrid-remodel: update core base in snap.yaml as well

* t/nested/manual/hybrid-remodel: so no reboot is happening because kernel is the same version between 24-hwe and 24. for now use beta to stable

* t/nested/manual/hybrid-remodel: undo the channel switch

* t/nested/manual/hybrid-remodel: use beta channel to increase unlikeliness to encounter same revision for UC24

* t/nested/manual/hybrid-remodel: fix the track check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked Run nested The PR also runs tests inluded in nested suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants