Add TST_FORMAT_DEVICE support
v2 cover Add TST_FORMAT_DEVICE support
Hi,
changes v1->v2:
* Replace $TST_DEFAULT_FS_TYPE with proper $TST_FS_TYPE initialization (Cyril)
* Redesing tst_mkfs() API (Cyril)
We now parse only fs_type, the rest we pass to mkfs.* the same way we end up passing them on a command line.
Petr Vorel (6):
tst_test.sh: Properly init $TST_FS_TYPE tst_test.sh: Redesing tst_mkfs() API tst_test.sh: Add $TST_FORMAT_DEVICE and related vars df01.sh: Use TST_FORMAT_DEVICE=1
shell: Add test for TST_FORMAT_DEVICE=1
doc: Add missing shell variables
doc/shell-test-api.txt | 37 +++++++++++++++++++-- lib/newlib_tests/shell/tst_format_device.sh | 24 +++++++++++++ testcases/commands/df/df01.sh | 5 +-- testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/lib/tst_test.sh | 28 ++++++++++------ 5 files changed, 79 insertions(+), 17 deletions(-) create mode 100755 lib/newlib_tests/shell/tst_format_device.sh
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/6 tst_test.sh: Properly init $TST_FS_TYPE
to sync with C API init $TST_FS_TYPE with $LTP_DEV_FS_TYPE, when defined. That's equivalent of the .dev_fs_type in the tst_test structure:
if (tst_test->dev_fs_type)
tdev.fs_type = tst_test->dev_fs_type;
else
tdev.fs_type = tst_dev_fs_type();
(And the tst_dev_fs_type() returns either $LTP_DEV_FS_TYPE or "ext2"
if it's not defined.)Now, when $TST_FS_TYPE properly defined, tst_mkfs() can rely on it (thus define the check).
Also use the variable in df01.sh, mkfs01.sh (the only shell tests which works with filesystems).
--- testcases/commands/df/df01.sh | 2 -- testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/lib/tst_test.sh | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-)
testcases/commands/df/df01.sh +0 -2
@@ -28,8 +28,6 @@ OPTIONS EOF } -TST_FS_TYPE=ext2 - parse_args() { TST_FS_TYPE="$2"
testcases/commands/mkfs/mkfs01.sh +1 -1
@@ -45,7 +45,7 @@ setup() mkfs_verify_type() { if [ -z "$1" ]; then - blkid $2 -t TYPE="ext2" >/dev/null + blkid $2 -t TYPE="$TST_FS_TYPE" >/dev/null else if [ "$1" = "msdos" ]; then blkid $2 -t TYPE="vfat" >/dev/null
testcases/lib/tst_test.sh +4 -4
@@ -17,6 +17,10 @@ export TST_ITERATIONS=1 export TST_TMPDIR_RHOST=0 export TST_LIB_LOADED=1 +if [ -z "$TST_FS_TYPE" ]; then + export TST_FS_TYPE="${LTP_DEV_FS_TYPE:-ext2}" +fi + . tst_ansi_color.sh . tst_security.sh
@@ -343,10 +347,6 @@ tst_mkfs() [ $# -ge 1 ] && shift local fs_opts="$@" - if [ -z "$fs_type" ]; then - tst_brk TBROK "No fs_type specified" - fi - if [ -z "$device" ]; then tst_brk TBROK "No device specified" fi
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/6] tst_test.sh: Properly init $TST_FS_TYPE
Hi!
Looks good.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/6 tst_test.sh: Redesing tst_mkfs() API
In reply to Petr Vorelthe goal is to add support for extra opts after device name (e.g. size) - to sync with C API.
But instead adding new variable for extra opts we specify only $fs_type and the rest of args we just pass to the mkfs.* command. Still keep $TST_FS_TYPE and $TST_DEVICE as a default when no parameters are passed.
NOTE: not adding it to legacy shell API (thus no need to change test_robind.sh).
--- testcases/lib/tst_test.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
testcases/lib/tst_test.sh +9 -7
@@ -342,19 +342,21 @@ tst_umount() tst_mkfs() { local fs_type=${1:-$TST_FS_TYPE} - local device=${2:-$TST_DEVICE} [ $# -ge 1 ] && shift - [ $# -ge 1 ] && shift - local fs_opts="$@" - if [ -z "$device" ]; then - tst_brk TBROK "No device specified" + local opts="$@" + + if [ -z "$opts" ]; then + if [ "$TST_NEEDS_DEVICE" != 1 ]; then + tst_brk "Using default parameters in tst_mkfs requires TST_NEEDS_DEVICE=1" + fi + opts="$TST_DEVICE" fi 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 $fs_type with opts='$opts'" + ROD_SILENT mkfs.$fs_type $opts } # Detect whether running under hypervisor: Microsoft Hyper-V
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/6] tst_test.sh: Redesing tst_mkfs() API
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 3/6 tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
In reply to Petr Voreli.e.: TST_DEV_EXTRA_OPTS, TST_DEV_FS_OPTS, TST_FS_TYPE (to sync with C API).
NOTE: stop using pattern 'TST_NEEDS_FOO', sometimes 'NEEDS' just does not fit to variable name.
--- doc/shell-test-api.txt | 31 +++++++++++++++++++++++++++++-- testcases/lib/tst_test.sh | 6 ++++++ 2 files changed, 35 insertions(+), 2 deletions(-)
doc/shell-test-api.txt +29 -2
@@ -189,11 +189,20 @@ 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 extra 'mkfs' options _after_ device name, +| | to 'tst_mkfs', use with 'TST_FORMAT_DEVICE=1'. +| 'TST_DEV_FS_OPTS' | Pass 'mkfs' options _before_ the device name, +| | to 'tst_mkfs', use with 'TST_FORMAT_DEVICE=1'. +| 'TST_FORMAT_DEVICE' | Format a block device with a filesystem, see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] +| | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. +| | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_FS_TYPE' | Override the default filesystem to be used. | '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.
@@ -495,7 +504,25 @@ tst_random 0 1000 Formatting device with a filesystem +++++++++++++++++++++++++++++++++++ -The 'tst_mkfs' helper will format device with the filesystem. +'TST_FORMAT_DEVICE=1' can be used to format device before running the test. +Uses '$TST_FS_TYPE' (used filesystem, by default ext2), '$TST_DEVICE' (used +block device, usually prepared by 'TST_NEEDS_DEVICE=1'), '$TST_DEV_FS_OPTS' +('mkfs' options _before_ the device name) and '$TST_DEV_EXTRA_OPTS' +(extra 'mkfs' options _after_ the device name). +Library internally uses 'tst_mkfs' function, which can be used for more complex setup. + +[source,sh] +------------------------------------------------------------------------------- +TST_FORMAT_DEVICE=1 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_TESTFUNC=test + +test1() +{ + tst_res TPASS "device formatted" +} +------------------------------------------------------------------------------- [source,sh] -------------------------------------------------------------------------------
testcases/lib/tst_test.sh +6 -0
@@ -616,6 +616,7 @@ tst_run() NET_SKIP_VARIABLE_INIT|NEEDS_CHECKPOINTS);; CHECKPOINT_WAIT|CHECKPOINT_WAKE);; CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);; + DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";; esac done
@@ -660,6 +661,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
@@ -691,6 +693,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_DEV_FS_OPTS $TST_DEVICE $TST_DEV_EXTRA_OPTS + fi + [ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints if [ -n "$TST_SETUP" ]; then
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/6] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
Hi Petr
doc/shell-test-api.txt tst_random 0 1000 · line 521
Quoted 9 lines
doc/shell-test-api.txt +9
-0+ +[source,sh] +------------------------------------------------------------------------------- +TST_FORMAT_DEVICE=1 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_TESTFUNC=test + +test1()
A small nit, I prefer to use test name directly if we don't have several sub test cases.
Best Regards
Yang Xu
Quoted 5 lines
doc/shell-test-api.txt +4
-0+{ + tst_res TPASS "device formatted" +} +-------------------------------------------------------------------------------
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/6] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
Hi Xu,
Quoted 12 lines
Hi Petr
doc/shell-test-api.txt tst_random 0 1000 · line 521
Quoted 9 lines
doc/shell-test-api.txt +9
-0+ +[source,sh] +------------------------------------------------------------------------------- +TST_FORMAT_DEVICE=1 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_TESTFUNC=test + +test1()A small nit, I prefer to use test name directly if we don't have several sub test cases.
Sure. Originally I had more tests there, using lsblk.
But I'll probably extend these tests to your suggestion in different mail.
Kind regards,
Petr
Quoted 7 lines
Best Regards
Yang XuQuoted 5 lines
doc/shell-test-api.txt +4
-0+{ + tst_res TPASS "device formatted" +} +-------------------------------------------------------------------------------
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/6] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
In reply to Petr VorelHi!
Quoted 15 lines
--- doc/shell-test-api.txt | 31 +++++++++++++++++++++++++++++-- testcases/lib/tst_test.sh | 6 ++++++ 2 files changed, 35 insertions(+), 2 deletions(-)doc/shell-test-api.txt +1
-1@@ -189,11 +189,20 @@ 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'.
doc/shell-test-api.txt space as default value is used. Of course, it's possible to use separate functio · line 202
Quoted 10 lines
doc/shell-test-api.txt +6
-0[options="header"] |============================================================================= | Variable name | Action done +| 'TST_DEV_EXTRA_OPTS' | Pass extra 'mkfs' options _after_ device name, +| | to 'tst_mkfs', use with 'TST_FORMAT_DEVICE=1'. +| 'TST_DEV_FS_OPTS' | Pass 'mkfs' options _before_ the device name, +| | to 'tst_mkfs', use with 'TST_FORMAT_DEVICE=1'. +| 'TST_FORMAT_DEVICE' | Format a block device with a filesystem, see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]
Hm, I guess that we already have a few absolute links in the docs to a github.com wiki, but I do not like it that much. I guess that realtive links does not work, right?
doc/shell-test-api.txt tst_random 0 1000 · line 508
Quoted 13 lines
doc/shell-test-api.txt +5
-1+| | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. +| | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_FS_TYPE' | Override the default filesystem to be used. | '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.@@ -495,7 +504,25 @@ tst_random 0 1000 Formatting device with a filesystem +++++++++++++++++++++++++++++++++++ -The 'tst_mkfs' helper will format device with the filesystem. +'TST_FORMAT_DEVICE=1' can be used to format device before running the test. +Uses '$TST_FS_TYPE' (used filesystem, by default ext2), '$TST_DEVICE' (used
^
I would removed this part and keep only the (by default ext2)
doc/shell-test-api.txt tst_random 0 1000 · line 509
Quoted 1 line
doc/shell-test-api.txt +1
-0+block device, usually prepared by 'TST_NEEDS_DEVICE=1'), '$TST_DEV_FS_OPTS'
and rewrote this part no to be in the parentheses as:
'$TST_DEVICE' a block device to be formatted, usually prepared by the library (TST_NEEDS_DEVICE=1 must be set).
doc/shell-test-api.txt tst_random 0 1000 · line 511
Quoted 2 lines
doc/shell-test-api.txt +2
-0+('mkfs' options _before_ the device name) and '$TST_DEV_EXTRA_OPTS' +(extra 'mkfs' options _after_ the device name).
And remove the parentheses here as:
'$TST_DEV_FS_OPTS' a 'mkfs' options _before_ the device path and '$TST_DEV_EXTRA_OPTS' extra 'mkfs'' options _after_ the device path.
Other than that and the test1() pointed out by Yang Xu:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/6] tst_test.sh: Add $TST_FORMAT_DEVICE and related vars
Hi Cyril,
Quoted 6 lines
Quoted 2 lines
+| 'TST_FORMAT_DEVICE' | Format a block device with a filesystem, see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]Hm, I guess that we already have a few absolute links in the docs to a github.com wiki, but I do not like it that much. I guess that realtive links does not work, right?
AFAIK it does not in AsciiDoc format (not sure about other, but we don't want to switch anyway). I guess I can keep it as we don't have any better solution, right?
Quoted 23 lines
doc/shell-test-api.txt tst_random 0 1000 · line 508
Quoted 13 lines
+| | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. +| | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_FS_TYPE' | Override the default filesystem to be used. | '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.doc/shell-test-api.txt +2
-1@@ -495,7 +504,25 @@ tst_random 0 1000 Formatting device with a filesystem +++++++++++++++++++++++++++++++++++ -The 'tst_mkfs' helper will format device with the filesystem. +'TST_FORMAT_DEVICE=1' can be used to format device before running the test. +Uses '$TST_FS_TYPE' (used filesystem, by default ext2), '$TST_DEVICE' (used^
I would removed this part and keep only the (by default ext2)doc/shell-test-api.txt tst_random 0 1000 · line 509
Quoted 1 line
doc/shell-test-api.txt +1
-0+block device, usually prepared by 'TST_NEEDS_DEVICE=1'), '$TST_DEV_FS_OPTS'and rewrote this part no to be in the parentheses as:
'$TST_DEVICE' a block device to be formatted, usually prepared by the library (TST_NEEDS_DEVICE=1 must be set).
Quoted 7 lines
doc/shell-test-api.txt tst_random 0 1000 · line 511
Quoted 2 lines
doc/shell-test-api.txt +2
-0+('mkfs' options _before_ the device name) and '$TST_DEV_EXTRA_OPTS' +(extra 'mkfs' options _after_ the device name).And remove the parentheses here as:
'$TST_DEV_FS_OPTS' a 'mkfs' options _before_ the device path and '$TST_DEV_EXTRA_OPTS' extra 'mkfs'' options _after_ the device path.
Agree with all of this.
Quoted 1 line
Other than that and the
test1()pointed out by Yang Xu:
I suppose this is what you mean: s/test1/test/, right?
+++ doc/shell-test-api.txt
@@ -517,7 +517,7 @@ TST_DEV_FS_OPTS="-b 1024 -O quota"
TST_DEV_EXTRA_OPTS="5m"
TST_TESTFUNC=test
-test1()
+test()
{
tst_res TPASS "device formatted"
}
Quoted 1 line
Reviewed-by Cyril Hrubis <[email protected]>
Thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 4/6 df01.sh: Use TST_FORMAT_DEVICE=1
In reply to Petr Vorel---
Same as in v1
testcases/commands/df/df01.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/commands/df/df01.sh +1 -2
@@ -13,7 +13,7 @@ TST_OPTS="f:" TST_USAGE=usage TST_PARSE_ARGS=parse_args TST_NEEDS_ROOT=1 -TST_NEEDS_DEVICE=1 +TST_FORMAT_DEVICE=1 . tst_test.sh usage()
@@ -35,7 +35,6 @@ parse_args() setup() { - tst_mkfs tst_mount DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk 'NR==1{print $5}') }
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 4/6] df01.sh: Use TST_FORMAT_DEVICE=1
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 5/6 shell: Add test for TST_FORMAT_DEVICE=1
In reply to Petr VorelUnfortunately GitHub Actions don't have loop devices, thus cannot be run in CI:
tst_format_device 1 TINFO: timeout per run is 0h 5m 0s /__w/ltp/ltp/lib/tst_device.c:139: TINFO: No free devices found
---
Same as in v1
lib/newlib_tests/shell/tst_format_device.sh | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 lib/newlib_tests/shell/tst_format_device.sh
lib/newlib_tests/shell/tst_format_device.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel <[email protected]> + +TST_FORMAT_DEVICE=1 +TST_TESTFUNC=test +TST_CNT=2 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_NEEDS_CMDS="df lsblk" +. tst_test.sh + +test1() +{ + tst_res TPASS "device formatted" +} + +test2() +{ + tst_check_cmds df || return + EXPECT_PASS "df $TST_DEVICE | grep -q /dev" +} + +tst_run
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 5/6] shell: Add test for TST_FORMAT_DEVICE=1
Hi Petr
Quoted 30 lines
Unfortunately GitHub Actions don't have loop devices, thus cannot be run in CI:
tst_format_device1 TINFO: timeout per run is 0h 5m 0s /__w/ltp/ltp/lib/tst_device.c:139: TINFO: No free devices foundSigned-off-by Petr Vorel<[email protected]>---
Same as in v1lib/newlib_tests/shell/tst_format_device.sh | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+)create mode 100755
lib/newlib_tests/shell/tst_format_device.shlib/newlib_tests/shell/tst_format_device.sh new file +10
-0@@ -0,0 +1,24 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel<[email protected]> + +TST_FORMAT_DEVICE=1 +TST_TESTFUNC=test +TST_CNT=2 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_NEEDS_CMDS="df lsblk"
lib/newlib_tests/shell/tst_format_device.sh line 20
Quoted 10 lines
lib/newlib_tests/shell/tst_format_device.sh new file +10
-0+. tst_test.sh + +test1() +{ + tst_res TPASS "device formatted" +} + +test2() +{ + tst_check_cmds df || return
We have checked df command in TST_NEEDS_CMDS, why still check it again in here?
Best Regards
Yang Xu
Quoted 4 lines
lib/newlib_tests/shell/tst_format_device.sh new file +4
-0+ EXPECT_PASS "df $TST_DEVICE | grep -q /dev" +} + +tst_run
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 5/6] shell: Add test for TST_FORMAT_DEVICE=1
Hi Xu,
Quoted 1 line
Quoted 1 line
lib/newlib_tests/shell/tst_format_device.sh | 24 +++++++++++++++++++++
...
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh line 10
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh new file +6
-0+TST_FORMAT_DEVICE=1 +TST_TESTFUNC=test +TST_CNT=2 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_NEEDS_CMDS="df lsblk"
This is left over from previous versions => should be deleted.
Quoted 4 lines
Quoted 4 lines
+.
tst_test.shlib/newlib_tests/shell/tst_format_device.sh new file +3
-0+ +test1() +{
Quoted 8 lines
lib/newlib_tests/shell/tst_format_device.sh line 20
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh new file +6
-0+ tst_res TPASS "device formatted" +} + +test2() +{ + tst_check_cmds df || returnWe have checked df command in
TST_NEEDS_CMDS, why still check it again in here?
Correct, TST_NEEDS_CMDS should be removed so that at least creating the device (test1) is supported even SUT is missing df.
Kind regards,
Petr
Quoted 2 lines
Best Regards
Yang Xu
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 5/6] shell: Add test for TST_FORMAT_DEVICE=1
Hi!
Quoted 19 lines
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh line 10
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh new file +6
-0+TST_FORMAT_DEVICE=1 +TST_TESTFUNC=test +TST_CNT=2 +TST_DEV_FS_OPTS="-b 1024 -O quota" +TST_DEV_EXTRA_OPTS="5m" +TST_NEEDS_CMDS="df lsblk"This is left over from previous versions => should be deleted.
Quoted 4 lines
Quoted 4 lines
+.
tst_test.shlib/newlib_tests/shell/tst_format_device.sh new file +3
-0+ +test1() +{Quoted 8 lines
lib/newlib_tests/shell/tst_format_device.sh line 20
Quoted 6 lines
lib/newlib_tests/shell/tst_format_device.sh new file +6
-0+ tst_res TPASS "device formatted" +} + +test2() +{ + tst_check_cmds df || returnWe have checked df command in
TST_NEEDS_CMDS, why still check it again in here?
Quoted 2 lines
Correct,
TST_NEEDS_CMDSshould be removed so that at least creating the device (test1) is supported even SUT is missing df.
And what do we need the lsblk command for?
Other than the TST_NEEDS_CMD= variable:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 6/6 doc: Add missing shell variables
In reply to Petr Vorel--- doc/shell-test-api.txt | 6 ++++++ 1 file changed, 6 insertions(+)
doc/shell-test-api.txt +6 -0
@@ -202,7 +202,13 @@ simply by setting right '$TST_FOO'. | | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. | | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_DEVICE' | Block device name for 'tst_mount' and 'tst_mkfs', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | 'TST_FS_TYPE' | Override the default filesystem to be used. +| 'TST_MNTPOINT' | Holds path to mountpoint when use 'tst_mount', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] +| 'TST_MNT_PARAMS' | Extra mount params for 'tst_mount', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | '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.
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 6/6] doc: Add missing shell variables
Hi Petr
This patchset looks good to me, so
ps: I think we can add two basic tests for this,
1)test TST_FS_TYPE whether format the specified filesystem ie using ext4 2)test tst_mkfs whether format failed if not specifying TST_NEEDS_DEVICE and call tst_mkfs directly
Best Regards
Yang Xu
Quoted 23 lines
Signed-off-by Petr Vorel<[email protected]>--- doc/shell-test-api.txt | 6 ++++++ 1 file changed, 6 insertions(+)doc/shell-test-api.txt +6
-0@@ -202,7 +202,13 @@ simply by setting right '$TST_FOO'. | | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. | | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_DEVICE' | Block device name for 'tst_mount' and 'tst_mkfs', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | 'TST_FS_TYPE' | Override the default filesystem to be used. +| 'TST_MNTPOINT' | Holds path to mountpoint when use 'tst_mount', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] +| 'TST_MNT_PARAMS' | Extra mount params for 'tst_mount', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | '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.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 6/6] doc: Add missing shell variables
Hi Xu,
Quoted 7 lines
Hi Petr
This patchset looks good to me, so
Acked-by Yang Xu <[email protected]>ps: I think we can add two basic tests for this,
1)testTST_FS_TYPEwhether format the specified filesystem ie using ext4
BTW the default is ext2. Also not sure how to do it when formatting loop device. Verifying filesystem I'll add when I add TST_NEEDS_MOUNT flag.
losetup prints:/dev/loop0: [65025]:176189 (/tmp/LTP_tst_format_device.9bya3blyQD/test_dev.img)
Quoted 2 lines
2)test
tst_mkfswhether format failed if not specifyingTST_NEEDS_DEVICEand calltst_mkfsdirectly
+1. I'll also document here what is the purpose (we have many tests which are expected to TFAIL/TBROK, but it's not documented in the tests thus it's hard to run them locally.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 6/6] doc: Add missing shell variables
In reply to Petr VorelHi!
doc/shell-test-api.txt simply by setting right '$TST_FOO'. · line 208
Quoted 12 lines
doc/shell-test-api.txt +3
-0@@ -202,7 +202,13 @@ simply by setting right '$TST_FOO'. | | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | | See also 'TST_DEV_EXTRA_OPTS', 'TST_DEV_FS_OPTS', 'TST_FS_TYPE'. | | Implies 'TST_NEEDS_DEVICE=1' (no need to set it). +| 'TST_DEVICE' | Block device name for 'tst_mount' and 'tst_mkfs', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | 'TST_FS_TYPE' | Override the default filesystem to be used. +| 'TST_MNTPOINT' | Holds path to mountpoint when use 'tst_mount', see
^
used in 'tst_mount'
doc/shell-test-api.txt simply by setting right '$TST_FOO'. · line 214
Quoted 6 lines
doc/shell-test-api.txt +3
-0+| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] +| 'TST_MNT_PARAMS' | Extra mount params for 'tst_mount', see +| | https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem] | '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.
Other than the minor correction:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 6/6] doc: Add missing shell variables
Hi Xu, Cyril,
whole patchset merged with fixes you pointed out and your tags.
Hope we find some better solution for relative path links.
Thanks for your review.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp