127 lines
4 KiB
Diff
127 lines
4 KiB
Diff
|
diff -Nuar --unified --recursive --text --color a/mkinitcpio-39.1/test/cases/mkinitcpio.bats b/mkinitcpio-39.1/test/cases/mkinitcpio.bats
|
||
|
--- a/mkinitcpio-39.1/test/cases/mkinitcpio.bats 2024-05-14 16:09:00.116149829 +1100
|
||
|
+++ b/mkinitcpio-39.1/test/cases/mkinitcpio.bats 2024-05-14 16:18:59.927260425 +1100
|
||
|
@@ -28,122 +28,6 @@
|
||
|
cmp "$tmpdir/initramfs-1.img" "$tmpdir/initramfs-2.img"
|
||
|
}
|
||
|
|
||
|
-__validate_uki() {
|
||
|
- if [[ ! -d "/lib/modules/$(uname -r)/" ]]; then
|
||
|
- skip "No kernel modules available"
|
||
|
- fi
|
||
|
-
|
||
|
- local mode="$1" tmpdir kver
|
||
|
- shift
|
||
|
- tmpdir="$(mktemp -d --tmpdir="$BATS_RUN_TMPDIR" "${BATS_TEST_NAME}.XXXXXX")"
|
||
|
- kver="$(uname -r)"
|
||
|
-
|
||
|
- tmp_knl="$(__gen_test_kernel "$kver")"
|
||
|
- ln -s "$tmp_knl" "$tmpdir/linux.in"
|
||
|
- printf '%s' "$kver" > "$tmpdir/uname.in"
|
||
|
- printf 'VERSION_ID=%s\n' "$kver" > "$tmpdir/osrel.in"
|
||
|
- grep -v '^VERSION_ID=' /etc/os-release >> "$tmpdir/osrel.in"
|
||
|
- printf '%s' 'root=gpt-auto rw' > "$tmpdir/cmdline.in"
|
||
|
- ln -s "$BATS_TEST_DIRNAME/../fixtures/uki/splash.bmp" "$tmpdir/splash.in"
|
||
|
-
|
||
|
- echo 'HOOKS=(base)' > "$tmpdir/mkinitcpio.conf"
|
||
|
- run ./mkinitcpio \
|
||
|
- -t "$tmpdir" \
|
||
|
- -D "${PWD}" \
|
||
|
- -c "$tmpdir/mkinitcpio.conf" \
|
||
|
- --kernel "$tmpdir/linux.in" \
|
||
|
- --generate "$tmpdir/initrd.in" \
|
||
|
- --cmdline "$tmpdir/cmdline.in" \
|
||
|
- --osrelease "$tmpdir/osrel.in" \
|
||
|
- --splash "$tmpdir/splash.in" \
|
||
|
- --uki "$tmpdir/uki.efi" \
|
||
|
- --verbose "$@"
|
||
|
- assert_success
|
||
|
- assert_output --partial "Using $mode to build UKI"
|
||
|
- assert_output --partial "Assembling UKI: $mode "
|
||
|
-
|
||
|
- printf ' \n\0' >> "$tmpdir/cmdline.in"
|
||
|
-
|
||
|
- objcopy \
|
||
|
- --dump-section ".linux=$tmpdir/linux.out" \
|
||
|
- --dump-section ".initrd=$tmpdir/initrd.out" \
|
||
|
- --dump-section ".uname=$tmpdir/uname.out" \
|
||
|
- --dump-section ".osrel=$tmpdir/osrel.out" \
|
||
|
- --dump-section ".cmdline=$tmpdir/cmdline.out" \
|
||
|
- --dump-section ".splash=$tmpdir/splash.out" \
|
||
|
- "$tmpdir/uki.efi"
|
||
|
-
|
||
|
- cmp "$tmpdir"/linux.{in,out}
|
||
|
- cmp "$tmpdir"/initrd.{in,out}
|
||
|
- cmp "$tmpdir"/uname.{in,out}
|
||
|
- cmp "$tmpdir"/osrel.{in,out}
|
||
|
- cmp "$tmpdir"/cmdline.{in,out}
|
||
|
- cmp "$tmpdir"/splash.{in,out}
|
||
|
-}
|
||
|
-
|
||
|
-@test "test creating UKI with ukify" {
|
||
|
- if ! command -v ukify &>/dev/null; then
|
||
|
- skip "ukify is not available"
|
||
|
- fi
|
||
|
- __validate_uki ukify --ukiconfig /dev/null
|
||
|
-}
|
||
|
-
|
||
|
-@test "test creating UKI with objcopy" {
|
||
|
- __validate_uki objcopy --no-ukify
|
||
|
-}
|
||
|
-
|
||
|
-@test "test reproducible builds for UKI" {
|
||
|
- if [[ ! -d "/lib/modules/$(uname -r)/" ]]; then
|
||
|
- skip "No kernel modules available"
|
||
|
- fi
|
||
|
-
|
||
|
- local tmpdir
|
||
|
- tmpdir="$(mktemp -d --tmpdir="$BATS_RUN_TMPDIR" "${BATS_TEST_NAME}.XXXXXX")"
|
||
|
-
|
||
|
- echo "HOOKS=(base)" >> "$tmpdir/mkinitcpio.conf"
|
||
|
-
|
||
|
- ./mkinitcpio \
|
||
|
- -D "${PWD}" \
|
||
|
- -c "$tmpdir/mkinitcpio.conf" \
|
||
|
- --uki "$tmpdir/uki-1.efi" \
|
||
|
- --no-ukify
|
||
|
-
|
||
|
- ./mkinitcpio \
|
||
|
- -D "${PWD}" \
|
||
|
- -c "$tmpdir/mkinitcpio.conf" \
|
||
|
- --uki "$tmpdir/uki-2.efi" \
|
||
|
- --no-ukify
|
||
|
-
|
||
|
- sha256sum "$tmpdir/uki-1.efi" "$tmpdir/uki-2.efi"
|
||
|
- cmp "$tmpdir/uki-1.efi" "$tmpdir/uki-2.efi"
|
||
|
-}
|
||
|
-
|
||
|
-@test "test creating UKI with no cmdline" {
|
||
|
- bats_require_minimum_version 1.5.0
|
||
|
- if [[ ! -d "/lib/modules/$(uname -r)/" ]]; then
|
||
|
- skip 'No kernel modules available'
|
||
|
- fi
|
||
|
-
|
||
|
- local tmpdir
|
||
|
- tmpdir="$(mktemp -d --tmpdir="$BATS_RUN_TMPDIR" "${BATS_TEST_NAME}.XXXXXX")"
|
||
|
-
|
||
|
- printf '%s\n' 'HOOKS=(base)' > "${tmpdir}/mkinitcpio.conf"
|
||
|
-
|
||
|
- ./mkinitcpio \
|
||
|
- -D "${PWD}" \
|
||
|
- -c "${tmpdir}/mkinitcpio.conf" \
|
||
|
- --uki "${tmpdir}/uki.efi" \
|
||
|
- --no-ukify \
|
||
|
- --no-cmdline
|
||
|
-
|
||
|
- run objdump -h "${tmpdir}/uki.efi"
|
||
|
- assert_success
|
||
|
- refute_output --partial ' .cmdline '
|
||
|
- assert_output --partial ' .linux '
|
||
|
- assert_output --partial ' .initrd '
|
||
|
- assert_output --partial ' .uname '
|
||
|
-}
|
||
|
-
|
||
|
@test "test early cpio creation" {
|
||
|
if [[ ! -d "/lib/modules/$(uname -r)/" ]]; then
|
||
|
skip "No kernel modules available"
|