Now tarfs mode could be tested with "make check FSTYP=erofstar".

Signed-off-by: Jingbo Xu <[email protected]>
---
 tests/common/rc | 24 ++++++++++++++++++++++--
 tests/erofs/006 |  2 +-
 tests/erofs/015 |  2 +-
 tests/erofs/016 |  2 +-
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tests/common/rc b/tests/common/rc
index f54b5c1..aab1926 100644
--- a/tests/common/rc
+++ b/tests/common/rc
@@ -90,6 +90,9 @@ _require_xattr()
 {
        which setfattr >/dev/null 2>&1 ||
                _notrun "attr isn't installed, skipped."
+
+       [ $FSTYP = "erofstar" ] &&
+               _notrun "erofstar doesn't support xattr yet, skipped."
 }
 
 _require_mkfs_blksize()
@@ -197,9 +200,26 @@ _mkfs()
        return $mkfs_status
 }
 
+_scratch_mkfs_tar()
+{
+       local scratch_dir=${@:-1}
+       local mkfs_options=${@:1:$#-1}
+       local tarfile=${scratch_dir}.tar
+
+       pushd $scratch_dir
+       tar -cf $tarfile .
+       popd
+
+       _mkfs $SCRATCH_DEV --tar=f $mkfs_options $tarfile
+}
+
 _scratch_mkfs()
 {
-       _mkfs $SCRATCH_DEV "$*"
+       if [ "$FSTYP" = "erofstar" ]; then
+               _scratch_mkfs_tar "$*"
+       else
+               _mkfs $SCRATCH_DEV "$*"
+       fi
 }
 
 _test_mkfs()
@@ -216,7 +236,7 @@ _do_mount()
        local tmp=`mktemp -u`
        local mount_filter="awk '{print \$NF}' FS=":" | sed 's/^ *//g'"
 
-       eval "$MOUNT_PROG -t $FSTYP $extra_mount_options" \
+       eval "$MOUNT_PROG $extra_mount_options" \
                1>$tmp.mountstd 2>$tmp.mounterr
        mount_status=$?
 
diff --git a/tests/erofs/006 b/tests/erofs/006
index 18458b0..3a2c8c4 100755
--- a/tests/erofs/006
+++ b/tests/erofs/006
@@ -48,7 +48,7 @@ _scratch_mkfs $localdir >> $seqres.full 2>&1 || _fail "failed 
to mkfs"
 _scratch_mount 2>>$seqres.full
 
 FSSUM_OPTS="-MAC"
-[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
+[ $FSTYP = "erofsfuse" -o $FSTYP = "erofstar" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
 
 sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
 echo "$localdir checksum is $sum1" >>$seqres.full
diff --git a/tests/erofs/015 b/tests/erofs/015
index 8e562f6..c2c0c99 100755
--- a/tests/erofs/015
+++ b/tests/erofs/015
@@ -45,7 +45,7 @@ _scratch_mount 2>>$seqres.full
 
 # verify the uncompressed image
 FSSUM_OPTS="-MAC"
-[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
+[ $FSTYP = "erofsfuse" -o $FSTYP = "erofstar" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
 
 sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
 echo "$localdir checksum is $sum1" >>$seqres.full
diff --git a/tests/erofs/016 b/tests/erofs/016
index 3e84e2b..568aea6 100755
--- a/tests/erofs/016
+++ b/tests/erofs/016
@@ -51,7 +51,7 @@ _scratch_mount 2>>$seqres.full
 
 # verify the uncompressed image
 FSSUM_OPTS="-MAC"
-[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
+[ $FSTYP = "erofsfuse" -o $FSTYP = "erofstar" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
 
 sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
 echo "$localdir checksum is $sum1" >>$seqres.full
-- 
2.19.1.6.gb485710b

Reply via email to