[PATCH 1/4] tests/erofs_test: Only test and set labels if supported by erofs-utils

Glenn Washburn <[email protected]>
Newsgroups org.gnu.grub-devel
Message-ID <528a6de20462bcb72240821fe61a7eee1fb949c1.1762657969.git.development@efficientek.com>
Support for setting the label of an erofs volume was added in version 1.6
of erofs-utils. However, current Debian 12 has version 1.5. This causes
the erofs filesystem tests to fail when trying to create a volume with a
label. Check version of mkfs.erofs and if its 1.6 or above set the label,
otherwise do not and disable the label check.

Signed-off-by: Glenn Washburn <[email protected]>
---
 tests/util/grub-fs-tester.in | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
index f83af652f6cc..37f54fabe8f1 100644
--- a/tests/util/grub-fs-tester.in
+++ b/tests/util/grub-fs-tester.in
@@ -595,6 +595,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		x"cpio_"* | x"tarfs" | x"squash4_"* | x"minix" | x"minix2" \
 		    | x"minix3" | xreiserfs_old)
 		    NOFSLABEL=y;;
+		x"erofs_"*)
+		    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
+			NOFSLABEL=y
+			unset FSLABEL
+		    fi;;
 	    esac
 
 	    PDIRCOMPNUM=210
@@ -1121,16 +1127,16 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		    echo mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE
 		    mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;;
 		x"erofs_compact")
-			echo mkfs.erofs -Eforce-inode-compact -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
-			mkfs.erofs -Eforce-inode-compact -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			echo mkfs.erofs -Eforce-inode-compact ${FSLABEL:+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			mkfs.erofs -Eforce-inode-compact ${FSLABEL+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
 			;;
 		x"erofs_extended")
-			echo mkfs.erofs -Eforce-inode-extended -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
-			mkfs.erofs -Eforce-inode-extended -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			echo mkfs.erofs -Eforce-inode-extended ${FSLABEL+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			mkfs.erofs -Eforce-inode-extended ${FSLABEL+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
 			;;
 		x"erofs_chunk")
-			echo mkfs.erofs --chunksize=1048576 -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
-			mkfs.erofs --chunksize=1048576 -L "$FSLABEL" "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			echo mkfs.erofs --chunksize=1048576 ${FSLABEL+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
+			mkfs.erofs --chunksize=1048576 ${FSLABEL+-L "$FSLABEL"} "${FSIMAGEP}0.img" "$MNTPOINTRW"
 			;;
 		x"bfs")
 		    sleep 1
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.