Skip to content

Commit 0b875d0

Browse files
committed
tests: Mount ESP before operations
Following coreos/fedora-coreos-config#794, the ESP will no longer be mounted in /boot. Adjust tests to mount it before reading from it.
1 parent a3bee28 commit 0b875d0

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

tests/e2e-adopt/e2e-adopt-in-vm.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ if test "$semode" != Enforcing; then
8080
fatal "SELinux mode is ${semode}"
8181
fi
8282

83-
source_grub_cfg=$(find /boot/efi/EFI -name grub.cfg)
83+
# Mount the EFI partition.
84+
mount_tmp_efi
85+
86+
source_grub_cfg=$(find ${tmpefimount}/EFI -name grub.cfg)
8487
test -f "${source_grub_cfg}"
8588

86-
source_grub=$(find /boot/efi/EFI -name grubx64.efi)
89+
source_grub=$(find ${tmpefimount}/EFI -name grubx64.efi)
8790
test -f ${source_grub}
8891
source_grub_sha256=$(sha256sum ${source_grub} | cut -f 1 -d ' ')
8992

tests/e2e-update/e2e-update-in-vm.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ bootupctl status --print-if-available > out.txt
6464
assert_file_has_content_literal 'out.txt' 'Updates available: EFI'
6565
ok update avail
6666

67-
assert_not_has_file /boot/efi/EFI/fedora/test-bootupd.efi
67+
# Mount the EFI partition.
68+
mount_tmp_efi
69+
70+
assert_not_has_file ${tmpefimount}/EFI/fedora/test-bootupd.efi
6871

6972
bootupctl update | tee out.txt
7073
assert_file_has_content out.txt "Updated EFI: ${TARGET_GRUB_PKG}.*,test-bootupd-payload-1.0"
7174

72-
assert_file_has_content /boot/efi/EFI/fedora/test-bootupd.efi test-payload
75+
assert_file_has_content ${tmpefimount}/EFI/fedora/test-bootupd.efi test-payload
7376

7477
bootupctl status --print-if-available > out.txt
7578
if test -s out.txt; then

tests/e2e-update/e2e-update.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ test -f ${bootupd_git}/systemd/bootupd.service
2121
testtmp=$(mktemp -d -p /var/tmp bootupd-e2e.XXXXXXX)
2222
export test_tmpdir=${testtmp}
2323

24+
# Mount the EFI partition.
25+
mount_tmp_efi
26+
2427
# This is new content for our update
25-
test_bootupd_payload_file=/boot/efi/EFI/fedora/test-bootupd.efi
28+
test_bootupd_payload_file=${tmpefimount}/EFI/fedora/test-bootupd.efi
2629
build_rpm test-bootupd-payload \
2730
files ${test_bootupd_payload_file} \
2831
install "mkdir -p %{buildroot}/$(dirname ${test_bootupd_payload_file})

tests/kola/data/libtest.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,10 @@ assert_not_file_has_content_literal () {
8181
done
8282
}
8383

84+
# Mount the EFI partition at a temporary location.
85+
tmpefimount=/tmp/efi
86+
efipart=/dev/disk/by-partlabel/EFI-SYSTEM
87+
mount_tmp_efi () {
88+
mkdir -p ${tmpefimount}
89+
mount ${efipart} ${tmpefimount}
90+
}

tests/kola/test-bootupd

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ function cleanup () {
2020
}
2121

2222
bootmount=/boot
23-
bootefimount=${bootmount}/efi
24-
bootefidir=${bootefimount}/EFI
23+
tmpefimount=/tmp/efi
24+
tmpefidir=${tmpefimount}/EFI
2525
bootupdir=/usr/lib/bootupd/updates
2626
efiupdir=${bootupdir}/EFI
2727
ostbaseefi=/usr/lib/ostree-boot/efi/EFI
2828
efisubdir=fedora
2929
efidir=${efiupdir}/${efisubdir}
3030
ostefi=${ostbaseefi}/${efisubdir}
3131
shim=shimx64.efi
32+
efipart=/dev/disk/by-partlabel/EFI-SYSTEM
3233

3334
test -f "${efidir}/${shim}"
3435

@@ -102,25 +103,25 @@ ok status after update
102103
bootupctl validate | tee out.txt
103104
ok validate after update
104105

106+
# Mount the EFI partition.
107+
mkdir -p ${tmpefimount}
108+
mount ${efipart} ${tmpefimount}
105109
# FIXME see above
106-
# assert_file_has_content ${bootefidir}/${efisubdir}/somenew.efi 'somenewfile'
107-
if test -f ${bootefidir}/${efisubdir}/shim.efi; then
110+
# assert_file_has_content ${tmpefidir}/${efisubdir}/somenew.efi 'somenewfile'
111+
if test -f ${tmpefidir}/${efisubdir}/shim.efi; then
108112
fatal "failed to remove file"
109113
fi
110-
if ! grep -q 'bootupd-test-changes' ${bootefidir}/${efisubdir}/grubx64.efi; then
114+
if ! grep -q 'bootupd-test-changes' ${tmpefidir}/${efisubdir}/grubx64.efi; then
111115
fatal "failed to update modified file"
112116
fi
113-
cmp ${bootefidir}/${efisubdir}/shimx64.efi ${efiupdir}/${efisubdir}/shimx64.efi
117+
cmp ${tmpefidir}/${efisubdir}/shimx64.efi ${efiupdir}/${efisubdir}/shimx64.efi
114118
ok filesystem changes
115119

116120
bootupctl update | tee out.txt
117121
assert_file_has_content_literal out.txt 'No update available for any component'
118122
assert_not_file_has_content_literal out.txt 'Updated EFI'
119123

120-
# Ensure /boot and /boot/efi can be written to
121-
mount -o remount,rw ${bootmount}
122-
mount -o remount,rw ${bootefimount}
123-
echo "some additions" >> ${bootefidir}/${efisubdir}/shimx64.efi
124+
echo "some additions" >> ${tmpefidir}/${efisubdir}/shimx64.efi
124125
if bootupctl validate 2>err.txt; then
125126
fatal "unexpectedly passed validation"
126127
fi

0 commit comments

Comments
 (0)