Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/6] zram01.sh: Generate test setup variables in setup
Date: Fri, 29 Jan 2021 21:17:20 +0100	[thread overview]
Message-ID: <YBRtUD8vJUuF4S6V@pevik> (raw)
In-Reply-To: <20210129194144.31299-3-pvorel@suse.cz>

Hi,

...
> -# List of parameters for zram devices.
> -# For each number the test creates own zram device.
> -zram_max_streams="2 3 5 8"
Not sure about the meaning of zram_max_streams.
It looks like sequence of i+3, starting from 0.
Maybe instead of having variable behaving like array,
zram_max_streams() loop could be based on $dev_num.
But that's just cosmetic.
...
> +generate_vars()
> +{
> +	local fs limit size stream=-1
> +	dev_num=0
> +
> +	for fs in $(tst_supported_fs | grep -v -e fat -e ntfs -e fuse); do
> +		size="26214400"
> +		limit="25M"
> +		if [ "$fs" = "btrfs" ]; then
> +			get_btrfs_size || continue
> +			size="402653184"
> +			limit="$((size/1024/1024))M"
> +		fi
> +
> +		stream=$((stream+3))
> +		dev_num=$((dev_num+1))
> +		zram_filesystems="$zram_filesystems $fs"
> +		zram_mem_limits="$zram_mem_limits $limit"
> +		zram_sizes="$zram_sizes $size"
> +		zram_max_streams="$zram_max_streams $stream"

...
> +++ b/testcases/kernel/device-drivers/zram/zram_lib.sh
> @@ -36,10 +36,12 @@ zram_load()
>  {
>  	local tmp

> -	dev_num=0
> -	for tmp in $zram_max_streams; do
> -		dev_num=$((dev_num+1))
> -	done
> +	if [ -z "$dev_num" ]; then
> +		dev_num=0
> +		for tmp in $zram_max_streams; do
> +			dev_num=$((dev_num+1))
> +		done
> +	fi

>  	if [ $dev_num -le 0 ]; then
>  		tst_brk TBROK "dev_num must be > 0"
> @@ -129,6 +131,7 @@ zram_set_disksizes()

>  		i=$(($i + 1))
>  		tst_res TINFO "$sys_path = '$ds' ($i/$dev_num)"
> +		[ $i -eq $dev_num ] && break
This check is not needed any more.
>  	done

>  	tst_res TPASS "test succeeded"
> @@ -155,6 +158,7 @@ zram_set_memlimit()

>  		i=$(($i + 1))
>  		tst_res TINFO "$sys_path = '$ds' ($i/$dev_num)"
> +		[ $i -eq $dev_num ] && break
And here.
>  	done

>  	tst_res TPASS "test succeeded"
> @@ -191,13 +195,10 @@ zram_swapoff()

>  zram_makefs()
>  {
> -	tst_require_cmds mkfs
>  	local i=0
> +	local fs

>  	for fs in $zram_filesystems; do
> -		# if requested fs not supported default it to ext2
> -		tst_supported_fs $fs 2> /dev/null || fs=ext2
> -
>  		tst_res TINFO "make $fs filesystem on /dev/zram$i"
>  		mkfs.$fs /dev/zram$i > err.log 2>&1
>  		if [ $? -ne 0 ]; then
> @@ -206,6 +207,7 @@ zram_makefs()
>  		fi

>  		i=$(($i + 1))
> +		[ $i -eq $dev_num ] && break
And here
>  	done

Kind regards,
Petr

  reply	other threads:[~2021-01-29 20:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 19:41 [LTP] [PATCH v2 0/6] zram cleanup Petr Vorel
2021-01-29 19:41 ` [LTP] [PATCH v2 1/6] zram: Calculate dev_num variable Petr Vorel
2021-01-29 19:41 ` [LTP] [PATCH v2 2/6] zram01.sh: Generate test setup variables in setup Petr Vorel
2021-01-29 20:17   ` Petr Vorel [this message]
2021-01-30  5:37   ` Li Wang
2021-02-02  7:17     ` Petr Vorel
2021-02-02 11:16       ` Li Wang
2021-02-06 19:59         ` Petr Vorel
2021-02-08  7:11           ` Petr Vorel
2021-02-18  9:00             ` Li Wang
2021-03-01 14:34   ` Cyril Hrubis
2021-03-01 16:04     ` Petr Vorel
2021-01-29 19:41 ` [LTP] [PATCH v2 3/6] zram: Move zram_compress_alg() to zram02.sh Petr Vorel
2021-03-01 14:55   ` Cyril Hrubis
2021-03-01 15:35     ` Petr Vorel
2021-01-29 19:41 ` [LTP] [PATCH v2 4/6] zram: Move test specific functions out of zram_lib.sh Petr Vorel
2021-03-01 14:57   ` Cyril Hrubis
2021-01-29 19:41 ` [LTP] [RFC PATCH v2 5/6] tst_test.sh: Run _tst_setup_timer after $TST_SETUP Petr Vorel
2021-01-29 20:17   ` Petr Vorel
2021-03-01 15:06   ` Cyril Hrubis
2021-01-29 19:41 ` [LTP] [PATCH v2 6/6] zram: Increase timeout according to used devices Petr Vorel
2021-01-29 20:10   ` Petr Vorel
2021-01-29 20:15     ` Petr Vorel
2021-01-30  8:26       ` Li Wang
2021-02-02  7:38         ` Petr Vorel
2021-02-02 11:25           ` Li Wang
2021-03-01 15:14     ` Cyril Hrubis
2021-03-01 15:41       ` Petr Vorel
2021-03-01 15:45         ` Petr Vorel
2021-03-01 15:48         ` Cyril Hrubis
2021-03-01 16:18           ` Petr Vorel

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=YBRtUD8vJUuF4S6V@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox