Skip to content

Commit 402bc6c

Browse files
kelvinfan001openshift-merge-robot
authored andcommitted
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 7149cf3 commit 402bc6c

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
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+
tmpefimount=$(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+
tmpefimount=$(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/kola/data/libtest.sh

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

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

tests/kola/test-bootupd

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ function cleanup () {
1919
fi
2020
}
2121

22+
# Mount the EFI partition.
23+
tmpefimount=$(mount_tmp_efi)
2224
bootmount=/boot
23-
bootefimount=${bootmount}/efi
24-
bootefidir=${bootefimount}/EFI
25+
tmpefidir=${tmpefimount}/EFI
2526
bootupdir=/usr/lib/bootupd/updates
2627
efiupdir=${bootupdir}/EFI
2728
ostbaseefi=/usr/lib/ostree-boot/efi/EFI
@@ -103,24 +104,21 @@ bootupctl validate | tee out.txt
103104
ok validate after update
104105

105106
# FIXME see above
106-
# assert_file_has_content ${bootefidir}/${efisubdir}/somenew.efi 'somenewfile'
107-
if test -f ${bootefidir}/${efisubdir}/shim.efi; then
107+
# assert_file_has_content ${tmpefidir}/${efisubdir}/somenew.efi 'somenewfile'
108+
if test -f ${tmpefidir}/${efisubdir}/shim.efi; then
108109
fatal "failed to remove file"
109110
fi
110-
if ! grep -q 'bootupd-test-changes' ${bootefidir}/${efisubdir}/grubx64.efi; then
111+
if ! grep -q 'bootupd-test-changes' ${tmpefidir}/${efisubdir}/grubx64.efi; then
111112
fatal "failed to update modified file"
112113
fi
113-
cmp ${bootefidir}/${efisubdir}/shimx64.efi ${efiupdir}/${efisubdir}/shimx64.efi
114+
cmp ${tmpefidir}/${efisubdir}/shimx64.efi ${efiupdir}/${efisubdir}/shimx64.efi
114115
ok filesystem changes
115116

116117
bootupctl update | tee out.txt
117118
assert_file_has_content_literal out.txt 'No update available for any component'
118119
assert_not_file_has_content_literal out.txt 'Updated EFI'
119120

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
121+
echo "some additions" >> ${tmpefidir}/${efisubdir}/shimx64.efi
124122
if bootupctl validate 2>err.txt; then
125123
fatal "unexpectedly passed validation"
126124
fi

0 commit comments

Comments
 (0)