Skip to contentSkip to conversation

EROFS test fixes and improvements

PATCH In review Glenn Washburn 3 participants 7 messages Nov 13, 2025

lore
Share & tools
lore
#0 lore raw

v3 cover EROFS test fixes and improvements

v3:
* Update patch #1 to include Daniel's suggestions
v2:
* The first patch was from the wrong branch and needed to be modified.

Glenn

Glenn Washburn (4):
tests/erofs_test: Fix mkfs.erofs version test to not use process
substitution bashism
tests/erofs_test: Remove root check
tests/erofs_test: Disable filetime check for erofs_compact tests/erofs_test: Improve accuracy of FSTIME check

 tests/erofs_test.in          |  8 --------
 tests/util/grub-fs-tester.in | 17 ++++++++++++++---
 2 files changed, 14 insertions(+), 11 deletions(-)

Range-diff against v2:
1: eb61a73942f5 ! 1: 1126cf87cc17 tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism

    @@ tests/util/grub-fs-tester.in: for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLO
      		    NOFSLABEL=y;;
      		x"erofs_"*)
     -		    MKFS_EROFS_VERSION=$(mkfs.erofs -V 2>/dev/null | tr ' ' '\n' | grep '^[0-9]')
    --		    # check if the version is at least 1.6
    ++		    MKFS_EROFS_VERSION=$(mkfs.erofs 2>/dev/null | head -n 1 | (read _ V; echo $V))
    + 		    # check if the version is at least 1.6
     -		    if [ $(sort -V <(echo "$MKFS_EROFS_VERSION") <(echo "1.6") | head -n 1) != "1.6" ]; then
    -+		    VER=$(mkfs.erofs 2>/dev/null | head -n1 | (read _ V; echo $V))
    -+		    if [ "$(echo -e "${VER}\n1.6" | sort -V | head -n1)" != "1.6" ]; then
    ++		    if [ "$(echo -e "${MKFS_EROFS_VERSION}\n1.6" | sort -V | head -n 1)" != "1.6" ]; then
      			NOFSLABEL=y
     -		    fi
     +			unset FSLABEL
2:  a1d8b6d3b6fa = 2:  742e1e6abe49 tests/erofs_test: Remove root check
3:  7883a9f3b23c = 3:  afbc5532b661 tests/erofs_test: Disable filetime check for erofs_compact
4:  9b82fc4ed65e = 4:  46dd18499a81 tests/erofs_test: Improve accuracy of FSTIME check
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH v3 1/4 tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism

The shell used to run the tests is generally /bin/sh, which does not support process substitution.

Fixes b990df0bef9e (tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester)
---
 tests/util/grub-fs-tester.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/util/grub-fs-tester.in +4 -3
index 126f19a7e882..f29436d927dc 100644
@@ -596,11 +596,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		    | x"minix3" | xreiserfs_old)
 		    NOFSLABEL=y;;
 		x"erofs_"*)
-		    MKFS_EROFS_VERSION=$(mkfs.erofs -V 2>/dev/null | tr ' ' '\n' | grep '^[0-9]')
+		    MKFS_EROFS_VERSION=$(mkfs.erofs 2>/dev/null | head -n 1 | (read _ V; echo $V))
 		    # check if the version is at least 1.6
-		    if [ $(sort -V <(echo "$MKFS_EROFS_VERSION") <(echo "1.6") | head -n 1) != "1.6" ]; then
+		    if [ "$(echo -e "${MKFS_EROFS_VERSION}\n1.6" | sort -V | head -n 1)" != "1.6" ]; then
 			NOFSLABEL=y
-		    fi
+			unset FSLABEL
+		    fi;;
 	    esac
 
 	    PDIRCOMPNUM=210
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v3 1/4
#2 lore raw

Re: [PATCH v3 1/4] tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism

Quoted 5 lines · Glenn Washburn

The shell used to run the tests is generally /bin/sh, which does not support process substitution.

Fixes b990df0bef9e (tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester)

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#3 lore raw

PATCH v3 2/4 tests/erofs_test: Remove root check

In reply to Glenn Washburn

The erofs tests do not ever mount the generated erofs image. So root is not needed, as with the squashfs and iso9660 filesystems.

---
 tests/erofs_test.in | 8 --------
 1 file changed, 8 deletions(-)
tests/erofs_test.in +0 -8
index 51111627acec..5b7678b1e234 100644
@@ -2,14 +2,6 @@
 
 set -e
 
-if [ "x$EUID" = "x" ] ; then
-  EUID=`id -u`
-fi
-
-if [ "$EUID" != 0 ] ; then
-   exit 99
-fi
-
 if ! which mkfs.erofs >/dev/null 2>&1; then
    echo "mkfs.erofs not installed; cannot test erofs."
    exit 99
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw

