diff mbox series

[v2,5/6] shell: Add test for TST_FORMAT_DEVICE=1

Message ID 20220210162739.30159-6-pvorel@suse.cz
State Accepted
Headers show
Series Add TST_FORMAT_DEVICE support | expand

Commit Message

Petr Vorel Feb. 10, 2022, 4:27 p.m. UTC
Unfortunately 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

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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

Comments

Yang Xu Feb. 11, 2022, 5:17 a.m. UTC | #1
Hi Petr
> Unfortunately 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
> 
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
> 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
> 
> diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh
> new file mode 100755
> index 0000000000..b02f8b122b
> --- /dev/null
> +++ b/lib/newlib_tests/shell/tst_format_device.sh
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2022 Petr Vorel<pvorel@suse.cz>
> +
> +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
We have checked df command in TST_NEEDS_CMDS, why still check it again
in here?

Best Regards
Yang Xu
> +	EXPECT_PASS "df $TST_DEVICE | grep -q /dev"
> +}
> +
> +tst_run
Petr Vorel Feb. 11, 2022, 6:44 a.m. UTC | #2
Hi Xu,

> >   lib/newlib_tests/shell/tst_format_device.sh | 24 +++++++++++++++++++++
...
> > +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.
> > +. 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?
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

> Best Regards
> Yang Xu
Cyril Hrubis March 11, 2022, 2:36 p.m. UTC | #3
Hi!
> > > +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.
> > > +. 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?
> Correct, TST_NEEDS_CMDS should 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:

Reviwed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh
new file mode 100755
index 0000000000..b02f8b122b
--- /dev/null
+++ b/lib/newlib_tests/shell/tst_format_device.sh
@@ -0,0 +1,24 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
+
+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