]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests: When checking squashfs fstime, use superblock last modified time
authorGlenn Washburn <development@efficientek.com>
Wed, 13 Oct 2021 00:39:56 +0000 (19:39 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 14 Oct 2021 12:37:27 +0000 (14:37 +0200)
Currently, the filesystem timestamp check in grub-fs-tester uses the
squashfs image file's last modified timestamp and checks to see if that
time stamp is within 3 seconds of the superblock timestamp as determined by
grub. The image file's timestamp could be more than 3 seconds off if
mksquashfs takes more than 3 seconds to generate the image, as is the case
on a virtual machine. Instead use squashfs tools to get the filesystem
timestamp directly.

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

index a28e072954202072d6cb09c36b5c419195c37f4c..cba94233d0b4ab3403e880bcfce3d524c9339b41 100644 (file)
@@ -1356,6 +1356,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";;
+                   xsquash*)
+                       # Creating the squash image may take more than a few
+                       # seconds. Use the more accurate timestamp from the
+                       # superblock.
+                       FSTIME="$(unsquashfs -s "${FSIMAGEP}0.img" | grep ^Creation | awk '{print $6 " " $7 " " $8 " " $9 " " $10; }')"
+                       FSTIME="$(date -d "$FSTIME" -u '+%Y-%m-%d %H:%M:%S')";;
                    *)
                        FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGEP}0.img"|awk '{print $6; }'|sed 's,_, ,g')";;
                esac