Skip to content

Commit

Permalink
Fix "Failed check:" messages in tests
Browse files Browse the repository at this point in the history
The message should contain description of the check that failed (not the
failure itself) to be consistent with majority of already existing
checks and the original intent.
  • Loading branch information
rvykydal committed Mar 5, 2025
1 parent 51429d9 commit bac8300
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions bootloader-1.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ shutdown
# Check the timeout.
grep "^GRUB_TIMEOUT=13$" /etc/default/grub
if [[ $? -ne 0 ]]; then
echo '*** Failed check: the timeout check failed' >> /root/RESULT
echo '*** Failed check: the timeout check' >> /root/RESULT
fi

# Check the extra args.
grep "^GRUB_CMDLINE_LINUX=" /etc/default/grub | grep "anaconda_testing_option=1"
if [[ $? -ne 0 ]]; then
echo '*** Failed check: the extra options check failed' >> /root/RESULT
echo '*** Failed check: the extra options check' >> /root/RESULT
fi

# Check the password.
grep "^GRUB2_PASSWORD=grub.pbkdf2.12345$" /boot/grub2/user.cfg
if [[ $? -ne 0 ]]; then
echo '*** Failed check: the password check failed' >> /root/RESULT
echo '*** Failed check: the password check' >> /root/RESULT
fi

# The test was successful.
Expand Down
2 changes: 1 addition & 1 deletion bootloader-2.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dd if=/dev/vda bs=512 count=1 of=/tmp/current_mbr_content.bin
# Check the MBR.
cmp /tmp/pre_install_mbr_content.bin /tmp/current_mbr_content.bin
if [[ $? -ne 1 ]]; then
echo '*** Failed check: MBR should be changed' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was changed' >> /mnt/sysroot/root/RESULT
else
echo SUCCESS > /mnt/sysroot/root/RESULT
fi
Expand Down
2 changes: 1 addition & 1 deletion bootloader-3.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dd if=/dev/vda bs=512 count=1 of=/tmp/current_mbr_content.bin
# Check the MBR.
cmp /tmp/pre_install_mbr_content.bin /tmp/current_mbr_content.bin
if [[ $? -ne 0 ]]; then
echo '*** Failed check: MBR should be the same' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was not changed' >> /mnt/sysroot/root/RESULT
else
echo SUCCESS > /mnt/sysroot/root/RESULT
fi
Expand Down
4 changes: 2 additions & 2 deletions bootloader-4.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ dd if=/dev/vdb bs=512 count=1 of=/tmp/current_mbr_vdb.bin
# Check the MBR. The boot drive is defined by --boot-drive.
cmp /tmp/pre_install_mbr_vda.bin /tmp/current_mbr_vda.bin
if [[ $? -ne 0 ]]; then
echo '*** Failed check: MBR should be the same on vda' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was not changed on vda' >> /mnt/sysroot/root/RESULT
fi

cmp /tmp/pre_install_mbr_vdb.bin /tmp/current_mbr_vdb.bin
if [[ $? -ne 1 ]]; then
echo '*** Failed check: MBR should be changed on vdb' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was changed on vdb' >> /mnt/sysroot/root/RESULT
fi

# The test was successful.
Expand Down
4 changes: 2 additions & 2 deletions bootloader-5.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ dd if=/dev/vdb bs=512 count=1 of=/tmp/current_mbr_vdb.bin
# Check the MBR. The boot drive is defined by the first usable drive from --driveorder.
cmp /tmp/pre_install_mbr_vda.bin /tmp/current_mbr_vda.bin
if [[ $? -ne 0 ]]; then
echo '*** Failed check: MBR should be the same on vda' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was not changed on vda' >> /mnt/sysroot/root/RESULT
fi

cmp /tmp/pre_install_mbr_vdb.bin /tmp/current_mbr_vdb.bin
if [[ $? -ne 1 ]]; then
echo '*** Failed check: MBR should be changed on vdb' >> /mnt/sysroot/root/RESULT
echo '*** Failed check: MBR was changed on vdb' >> /mnt/sysroot/root/RESULT
fi

# The test was successful.
Expand Down
2 changes: 1 addition & 1 deletion default-menu-auto-hide-fedora.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cat /boot/grub2/grubenv

# check the menu_auto_hide is correctly set
grep -q "menu_auto_hide=1" /boot/grub2/grubenv || \
echo "*** Failed check: The menu_auto_hide is not part of the /boot/grub2/grubenv by default" >> /root/RESULT
echo "*** Failed check: The menu_auto_hide is set to 1 in /boot/grub2/grubenv by default" >> /root/RESULT

%ksappend validation/success_if_result_empty.ks

Expand Down
2 changes: 1 addition & 1 deletion default-menu-auto-hide-rhel.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cat /boot/grub2/grubenv

# check the menu_auto_hide is correctly set
grep -q "menu_auto_hide=1" /boot/grub2/grubenv || \
echo "*** Failed check: The menu_auto_hide is not part of the /boot/grub2/grubenv by default" >> /root/RESULT
echo "*** Failed check: The menu_auto_hide is set to 1 in /boot/grub2/grubenv by default" >> /root/RESULT

%ksappend validation/success_if_result_empty.ks

Expand Down
6 changes: 3 additions & 3 deletions log-util-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RESULT_FILE=${SYSROOT}/root/RESULT
# Check if log util can be called
function check_log_util_exist() {
if [ ! -f /usr/libexec/anaconda/log-capture ]; then
echo "*** Failed check: log-capture util does not exist" >> ${RESULT_FILE}
echo "*** log-capture util does not exist" >> ${RESULT_FILE}
fi
}

Expand All @@ -18,7 +18,7 @@ function check_log_util_runs() {
ret_code=$?

if [[ $? -ne ${exit_code} ]]; then
echo "*** Failed check: log-capture util failed with code: ${ret_code}" >> ${RESULT_FILE}
echo "*** log-capture util failed with code: ${ret_code}" >> ${RESULT_FILE}
fi
}

Expand All @@ -28,6 +28,6 @@ function check_log_util_produces_log_archive() {
/usr/libexec/anaconda/log-capture

if [ ! -f /tmp/log-capture.tar.bz2 ]; then
echo "*** Failed check: log-capture util does not produced log archive" >> ${RESULT_FILE}
echo "*** log-capture util does not produced log archive" >> ${RESULT_FILE}
fi
}
2 changes: 1 addition & 1 deletion rootpw-allow-ssh.ks.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ expect -c "
login_result=$?

if [[ ${login_result} != 0 ]]; then
echo "*** Failed check: Ssh login failed with exit code ${login_result}"
echo "*** ssh login failed with exit code ${login_result}"
fi


Expand Down

0 comments on commit bac8300

Please sign in to comment.