linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Huang Jianan <huangjianan@oppo.com>
Cc: yh@oppo.com, guoweichao@oppo.com, linux-erofs@lists.ozlabs.org,
	zhangshiming@oppo.com, guanyuwei@oppo.com
Subject: Re: [PATCH] erofs-utils: tests: check the compress-hints functionality
Date: Wed, 15 Sep 2021 23:10:06 +0800	[thread overview]
Message-ID: <YUIMzksibSPZE7tR@B-P7TQMD6M-0146.local> (raw)
In-Reply-To: <20210915112149.25073-1-huangjianan@oppo.com>


Jianan,

On Wed, Sep 15, 2021 at 07:21:49PM +0800, Huang Jianan via Linux-erofs wrote:
> Signed-off-by: Huang Jianan <huangjianan@oppo.com>

Thanks for this! I'm fine with the patch, let me fold some
random modification as well.

> ---
>  tests/Makefile.am   |  5 ++-
>  tests/common/rc     |  2 +-
>  tests/erofs/017     | 78 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/erofs/017.out |  2 ++
>  4 files changed, 85 insertions(+), 2 deletions(-)
>  create mode 100755 tests/erofs/017
>  create mode 100644 tests/erofs/017.out
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 1d73a1b..632dcf5 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -70,9 +70,12 @@ TESTS += erofs/014
>  # 015 - regression test for battach on full buffer block
>  TESTS += erofs/015
>  
> -# 006 - verify the uncompressed image with 2-level random files
> +# 016 - verify the uncompressed image with 2-level random files
>  TESTS += erofs/016
>  
> +# 017 - check the compress-hints functionality
> +TESTS += erofs/017
> +
>  EXTRA_DIST = common/rc erofs
>  
>  clean-local: clean-local-check
> diff --git a/tests/common/rc b/tests/common/rc
> index a6b6014..abd88d1 100644
> --- a/tests/common/rc
> +++ b/tests/common/rc
> @@ -185,7 +185,7 @@ _scratch_cycle_mount()
>  
>  _get_filesize()
>  {
> -    stat -c %s "$1"
> +	stat -c %s "$1"
>  }
>  
>  _require_fssum()
> diff --git a/tests/erofs/017 b/tests/erofs/017
> new file mode 100755
> index 0000000..a12d1ad
> --- /dev/null
> +++ b/tests/erofs/017
> @@ -0,0 +1,78 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0+
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +
> +# get standard environment, filters and checks
> +. "${srcdir}/common/rc"
> +
> +cleanup()
> +{
> +	cd /
> +	rm -rf $tmp.*
> +}
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +echo "QA output created by $seq"
> +
> +[ -z "$lz4hc_on" ] && \
> +	_notrun "lz4hc compression is disabled, skipped."
> +
> +if [ -z $SCRATCH_DEV ]; then
> +	SCRATCH_DEV=$tmp/erofs_$seq.img
> +	rm -f SCRATCH_DEV
> +fi
> +
> +localdir="$tmp/$seq"
> +rm -rf $localdir
> +mkdir -p $localdir
> +
> +# collect files pending for verification
> +dirs=`find ../ -maxdepth 1 -type d -printf '%p:'`
> +IFS=':'
> +for d in $dirs; do
> +	[ $d = '../' ] && continue
> +	[ -z "${d##\.\./tests*}" ] && continue
> +	[ -z "${d##\.\./\.*}" ] && continue
> +	cp -nR $d $localdir
> +done
> +unset IFS
> +
> +# init compress_hints
> +compress_hints="$tmp/compress_hints"
> +rm -rf $compress_hints
> +# ignore warning
> +MKFS_OPTIONS="${MKFS_OPTIONS} -d1 -zlz4hc --compress-hints=$compress_hints"
> +
> +echo "0" > $compress_hints
> +_scratch_mkfs $localdir && \
> +	_fail "successfully mkfs with invalid compress_hints"
> +
> +echo "0        \.c$"  >  $compress_hints
> +echo "1048577  \.am$" >> $compress_hints
> +echo "8192     \.h$"  >> $compress_hints
> +_scratch_mkfs $localdir || _fail "failed to mkfs"
> +
> +# verify lz4hc compressed image
> +_require_erofs
> +_require_fssum
> +
> +_scratch_mount 2>>$seqres.full
> +
> +FSSUM_OPTS="-MAC"
> +[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
> +
> +sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
> +echo "$localdir checksum is $sum1" >>$seqres.full
> +sum2=`$FSSUM_PROG $FSSUM_OPTS $SCRATCH_MNT`
> +echo "$SCRATCH_MNT checksum is $sum2" >>$seqres.full
> +
> +[ "x$sum1" = "x$sum2" ] || _fail "-->checkMD5 FAILED"
> +_scratch_unmount
> +
> +echo Silence is golden
> +status=0
> +exit 0
> diff --git a/tests/erofs/017.out b/tests/erofs/017.out
> new file mode 100644
> index 0000000..8222844
> --- /dev/null
> +++ b/tests/erofs/017.out
> @@ -0,0 +1,2 @@
> +QA output created by 017
> +Silence is golden
> -- 
> 2.25.1

      reply	other threads:[~2021-09-15 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  9:40 [PATCH] erofs-utils: support per-inode compress pcluster Huang Jianan via Linux-erofs
2021-08-18  4:27 ` [PATCH v2] " Huang Jianan via Linux-erofs
2021-08-25  1:17   ` Gao Xiang
2021-08-25  1:27     ` Gao Xiang
2021-08-25  2:38       ` Huang Jianan via Linux-erofs
2021-08-25  3:35   ` [PATCH v3] " Huang Jianan via Linux-erofs
2021-09-05 17:59     ` Gao Xiang
2021-09-06  9:38       ` Huang Jianan via Linux-erofs
2021-09-07  0:12         ` Gao Xiang
2021-09-15 11:21           ` [PATCH] erofs-utils: tests: check the compress-hints functionality Huang Jianan via Linux-erofs
2021-09-15 15:10             ` Gao Xiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUIMzksibSPZE7tR@B-P7TQMD6M-0146.local \
    --to=hsiangkao@linux.alibaba.com \
    --cc=guanyuwei@oppo.com \
    --cc=guoweichao@oppo.com \
    --cc=huangjianan@oppo.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=yh@oppo.com \
    --cc=zhangshiming@oppo.com \
    --subject='Re: [PATCH] erofs-utils: tests: check the compress-hints functionality' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).