[RFC,7/9] testcases: df: Add "--printf" option as needed commands
diff mbox series

Message ID 20180423094639.14612-8-mylene.josserand@bootlin.com
State Changes Requested
Delegated to: Cyril Hrubis
Headers show
Series
  • testcases: small improvements with TCONF
Related show

Commit Message

Mylène Josserand April 23, 2018, 9:46 a.m. UTC
In case Busybox is used with minimal configuration, the option
"--printf" is not available so the test is failing.

Add this option in the needed commands to return a TCONF
if it is not available.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/df/df01.sh | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cyril Hrubis April 23, 2018, 10:22 a.m. UTC | #1
Hi!
> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> index fbf1e2f2a..147620020 100755
> --- a/testcases/commands/df/df01.sh
> +++ b/testcases/commands/df/df01.sh
> @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
>  TST_NEEDS_ROOT=1
>  TST_NEEDS_TMPDIR=1
>  TST_NEEDS_DEVICE=1
> +TST_NEEDS_CMDS="stat --printf=%f"

Does this work? Because when I do something as:

$ command -v stat --nonexistent-option
/usr/bin/stat
$ echo $?
0
Petr Vorel April 23, 2018, 1:27 p.m. UTC | #2
Hi,

> > diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > index fbf1e2f2a..147620020 100755
> > --- a/testcases/commands/df/df01.sh
> > +++ b/testcases/commands/df/df01.sh
> > @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
> >  TST_NEEDS_ROOT=1
> >  TST_NEEDS_TMPDIR=1
> >  TST_NEEDS_DEVICE=1
> > +TST_NEEDS_CMDS="stat --printf=%f"

> Does this work? Because when I do something as:

> $ command -v stat --nonexistent-option
> /usr/bin/stat
> $ echo $?
> 0

Checking whole output (not just binary file / script) presence in $PATH is what
tst_verify_cmd in my patch [1] does.

[1] https://patchwork.ozlabs.org/patch/892779/


Kind regards,
Petr
Mylène Josserand April 27, 2018, 9:38 a.m. UTC | #3
Hi,

On Mon, 23 Apr 2018 15:27:27 +0200
Petr Vorel <pvorel@suse.cz> wrote:

> Hi,
> 
> > > diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > > index fbf1e2f2a..147620020 100755
> > > --- a/testcases/commands/df/df01.sh
> > > +++ b/testcases/commands/df/df01.sh
> > > @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
> > >  TST_NEEDS_ROOT=1
> > >  TST_NEEDS_TMPDIR=1
> > >  TST_NEEDS_DEVICE=1
> > > +TST_NEEDS_CMDS="stat --printf=%f"  
> 
> > Does this work? Because when I do something as:  
> 
> > $ command -v stat --nonexistent-option
> > /usr/bin/stat
> > $ echo $?
> > 0  
> 
> Checking whole output (not just binary file / script) presence in $PATH is what
> tst_verify_cmd in my patch [1] does.
> 
> [1] https://patchwork.ozlabs.org/patch/892779/
> 
> 
> Kind regards,
> Petr

Indeed, I saw your patch just after I sent my series :)

I will test your "tst_verify_cmd" but it seems to fit my needs. I will
keep you updated.

Best regards,

Patch
diff mbox series

diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index fbf1e2f2a..147620020 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -26,6 +26,8 @@  TST_PARSE_ARGS=parse_args
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_DEVICE=1
+TST_NEEDS_CMDS="stat --printf=%f"
+
 . tst_test.sh
 
 usage()