PATCH v3 3/4 tests/erofs_test: Disable filetime check for erofs_compact

In reply to Glenn Washburn

Compact EROFS inodes do not allow for modification times that are different from FS creation times. The file modification time check is done between the EROFS image and the file system where test temporary files are written to, not the files as seen from the mounted EROFS image. So its likely that the file modification time will be different, more so when run on slower systems.

---
 tests/util/grub-fs-tester.in | 4 ++++
 1 file changed, 4 insertions(+)
tests/util/grub-fs-tester.in +4 -0
index f29436d927dc..ef0d7e08593e 100644
@@ -587,6 +587,10 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		# FS LIMITATION: romfs has no timestamps.
 		x"romfs")
 		    NOFILETIME=y; NOFSTIME=y;;
+		# FS LIMITATION: Compact inodes do not allow for modification
+		#   times that are different from FS creation times.
+		x"erofs_compact")
+		    NOFILETIME=y;;
 	    esac
 
 	    NOFSLABEL=n
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw

PATCH v3 4/4 tests/erofs_test: Improve accuracy of FSTIME check

In reply to Glenn Washburn

On resource constrained test runs, the last modification time on the image is an unreliable date to check against the filesystem creation time. Use dump.erofs to get the filesystem creation time from the superblock. This should get the timestamp as shown by GRUB's ls -l.

---
 tests/util/grub-fs-tester.in | 6 ++++++
 1 file changed, 6 insertions(+)
tests/util/grub-fs-tester.in +6 -0
index ef0d7e08593e..00e5e22e1793 100644
@@ -1495,6 +1495,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 			# With some abstractions like mdraid flushing to disk
 			# may be delayed for a long time.
 			FSTIME="$UMOUNT_TIME";;
+		    x"erofs_"*)
+			# Creating the erofs image may take more than a few
+			# seconds. Use the more accurate timestamp from the
+			# superblock.
+			FSTIME="$(dump.erofs -s "${FSIMAGEP}0.img" | grep ^"Filesystem created:" | (read _ _ REST; echo $REST) )"
+			FSTIME="$(date -d "$FSTIME" -u '+%Y-%m-%d %H:%M:%S')";;
 		    xsquash*)
 			# Creating the squash image may take more than a few
 			# seconds. Use the more accurate timestamp from the
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on the v3 series
#6 lore raw
In reply to Glenn Washburn
Quoted 25 lines · Glenn Washburn

v3:
* Update patch #1 to include Daniel's suggestions
v2:
* The first patch was from the wrong branch and needed to be modified.

Glenn

Glenn Washburn (4):
tests/erofs_test: Fix mkfs.erofs version test to not use process
substitution bashism
tests/erofs_test: Remove root check
tests/erofs_test: Disable filetime check for erofs_compact tests/erofs_test: Improve accuracy of FSTIME check

tests/erofs_test.in | 8 --------
tests/util/grub-fs-tester.in | 17 ++++++++++++++---

2 files changed, 14 insertions(+), 11 deletions(-)

Range-diff against v2:
1: eb61a73942f5 ! 1: 1126cf87cc17 tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism
@@ tests/util/grub-fs-tester.in: for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLO

Quoted 18 lines
         NOFSLABEL=y;;
      x"erofs_"*)
    -    MKFS_EROFS_VERSION=$(mkfs.erofs -V 2>/dev/null | tr ' ' '\n' | grep '^[0-9]')
   --    # check if the version is at least 1.6
   ++    MKFS_EROFS_VERSION=$(mkfs.erofs 2>/dev/null | head -n 1 | (read _ V; echo $V))
   +    # check if the version is at least 1.6
    -    if [ $(sort -V <(echo "$MKFS_EROFS_VERSION") <(echo "1.6") | head -n 1) != "1.6" ]; then
   -+    VER=$(mkfs.erofs 2>/dev/null | head -n1 | (read _ V; echo $V))
   -+    if [ "$(echo -e "${VER}\n1.6" | sort -V | head -n1)" != "1.6" ]; then
   ++    if [ "$(echo -e "${MKFS_EROFS_VERSION}\n1.6" | sort -V | head -n 1)" != "1.6" ]; then
      NOFSLABEL=y
    -    fi
    + unset FSLABEL
2:  a1d8b6d3b6fa = 2:  742e1e6abe49 tests/erofs_test: Remove root check
3:  7883a9f3b23c = 3:  afbc5532b661 tests/erofs_test: Disable filetime check for erofs_compact
4:  9b82fc4ed65e = 4:  46dd18499a81 tests/erofs_test: Improve accuracy of FSTIME check
Signature · 1 line
2.34.1

Thanks,
Sudhakar

Quoted 6 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel