Skip to contentSkip to conversation

tests: Add pathological iso9660 filesystem tests

PATCH Superseded Glenn Washburn 2 participants 3 messages Feb 5, 2023 – Feb 6, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Add pathological iso9660 filesystem tests

These are not added to grub-fs-tester because they are not generated and none of the filesystem tests are run on these isos. The test is to run the command "ls /" on the iso, and a failure is determined if the command times out, has non-zero return value or has any output.

---
 tests/iso9660_ce_loop.iso.gz  | Bin 0 -> 897 bytes
 tests/iso9660_ce_loop2.iso.gz | Bin 0 -> 904 bytes
 tests/iso9660_test.in         |  11 ++++++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 tests/iso9660_ce_loop.iso.gz
 create mode 100644 tests/iso9660_ce_loop2.iso.gz
tests/iso9660_ce_loop.iso.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..9c53c569b8e5c2441273d49f4c8e13e4b3303c24
GIT binary patch
tests/iso9660_ce_loop2.iso.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..f59e676475cfc8376256ba65047451b5ca969e5a
GIT binary patch
tests/iso9660_test.in +10 -1
index ed0a5bf8d4..c5212305a9 100644
@@ -12,4 +12,13 @@ fi
 "@builddir@/grub-fs-tester" rockridge_joliet
 "@builddir@/grub-fs-tester" joliet_1999
 "@builddir@/grub-fs-tester" rockridge_1999
-"@builddir@/grub-fs-tester" rockridge_joliet_1999
\ No newline at end of file
+"@builddir@/grub-fs-tester" rockridge_joliet_1999
+
+for fs in iso9660_ce_loop iso9660_ce_loop2; do
+  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"
+  output=$(LC_ALL=C timeout -s KILL "60" \
+    "@builddir@/grub-fstest" "${tempdir}/${fs}.iso" ls / )
+  test "$?" -eq 0 -a -z "$output"
+done
Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 13 lines · Glenn Washburn
tests/iso9660_test.in +4 -1
@@ -12,4 +12,13 @@ fi
 "@builddir@/grub-fs-tester" rockridge_joliet
 "@builddir@/grub-fs-tester" joliet_1999
 "@builddir@/grub-fs-tester" rockridge_1999
-"@builddir@/grub-fs-tester" rockridge_joliet_1999
\ No newline at end of file
+"@builddir@/grub-fs-tester" rockridge_joliet_1999
+
+for fs in iso9660_ce_loop iso9660_ce_loop2; do
+  tempdir=`mktemp -d "${TMPDIR:-/tmp}/${0##*/}.$(date

'+%Y%m%d%H%M%S%N').${fs}.XXX"` ||

tests/iso9660_test.in fi · line 24

Quoted 6 lines
tests/iso9660_test.in +6 -0
+    { echo "Failed to make temporary directory"; exit 99; }
+  gunzip <"$srcdir"/tests/${fs}.iso.gz >"${tempdir}/${fs}.iso"
+  output=$(LC_ALL=C timeout -s KILL "60" \
+    "@builddir@/grub-fstest" "${tempdir}/${fs}.iso" ls / )
+  test "$?" -eq 0 -a -z "$output"
+done

Shouldn't the decompressed files and the temporary directory be removed afterwards ?

Have a nice day :)

Thomas

#2 lore raw
Quoted 17 lines · On Sun, 05 Feb 2023 09:24:21 +0100 "Thomas Schmitt" <[email protected]> wrote:

Hi,

Quoted 14 lines · Glenn Washburn
tests/iso9660_test.in +4 -1
@@ -12,4 +12,13 @@ fi
 "@builddir@/grub-fs-tester" rockridge_joliet
 "@builddir@/grub-fs-tester" joliet_1999
 "@builddir@/grub-fs-tester" rockridge_1999
-"@builddir@/grub-fs-tester" rockridge_joliet_1999
\ No newline at end of file
+"@builddir@/grub-fs-tester" rockridge_joliet_1999
+
+for fs in iso9660_ce_loop iso9660_ce_loop2; do
+  tempdir=`mktemp -d "${TMPDIR:-/tmp}/${0##*/}.$(date

'+%Y%m%d%H%M%S%N').${fs}.XXX"` ||
+ { echo "Failed to make temporary directory"; exit 99; }

Quoted 8 lines

tests/iso9660_test.in fi · line 24

Quoted 5 lines
tests/iso9660_test.in +5 -0
+  gunzip <"$srcdir"/tests/${fs}.iso.gz >"${tempdir}/${fs}.iso"
+  output=$(LC_ALL=C timeout -s KILL "60" \
+    "@builddir@/grub-fstest" "${tempdir}/${fs}.iso" ls / )
+  test "$?" -eq 0 -a -z "$output"
+done

Shouldn't the decompressed files and the temporary directory be removed afterwards ?

Yes, good catch. I'll update.

Glenn