]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests/erofs_test: Improve accuracy of FSTIME check
authorGlenn Washburn <development@efficientek.com>
Thu, 13 Nov 2025 03:10:42 +0000 (21:10 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 18 Nov 2025 11:49:32 +0000 (12:49 +0100)
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".

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
tests/util/grub-fs-tester.in

index 5b15007e53f932786d96af14034fadf772805724..bfb7b05536f70c522ba75e805e014c0b908a56ce 100644 (file)
@@ -1502,6 +1502,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