]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests: Add test for iso9660 delayed CE hop
authorThomas Schmitt <scdbackup@gmx.net>
Tue, 7 Mar 2023 16:56:51 +0000 (17:56 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 13 Apr 2023 12:54:20 +0000 (14:54 +0200)
The ISO filesystem image iso9660_early_ce.iso exposes the unusual
situation that the Rock Ridge name entry of its only file is located
after a CE entry which points to the next continuation area.

The correct behavior is to read the Rock Ridge name and to only then
load the next continuation area. If GRUB performs this correctly, then
the name "RockRidgeName:x" will be read and reported by grub-fstest.
If GRUB wrongly performs the CE hop immediately when encountering the CE
entry, then the dull ISO 9660 name "rockridg" will not be overridden and
be put out by grub-fstest.

Signed-off-by: Thomas Schmitt <scdbackup@gmx.net>
Tested-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
tests/iso9660_early_ce.iso.gz [new file with mode: 0644]
tests/iso9660_test.in

diff --git a/tests/iso9660_early_ce.iso.gz b/tests/iso9660_early_ce.iso.gz
new file mode 100644 (file)
index 0000000..df4ef5f
Binary files /dev/null and b/tests/iso9660_early_ce.iso.gz differ
index 44bc08c6dfe055a0f29770bfef04e7c98c2642a4..a1f752adfaff9452fedeb6e5f7d3ef5a50b8c275 100644 (file)
@@ -28,3 +28,26 @@ for fs in iso9660_ce_loop iso9660_ce_loop2; do
   fi
 done
 echo "PASS"
+
+echo "Testing for proper handling of early CE ... "
+fs=iso9660_early_ce
+tempdir=`mktemp -d "${TMPDIR:-/tmp}/${0##*/}.$(date '+%Y%m%d%H%M%S%N').${fs}.XXX"` ||
+  { echo "Failed to make temporary directory"; exit 99; }
+gunzip <"$srcdir"/tests/${fs}.iso.gz >"${tempdir}/${fs}.iso" || exit 99
+ret=0
+output=$(LC_ALL=C timeout -s KILL "60" \
+  "@builddir@/grub-fstest" "${tempdir}/${fs}.iso" ls / ) || ret=$?
+rm -rf "$tempdir"
+if [ "${ret:-0}" -ne 0 ]; then
+  echo "... grub-fstest returns $ret"
+  echo "FAIL ($fs)"
+  exit 1
+fi
+# Before comparing: remove trailing blank added by grub-fstest
+output=$(echo -n $output)
+if [ x"$output" != x"RockRidgeName:x" ]; then
+  echo "... found: '$output' , expected: 'RockRidgeName:x'"
+  echo "FAIL ($fs)"
+  exit 1
+fi
+echo "PASS"