Skip to content

Commit e45e89e

Browse files
committed
test: fix grep error
1 parent 6fdfdf5 commit e45e89e

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ if ! test -f ${stampfile}; then
1818
fatal "already at ${TARGET_COMMIT}"
1919
fi
2020

21-
current_grub=$(rpm -q --queryformat='%{nevra}\n' ${TARGET_GRUB_NAME})
22-
if test "${current_grub}" == "${TARGET_GRUB_PKG}"; then
23-
fatal "Current grub ${current_grub} is same as target ${TARGET_GRUB_PKG}"
21+
current_grub=$(rpm -q --queryformat='%{evr}\n' ${TARGET_GRUB_NAME})
22+
if test "${current_grub}" == "${TARGET_GRUB_EVR}"; then
23+
fatal "Current grub ${current_grub} is same as target ${TARGET_GRUB_EVR}"
2424
fi
2525

2626
# FIXME
@@ -53,10 +53,10 @@ ok validate
5353

5454
bootupctl status | tee out.txt
5555
assert_file_has_content_literal out.txt 'Component EFI'
56-
assert_file_has_content_literal out.txt ' Installed: grub2-efi-x64-'
56+
assert_file_has_content_literal out.txt ' Installed: grub2-1:'
5757
assert_not_file_has_content out.txt ' Installed:.*test-bootupd-payload'
58-
assert_not_file_has_content out.txt ' Installed:.*'"${TARGET_GRUB_PKG}"
59-
assert_file_has_content out.txt 'Update: Available:.*'"${TARGET_GRUB_PKG}"
58+
assert_not_file_has_content out.txt ' Installed:.*'"${TARGET_GRUB_EVR}"
59+
assert_file_has_content out.txt 'Update: Available:.*'"${TARGET_GRUB_EVR}"
6060
assert_file_has_content out.txt 'Update: Available:.*test-bootupd-payload-1.0'
6161
bootupctl status --print-if-available > out.txt
6262
assert_file_has_content_literal 'out.txt' 'Updates available: BIOS EFI'
@@ -74,7 +74,7 @@ assert_file_has_content err.txt "error: .*synthetic failpoint"
7474

7575
bootupctl update -vvv | tee out.txt
7676
assert_file_has_content out.txt "Previous EFI: .*"
77-
assert_file_has_content out.txt "Updated EFI: ${TARGET_GRUB_PKG}.*,test-bootupd-payload-1.0"
77+
assert_file_has_content out.txt "Updated EFI: .*${TARGET_GRUB_EVR}.*,test-bootupd-payload-1.0"
7878

7979
assert_file_has_content ${tmpefimount}/EFI/fedora/test-bootupd.efi test-payload
8080

tests/e2e-update/e2e-update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ case $(arch) in
7777
*) fatal "Unhandled arch $(arch)";;
7878
esac
7979
target_grub_name=grub2-efi-${grubarch}
80-
target_grub_pkg=$(rpm -qp --queryformat='%{nevra}\n' ${overrides}/rpm/${target_grub_name}-2*.rpm)
80+
target_grub_evr=$(rpm -qp --queryformat='%{evr}\n' ${overrides}/rpm/${target_grub_name}-2*.rpm)
8181
target_commit=$(cosa meta --get-value ostree-commit)
8282
echo "Target commit: ${target_commit}"
8383
# For some reason 9p can't write to tmpfs
@@ -97,7 +97,7 @@ systemd:
9797
RemainAfterExit=yes
9898
Environment=TARGET_COMMIT=${target_commit}
9999
Environment=TARGET_GRUB_NAME=${target_grub_name}
100-
Environment=TARGET_GRUB_PKG=${target_grub_pkg}
100+
Environment=TARGET_GRUB_EVR=${target_grub_evr}
101101
Environment=SRCDIR=/run/bootupd-source
102102
# Run via shell because selinux denies systemd writing to 9p apparently
103103
ExecStart=/bin/sh -c '/run/bootupd-source/${testprefix}/e2e-update-in-vm.sh &>>/run/testtmp/out.txt; test -f /run/rebooting || poweroff -ff'

tests/kola/test-bootupd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ prepare_efi_update() {
4141
}
4242

4343
bootupctl status > out.txt
44+
evr=$(rpm -q grub2-common --qf '%{EVR}')
4445
assert_file_has_content_literal out.txt 'Component EFI'
45-
assert_file_has_content_literal out.txt ' Installed: grub2-efi-x64-'
46+
assert_file_has_content_literal out.txt ' Installed: grub2-'"${evr}"
4647
assert_file_has_content_literal out.txt 'Update: At latest version'
4748
assert_file_has_content out.txt '^CoreOS aleph version:'
4849
ok status
@@ -78,21 +79,21 @@ mv new.json ${bootupdir}/EFI.json
7879

7980
bootupctl status | tee out.txt
8081
assert_file_has_content_literal out.txt 'Component EFI'
81-
assert_file_has_content_literal out.txt ' Installed: grub2-efi-x64-'
82-
assert_not_file_has_content out.txt ' Installed: grub2-efi-x64.*,test'
82+
assert_file_has_content_literal out.txt ' Installed: grub2-'"${evr}"
83+
assert_not_file_has_content out.txt ' Installed: grub2-.*,test'
8384
assert_file_has_content_literal out.txt 'Update: Available:'
8485
ok update avail
8586

8687
bootupctl status --json > status.json
8788
jq -r '.components.EFI.installed.version' < status.json > installed.txt
88-
assert_file_has_content installed.txt '^grub2-efi-x64'
89+
assert_file_has_content installed.txt '^grub2-'"${evr}"
8990

9091
bootupctl update | tee out.txt
91-
assert_file_has_content out.txt 'Updated EFI: grub2-efi-x64.*,test'
92+
assert_file_has_content out.txt 'Updated EFI: grub2-.*,test'
9293

9394
bootupctl status > out.txt
9495
assert_file_has_content_literal out.txt 'Component EFI'
95-
assert_file_has_content out.txt ' Installed: grub2-efi-x64.*,test'
96+
assert_file_has_content out.txt ' Installed: grub2-.*,test'
9697
assert_file_has_content_literal out.txt 'Update: At latest version'
9798
ok status after update
9899

0 commit comments

Comments
 (0)