Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/lib/tools/build_kernel_with_comps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ EOF
# Replace _ or - with [_-], as it can be any of these
glob_mod_name=$(printf '%s' "$mod_name" | sed -r 's/[-_]/[-_]/g')
module_path=$(find kernel -name "${glob_mod_name}.ko*")
cp "$module_path" "$comp_ko_dir"
mapfile -t module_path <<< "$module_path"
cp --update=none "${module_path[@]}" "$comp_ko_dir"
snap pack --filename="${kernel_name}+${comp_name}".comp "$comp_name"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe slightly simpler?

diff --git a/tests/lib/tools/build_kernel_with_comps.sh b/tests/lib/tools/build_kernel_with_comps.sh
index 99c13b4d19..7eabdf90ea 100755
--- a/tests/lib/tools/build_kernel_with_comps.sh
+++ b/tests/lib/tools/build_kernel_with_comps.sh
@@ -39,15 +39,19 @@ description: kernel component for testing purposes
 EOF
     # Replace _ or - with [_-], as it can be any of these
     glob_mod_name=$(printf '%s' "$mod_name" | sed -r 's/[-_]/[-_]/g')
-    module_path=$(find kernel -name "${glob_mod_name}.ko*")
+    # TODO: search only in kernel/modules to avoid duplicates (pc-kernel in
+    # 26/edge has both modules/ and lib/modules/). remove this hack once
+    # the kernel snap is fixed
+    module_path=$(find kernel/modules -name "${glob_mod_name}.ko*")
     cp "$module_path" "$comp_ko_dir"
     snap pack --filename="${kernel_name}+${comp_name}".comp "$comp_name"
 
     # Create kernel without the kernel module
     rm "$module_path"
-    # depmod wants a lib subdir
-    mkdir -p kernel/lib
-    ln -s ../modules kernel/lib/modules
+    if [ ! -e kernel/lib/modules ]; then
+        mkdir -p kernel/lib
+        ln -s ../modules kernel/lib/modules
+    fi
     depmod -b kernel/ "$kern_ver"
     rm "${kernel_snap_file}"
     # append component meta-information


# Create kernel without the kernel module
rm "$module_path"
rm "${module_path[@]}"
# depmod wants a lib subdir
mkdir -p kernel/lib
ln -s ../modules kernel/lib/modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ execute: |
# check component from store has been early-installed
check_efi_pstore
# Additionally, check that modules loaded by systemd right after switch root could be loaded
lsmod | MATCH ip_tables
lsmod | MATCH ahci
# No mounts for unset versions are found
mount | not MATCH efi-pstore_unset
mount | not MATCH pc-kernel_unset
Expand All @@ -69,7 +69,7 @@ execute: |
remote.exec sudo reboot || true
tests.nested wait-for reboot "$boot_id"
check_efi_pstore
lsmod | MATCH ip_tables
lsmod | MATCH ahci

# remove kernel component
remote.exec sudo snap remove pc-kernel+"$KMOD_COMP"
Expand Down
36 changes: 26 additions & 10 deletions tests/nested/manual/muinstaller-real/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ summary: End-to-end test for install via muinstaller
details: End-to-end test for install via muinstaller

systems:
# FIXME: make it work on 26
- ubuntu-22*
- ubuntu-24*
- ubuntu-26*

environment:
# No partial gadget by default
Expand Down Expand Up @@ -153,7 +153,7 @@ execute: |
# Make sure it was loaded early
remote.exec systemctl show -p ExecMainStatus modprobe@efi_pstore.service | MATCH ExecMainStatus=0
# Additionally, check that modules loaded by systemd right after switch root could be loaded
remote.exec lsmod | MATCH ip_tables
remote.exec lsmod | MATCH ahci
# Check that the kernel-modules component can be removed
remote.exec sudo snap remove pc-kernel+efi-pstore
fi
Expand All @@ -177,13 +177,17 @@ execute: |
remote.exec "sudo test -e /var/lib/snapd/device/fde/marker"
remote.exec "sudo blkid /dev/disk/by-label/ubuntu-data-enc" | MATCH crypto_LUKS

echo "Ensure recovery keys are available on classic FDE too"
# We check for the key twice (see LP#2036631)
#shellcheck disable=SC2034
for i in 1 2; do
remote.exec "sudo snap recovery --show-keys" > show-keys.out
MATCH 'recovery:\s+[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}' < show-keys.out
done
# 25.10+ systems are not permitted to use /v2/system-recovery-keys, it can only
# show the recovery key at the point where it gets created.
if os.query is_ubuntu_lt 25.10; then
echo "Ensure recovery keys are available on classic FDE too"
# We check for the key twice (see LP#2036631)
#shellcheck disable=SC2034
for i in 1 2; do
remote.exec "sudo snap recovery --show-keys" > show-keys.out
MATCH 'recovery:\s+[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}' < show-keys.out
done
fi

# check disk mappings
# TODO: no ubuntu-save right now because:
Expand All @@ -199,9 +203,21 @@ execute: |
# check that on an already provisioned system the API will give a
# sensible reason why the system cannot be installed without further
# action.
if os.query is_ubuntu_ge 25.10; then
# satisfy preinstall check need for locating boot images
remote.exec "sudo mkdir -p /cdrom/EFI/boot/"
remote.exec "sudo touch /cdrom/EFI/boot/bootx64.efi"
remote.exec "sudo touch /cdrom/EFI/boot/grubx64.efi"
remote.exec "sudo mkdir -p /cdrom/casper"
remote.exec "sudo touch /cdrom/casper/vmlinuz"
fi
remote.exec "sudo snap debug api /v2/systems/classic" > system
gojq '.result."storage-encryption".support' < system | MATCH "unavailable"
gojq '.result."storage-encryption"."unavailable-reason"' < system | MATCH "not encrypting device storage as checking TPM gave: the TPM is in DA lockout mode"
if os.query is_ubuntu_ge 25.10; then
gojq '.result."storage-encryption"."unavailable-reason"' < system | MATCH "not encrypting device storage as checking TPM gave: error with TPM2 device: one or more of the TPM hierarchies is already owned"
else
gojq '.result."storage-encryption"."unavailable-reason"' < system | MATCH "not encrypting device storage as checking TPM gave: the TPM is in DA lockout mode"
fi
fi

if os.query is-ubuntu-ge 24.04; then
Expand Down
Loading