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: fix fsck on boot on arm devices #9655

Merged

Conversation

sergiocazzolato
Copy link
Collaborator

Add support for arm devices for the test fsck-on-boot

@sergiocazzolato
Copy link
Collaborator Author

sergio@cachiomachine:~/workspace/snapcore/snapd$ spread -debug external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot
2020-11-17 10:49:44 Project content is packed for delivery (4.76MB).
2020-11-17 10:49:44 If killed, discard servers with: spread -reuse-pid=80773 -discard
2020-11-17 10:49:44 Allocating external:ubuntu-core-18-arm-32...
2020-11-17 10:49:44 Waiting for external:ubuntu-core-18-arm-32 to make SSH available at 10.101.50.80...
2020-11-17 10:49:46 Allocated external:ubuntu-core-18-arm-32.
2020-11-17 10:49:46 Connecting to external:ubuntu-core-18-arm-32...
2020-11-17 10:50:09 Connected to external:ubuntu-core-18-arm-32 at 10.101.50.80.
2020-11-17 10:50:09 Sending project content to external:ubuntu-core-18-arm-32...
2020-11-17 10:51:29 Preparing external:ubuntu-core-18-arm-32 (external:ubuntu-core-18-arm-32)...
2020-11-17 10:51:32 Preparing external:ubuntu-core-18-arm-32:tests/core/ (external:ubuntu-core-18-arm-32)...
2020-11-17 10:55:18 Preparing external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot (external:ubuntu-core-18-arm-32)...
2020-11-17 10:55:39 Executing external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot (external:ubuntu-core-18-arm-32) (1/1)...
2020-11-17 10:55:43 Rebooting on external:ubuntu-core-18-arm-32 (external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot) as requested...
2020-11-17 10:56:42 Rebooting on external:ubuntu-core-18-arm-32 (external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot) as requested...
2020-11-17 10:57:58 Restoring external:ubuntu-core-18-arm-32:tests/core/fsck-on-boot (external:ubuntu-core-18-arm-32)...
2020-11-17 10:58:03 Restoring external:ubuntu-core-18-arm-32:tests/core/ (external:ubuntu-core-18-arm-32)...
2020-11-17 10:58:11 Restoring external:ubuntu-core-18-arm-32 (external:ubuntu-core-18-arm-32)...
2020-11-17 10:58:13 Discarding external:ubuntu-core-18-arm-32...
2020-11-17 10:58:13 Successful tasks: 1
2020-11-17 10:58:13 Aborted tasks: 0

@sergiocazzolato
Copy link
Collaborator Author

sergio@cachiomachine:~/workspace/snapcore/snapd$ spread -debug external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot
2020-11-17 12:15:09 Project content is packed for delivery (4.76MB).
2020-11-17 12:15:09 If killed, discard servers with: spread -reuse-pid=88605 -discard
2020-11-17 12:15:09 Allocating external:ubuntu-core-20-arm-64...
2020-11-17 12:15:09 Waiting for external:ubuntu-core-20-arm-64 to make SSH available at 10.101.49.37...
2020-11-17 12:15:11 Allocated external:ubuntu-core-20-arm-64.
2020-11-17 12:15:11 Connecting to external:ubuntu-core-20-arm-64...
2020-11-17 12:15:26 Connected to external:ubuntu-core-20-arm-64 at 10.101.49.37.
2020-11-17 12:15:26 Sending project content to external:ubuntu-core-20-arm-64...
2020-11-17 12:18:20 Preparing external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64)...
2020-11-17 12:18:25 Preparing external:ubuntu-core-20-arm-64:tests/core/ (external:ubuntu-core-20-arm-64)...
2020-11-17 12:21:17 Preparing external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64)...
2020-11-17 12:21:43 Executing external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64) (1/1)...
2020-11-17 12:21:59 Rebooting on external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot) as requested...
2020-11-17 12:23:24 Rebooting on external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot) as requested...
2020-11-17 12:24:29 Restoring external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64)...
2020-11-17 12:24:39 Restoring external:ubuntu-core-20-arm-64:tests/core/ (external:ubuntu-core-20-arm-64)...
2020-11-17 12:24:51 Restoring external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64)...
2020-11-17 12:25:01 Discarding external:ubuntu-core-20-arm-64...
2020-11-17 12:25:01 Successful tasks: 1
2020-11-17 12:25:01 Aborted tasks: 0

@sergiocazzolato
Copy link
Collaborator Author

Left the logs for arm devices which were tested for this PR

Copy link
Contributor

@anonymouse64 anonymouse64 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, but I think we need to keep the tests.cleanup restore in the restore section

also a couple comments about simplification of the shell script to be more readable using environment variables

tests/core/fsck-on-boot/task.yaml Show resolved Hide resolved
@@ -54,7 +71,11 @@ execute: |
# Use offset 65 as FAT32 kicks in for devices larger than 32MB
printf "\x01" > one
tests.cleanup defer rm -f one
dd if=one of=/dev/sda2 seek=65 bs=1 count=1 conv=notrunc
if os.query is-core16 || os.query is-core18; then
dd if=/dev/disk/by-label/system-boot of=dirty skip=65 bs=1 count=1 conv=notrunc
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nitpick, but instead of duplicating the whole dd command, you could instead just have the if set an environment variable for the label like this:

if os.query is-core16 || os.query is-core18; then
  LABEL=system-boot
elif os.query is-core20; then
  LABEL=ubuntu-seed
else
  echo "unknown core system, please update test"
  exit 1
fi
dd if="/dev/disk/by-label/$LABEL" of=dirty skip=65 bs=1 count=1 conv=notrunc

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can skip the else branch given that the check for uc22 et al is also done above too

