public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 3/5] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
Date: Tue, 8 Feb 2022 15:13:08 +0100	[thread overview]
Message-ID: <YgJ6dOD7tC+7UQL2@yuki> (raw)
In-Reply-To: <20220126181210.24897-4-pvorel@suse.cz>

On Wed, Jan 26, 2022 at 07:12:08PM +0100, Petr Vorel wrote:
> i.e.: TST_DEV_EXTRA_OPTS, TST_DEV_FS_OPTS, TST_FS_TYPE
> (to sync with C API).
> 
> Also stop using pattern 'TST_NEEDS_FOO', sometimes 'NEEDS' just does not
> fit to variable name.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  doc/shell-test-api.txt    | 9 ++++++++-
>  testcases/lib/tst_test.sh | 7 ++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt
> index e082808f7e..6605c65b47 100644
> --- a/doc/shell-test-api.txt
> +++ b/doc/shell-test-api.txt
> @@ -189,11 +189,18 @@ space as default value is used. Of course, it's possible to use separate functio
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  
>  Similarily to the C library various checks and preparations can be requested
> -simply by setting right '$TST_NEEDS_FOO'.
> +simply by setting right '$TST_FOO'.
>  
>  [options="header"]
>  |=============================================================================
>  | Variable name            | Action done
> +| 'TST_DEV_EXTRA_OPTS'     | Pass additional 'mkfs' options when use 'TST_FORMAT_DEVICE'.
> +| 'TST_DEV_FS_OPTS'        | Pass extra 'mkfs' options after the device name
> +|                          | when use 'TST_FORMAT_DEVICE'.
> +| 'TST_FORMAT_DEVICE'      | Format a block device with a filesystem. See also
> +|                          | 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'.
> +| 'TST_FS_TYPE'            | Overwrite the default filesystem to be used.
                                  ^
                                Override?
> +|                          | Implies 'TST_NEEDS_DEVICE=1' (no need to set it).
>  | 'TST_NEEDS_ROOT'         | Exit the test with 'TCONF' unless executed under root.
>  |                          | Alternatively the 'tst_require_root' command can be used.
>  | 'TST_NEEDS_TMPDIR'       | Create test temporary directory and cd into it.
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 4707613158..49eee8d00f 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -613,7 +613,7 @@ tst_run()
>  			NET_SKIP_VARIABLE_INIT|NEEDS_CHECKPOINTS);;
>  			CHECKPOINT_WAIT|CHECKPOINT_WAKE);;
>  			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
> -			DEFAULT_FS_TYPE);;
> +			DEFAULT_FS_TYPE|DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE);;
>  			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
>  			esac
>  		done
> @@ -658,6 +658,7 @@ tst_run()
>  
>  	_tst_setup_timer
>  
> +	[ "$TST_FORMAT_DEVICE" = 1 ] && TST_NEEDS_DEVICE=1
>  	[ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1
>  
>  	if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
> @@ -689,6 +690,10 @@ tst_run()
>  
>  	[ -n "$TST_NEEDS_MODULE" ] && tst_require_module "$TST_NEEDS_MODULE"
>  
> +	if [ "$TST_FORMAT_DEVICE" = 1 ]; then
> +		tst_mkfs "$TST_FS_TYPE" "$TST_DEVICE" "$TST_DEV_FS_OPTS" "$TST_DEV_EXTRA_OPTS"

This would work with the proposed change to tst_mkfs if we swapped the
$TST_DEV_FS_OPTS with $TST_DEVICE.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-02-08 14:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 18:12 [LTP] [PATCH 0/5] shell: Add TST_FORMAT_DEVICE support Petr Vorel
2022-01-26 18:12 ` [LTP] [PATCH 1/5] tst_test.sh: Add $TST_DEFAULT_FS_TYPE Petr Vorel
2022-02-08 13:47   ` Cyril Hrubis
2022-02-08 18:20     ` Petr Vorel
2022-01-26 18:12 ` [LTP] [PATCH 2/5] tst_test.sh: tst_mkfs(): Add support for extra opts Petr Vorel
2022-02-08 14:06   ` Cyril Hrubis
2022-02-08 18:08     ` Petr Vorel
2022-02-08 18:28       ` Petr Vorel
2022-02-09 16:05         ` Petr Vorel
2022-02-09 16:13         ` Petr Vorel
2022-01-26 18:12 ` [LTP] [PATCH 3/5] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars Petr Vorel
2022-02-08 14:13   ` Cyril Hrubis [this message]
2022-02-08 17:36     ` Petr Vorel
2022-02-08 17:58       ` Cyril Hrubis
2022-02-08 18:26         ` Petr Vorel
2022-01-26 18:12 ` [LTP] [PATCH 4/5] df01.sh: Use TST_FORMAT_DEVICE=1 Petr Vorel
2022-01-26 18:12 ` [LTP] [PATCH 5/5] shell: Add test for TST_FORMAT_DEVICE=1 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=YgJ6dOD7tC+7UQL2@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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