From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/5] tst_test.sh: tst_mkfs(): Add support for extra opts
Date: Tue, 8 Feb 2022 15:06:36 +0100 [thread overview]
Message-ID: <YgJ47NfU3vP3XcyE@yuki> (raw)
In-Reply-To: <20220126181210.24897-3-pvorel@suse.cz>
Hi!
> Allow to pass options after device name
> (to sync with C API).
>
> NOTE: not adding it to legacy shell API (thus no need to change
> test_robind.sh).
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/lib/tst_test.sh | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index eb3bf0df12..4707613158 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -343,9 +343,8 @@ tst_mkfs()
> [ -z "$fs_type" ] && fs_type="$TST_DEFAULT_FS_TYPE"
>
> local device=${2:-$TST_DEVICE}
> - [ $# -ge 1 ] && shift
> - [ $# -ge 1 ] && shift
> - local fs_opts="$@"
> + local fs_opts="$3"
> + local extra_opts="$4"
Doesn't this actually break the examples described in the
doc/shell-test-api.txt?
There we do have:
tst_mkfs ext4 /dev/device -T largefile
Which obviously parses as "-T" in the fs_opts and "largefile" in the
extra_opts.
I do not think that the support for extra opts can be added this way
without redesigning the tst_mkfs API. Maybe it would make more sense to
just pass the parameters in the same way we end up passing them on a
command line, i.e. we would only interpret the first parameter passed to
tst_mkfs as a filesystem type and pass the rest as $@.
> if [ -z "$device" ]; then
> tst_brk TBROK "No device specified"
> @@ -353,8 +352,8 @@ tst_mkfs()
>
> tst_require_cmds mkfs.$fs_type
>
> - tst_res TINFO "Formatting $device with $fs_type extra opts='$fs_opts'"
> - ROD_SILENT mkfs.$fs_type $fs_opts $device
> + tst_res TINFO "Formatting $device with $fs_type opts='$fs_opts' extra opts='$extra_opts'"
> + ROD_SILENT mkfs.$fs_type $fs_opts $device $extra_opts
> }
>
> # Detect whether running under hypervisor: Microsoft Hyper-V
> --
> 2.34.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-02-08 14:04 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 [this message]
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
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=YgJ47NfU3vP3XcyE@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