erofs-utils: tests: convert test cases to bash
PATCH 1/3 erofs-utils: tests: convert test cases to bash
Convert to bash script so that some featues e.g. array and string substitution could be used.
Signed-off-by Jingbo Xu <[email protected]>
--- tests/common/rc | 2 +- tests/erofs/001 | 2 +- tests/erofs/002 | 2 +- tests/erofs/003 | 2 +- tests/erofs/004 | 2 +- tests/erofs/005 | 2 +- tests/erofs/006 | 2 +- tests/erofs/007 | 2 +- tests/erofs/008 | 2 +- tests/erofs/009 | 2 +- tests/erofs/010 | 2 +- tests/erofs/011 | 2 +- tests/erofs/012 | 2 +- tests/erofs/013 | 2 +- tests/erofs/014 | 2 +- tests/erofs/015 | 2 +- tests/erofs/017 | 2 +- tests/erofs/018 | 2 +- tests/erofs/019 | 2 +- tests/erofs/020 | 2 +- tests/erofs/021 | 2 +- tests/erofs/022 | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-)
tests/common/rc +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ tmp=/tmp/$$
tests/erofs/001 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # test if unknown algorithm is specificed
tests/erofs/002 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # test short symlink (fast symlink)
tests/erofs/003 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # test long symlink (non-fast symlink)
tests/erofs/004 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # test character/block device
tests/erofs/005 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # test pipe files
tests/erofs/006 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # verify the uncompressed image
tests/erofs/007 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ seq=`basename $0` seqres=$RESULT_DIR/$(echo $0 | awk '{print $((NF-1))"/"$NF}' FS="/")
tests/erofs/008 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # verify lz4 compressed image
tests/erofs/009 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # verify lz4hc compressed image
tests/erofs/010 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # (legacy image) verify lz4 compressed image
tests/erofs/011 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # (legacy image) verify lz4hc compressed image
tests/erofs/012 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # check the hard-link functionality
tests/erofs/013 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # check if hardlinked directories are allowed
tests/erofs/014 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # check if cross-device submounts are handled properly
tests/erofs/015 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # regression test for battach on full buffer block
tests/erofs/017 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # check the compress-hints functionality
tests/erofs/018 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # verify lzma compressed image
tests/erofs/019 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # 019 - check extended attribute functionality
tests/erofs/020 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # 020 - check extended attributes in different layouts
tests/erofs/021 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # 021 - check extended attributes crossing block boundary
tests/erofs/022 +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # # 022 - check long extended attribute name prefixes
Signature · 1 line
2.19.1.6.gb485710b
PATCH 2/3 erofs-utils: tests: pass mkfs options with MKFS_OPTIONS for erofs/015
Signed-off-by Jingbo Xu <[email protected]>
--- tests/erofs/015 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/erofs/015 +2 -1
@@ -38,7 +38,8 @@ head -c 4032 /dev/urandom > $localdir/1 head -c 4095 /dev/urandom > $localdir/2 head -c 12345 /dev/urandom > $localdir/3 # arbitrary size -_scratch_mkfs -Eforce-inode-compact --ignore-mtime $localdir >> $seqres.full 2>&1 \ +MKFS_OPTIONS="$MKFS_OPTIONS -Eforce-inode-compact --ignore-mtime" +_scratch_mkfs $localdir >> $seqres.full 2>&1 \ || _fail "failed to mkfs" _scratch_mount 2>>$seqres.full
Signature · 1 line
2.19.1.6.gb485710b
PATCH 3/3 erofs-utils: tests: enable test cases for tarfs mode
In reply to Jingbo XuNow 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(-)
tests/common/rc +22 -2
@@ -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=$?
tests/erofs/006 +1 -1
@@ -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
tests/erofs/015 +1 -1
@@ -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
tests/erofs/016 +1 -1
@@ -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
Signature · 1 line
2.19.1.6.gb485710b
Re: [PATCH 3/3] erofs-utils: tests: enable test cases for tarfs mode
Quoted 1 line · Jingbo Xu
Now tarfs mode could be tested with "make check FSTYP=erofstar".
I think we need another option in addition to FSTYP.