Copy link
Contributor

Choose a reason for hiding this comment

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

/me notes that this also would be a good use for canonical/spread#83 if that ever becomes a thing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

totally agree, should be great to be able to define vars by system

@@ -76,12 +97,14 @@ execute: |
# chain.
unmount_vfat
cat /proc/self/mountinfo >boot1-after-umount.log
dd if=/dev/sda2 of=dirty skip=65 bs=1 count=1 conv=notrunc
if os.query is-core16 || os.query is-core18; then
dd if=/dev/disk/by-label/system-boot of=dirty skip=65 bs=1 count=1 conv=notrunc
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment about LABEL

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

tests/core/fsck-on-boot/task.yaml Show resolved Hide resolved
@sergiocazzolato sergiocazzolato added this to the 2.48 milestone Nov 17, 2020
@sergiocazzolato
Copy link
Collaborator Author

Tests after fixes:

sergio@cachiomachine:~/workspace/snapcore/snapd$ spread -debug external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot
2020-11-17 16:31:27 Project content is packed for delivery (4.76MB).
2020-11-17 16:31:27 If killed, discard servers with: spread -reuse-pid=103890 -discard
2020-11-17 16:31:27 Allocating external:ubuntu-core-20-arm-64...
2020-11-17 16:31:27 Waiting for external:ubuntu-core-20-arm-64 to make SSH available at 10.101.49.37...
2020-11-17 16:31:30 Allocated external:ubuntu-core-20-arm-64.
2020-11-17 16:31:30 Connecting to external:ubuntu-core-20-arm-64...
2020-11-17 16:31:44 Connected to external:ubuntu-core-20-arm-64 at 10.101.49.37.
2020-11-17 16:31:44 Sending project content to external:ubuntu-core-20-arm-64...
2020-11-17 16:35:09 Preparing external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64)...
2020-11-17 16:35:16 Preparing external:ubuntu-core-20-arm-64:tests/core/ (external:ubuntu-core-20-arm-64)...
2020-11-17 16:38:17 Preparing external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64)...
2020-11-17 16:38:32 Executing external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64) (1/1)...
2020-11-17 16:38:39 Rebooting on external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot) as requested...
2020-11-17 16:40:37 Rebooting on external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot) as requested...
2020-11-17 16:42:08 Restoring external:ubuntu-core-20-arm-64:tests/core/fsck-on-boot (external:ubuntu-core-20-arm-64)...
2020-11-17 16:42:18 Restoring external:ubuntu-core-20-arm-64:tests/core/ (external:ubuntu-core-20-arm-64)...
2020-11-17 16:42:30 Restoring external:ubuntu-core-20-arm-64 (external:ubuntu-core-20-arm-64)...
2020-11-17 16:42:39 Discarding external:ubuntu-core-20-arm-64...
2020-11-17 16:42:39 Successful tasks: 1
2020-11-17 16:42:39 Aborted tasks: 0

Copy link
Contributor

@anonymouse64 anonymouse64 left a comment

Choose a reason for hiding this comment

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

seems the arguments to dd have been flipped incorrectly

@@ -54,7 +87,7 @@ execute: |
# Use offset 65 as FAT32 kicks in for devices larger than 32MB
printf "\x01" > one
tests.cleanup defer rm -f one
dd if=one of=/dev/sda2 seek=65 bs=1 count=1 conv=notrunc
dd if="/dev/disk/by-label/$LABEL" of=dirty skip=65 bs=1 count=1 conv=notrunc
Copy link
Contributor

Choose a reason for hiding this comment

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

this is now wrong, it was

dd \
  if=one \
  of=/dev/... \
  seek=65 \
  ...

and it has now become:

dd \
  if=/dev/...
  of=dirty \
  skip=65 \
  ...

perhaps this line was mixed up with the one below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, thanks for checking

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@anonymouse64 updated

@@ -76,12 +109,10 @@ execute: |
# chain.
unmount_vfat
cat /proc/self/mountinfo >boot1-after-umount.log
dd if=/dev/sda2 of=dirty skip=65 bs=1 count=1 conv=notrunc
dd if="/dev/disk/by-label/$LABEL" of=dirty skip=65 bs=1 count=1 conv=notrunc
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks correct

Copy link
Contributor

@anonymouse64 anonymouse64 left a comment

Choose a reason for hiding this comment

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

LGTM now thanks for fixing it up

@@ -54,7 +87,7 @@ execute: |
# Use offset 65 as FAT32 kicks in for devices larger than 32MB
printf "\x01" > one
tests.cleanup defer rm -f one
dd if=one of=/dev/sda2 seek=65 bs=1 count=1 conv=notrunc
dd if=one of="/dev/disk/by-label/$LABEL" seek=65 bs=1 count=1 conv=notrunc
Copy link
Contributor

Choose a reason for hiding this comment

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

this is good now too

Copy link
Contributor

@mvo5 mvo5 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

@mvo5
Copy link
Contributor

mvo5 commented Nov 18, 2020

Looks good but the test fails now with: https://paste.ubuntu.com/p/GV7wDKdnpj/ on google:ubuntu-core-20-64:tests/core/fsck-on-boot

But it seems that failure is unrelated to the PR I saw it failing in other PRs too.

@mvo5 mvo5 added the Squash-merge Please squash this PR when merging. label Nov 18, 2020
@mvo5
Copy link
Contributor

mvo5 commented Nov 18, 2020

Please squash merge this for easier 2.48 cherry picks :)

@sergiocazzolato sergiocazzolato merged commit 3b9fdaf into canonical:master Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Squash-merge Please squash this PR when merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants