diff mbox

[1/5] overlay/017: silence test output

Message ID 1493305775-12559-2-git-send-email-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Amir Goldstein April 27, 2017, 3:09 p.m. UTC
Change test to output golden silence on success.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 tests/overlay/017     | 4 +++-
 tests/overlay/017.out | 7 +------
 2 files changed, 4 insertions(+), 7 deletions(-)

Comments

Eryu Guan April 28, 2017, 5:36 a.m. UTC | #1
On Thu, Apr 27, 2017 at 06:09:31PM +0300, Amir Goldstein wrote:
> Change test to output golden silence on success.

Some words on why this change is needed would be good.

> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  tests/overlay/017     | 4 +++-
>  tests/overlay/017.out | 7 +------
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/overlay/017 b/tests/overlay/017
> index 5ca3040..d6ba2ae 100755
> --- a/tests/overlay/017
> +++ b/tests/overlay/017
> @@ -89,11 +89,13 @@ done
>  
>  # find by inode number - expect to find file by inode number
>  cat $tmp.before | while read ino f; do
> -	find $f -inum $ino -maxdepth 0 | _filter_scratch
> +	find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \
> +		echo "$f not found by ino $ino"

Hmm, if I run this find command manually, I got warning about -maxdepth
position.

# find `pwd` -inum 3932421 -maxdepth 1
find: warning: you have specified the -maxdepth option after a non-option argument -inum, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

/root/xfstests/check

Move -maxdepth option just after find path works fine

# find `pwd` -maxdepth 1 -inum 3932421 
/root/xfstests/check

But I'm not sure why I didn't see this warning by running overlay/017..
Anyway, moving -maxdepth around seems better to me.

Thanks,
Eryu

>  done
>  
>  # Compare before..after - expect silence
>  diff $tmp.before $tmp.after
>  
> +echo "Silence is golden"
>  status=0
>  exit
> diff --git a/tests/overlay/017.out b/tests/overlay/017.out
> index 1f277c5..8222844 100644
> --- a/tests/overlay/017.out
> +++ b/tests/overlay/017.out
> @@ -1,7 +1,2 @@
>  QA output created by 017
> -SCRATCH_MNT/dir
> -SCRATCH_MNT/file
> -SCRATCH_MNT/symlink
> -SCRATCH_MNT/chrdev
> -SCRATCH_MNT/blkdev
> -SCRATCH_MNT/fifo
> +Silence is golden
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amir Goldstein April 28, 2017, 5:45 a.m. UTC | #2
On Fri, Apr 28, 2017 at 8:36 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Thu, Apr 27, 2017 at 06:09:31PM +0300, Amir Goldstein wrote:
>> Change test to output golden silence on success.
>
> Some words on why this change is needed would be good.
>
>>
>> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>> ---
>>  tests/overlay/017     | 4 +++-
>>  tests/overlay/017.out | 7 +------
>>  2 files changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/tests/overlay/017 b/tests/overlay/017
>> index 5ca3040..d6ba2ae 100755
>> --- a/tests/overlay/017
>> +++ b/tests/overlay/017
>> @@ -89,11 +89,13 @@ done
>>
>>  # find by inode number - expect to find file by inode number
>>  cat $tmp.before | while read ino f; do
>> -     find $f -inum $ino -maxdepth 0 | _filter_scratch
>> +     find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \
>> +             echo "$f not found by ino $ino"
>
> Hmm, if I run this find command manually, I got warning about -maxdepth
> position.
>
> # find `pwd` -inum 3932421 -maxdepth 1
> find: warning: you have specified the -maxdepth option after a non-option argument -inum, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
>
> /root/xfstests/check
>
> Move -maxdepth option just after find path works fine
>
> # find `pwd` -maxdepth 1 -inum 3932421
> /root/xfstests/check
>
> But I'm not sure why I didn't see this warning by running overlay/017..

man find...

"The default behavior corresponds to -warn if standard input is a tty,
and to -nowarn otherwise."

> Anyway, moving -maxdepth around seems better to me.
>

Sure.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan April 28, 2017, 5:50 a.m. UTC | #3
On Fri, Apr 28, 2017 at 08:45:22AM +0300, Amir Goldstein wrote:
> On Fri, Apr 28, 2017 at 8:36 AM, Eryu Guan <eguan@redhat.com> wrote:
> > On Thu, Apr 27, 2017 at 06:09:31PM +0300, Amir Goldstein wrote:
> >> Change test to output golden silence on success.
> >
> > Some words on why this change is needed would be good.
> >
> >>
> >> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> >> ---
> >>  tests/overlay/017     | 4 +++-
> >>  tests/overlay/017.out | 7 +------
> >>  2 files changed, 4 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/tests/overlay/017 b/tests/overlay/017
> >> index 5ca3040..d6ba2ae 100755
> >> --- a/tests/overlay/017
> >> +++ b/tests/overlay/017
> >> @@ -89,11 +89,13 @@ done
> >>
> >>  # find by inode number - expect to find file by inode number
> >>  cat $tmp.before | while read ino f; do
> >> -     find $f -inum $ino -maxdepth 0 | _filter_scratch
> >> +     find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \
> >> +             echo "$f not found by ino $ino"
> >
> > Hmm, if I run this find command manually, I got warning about -maxdepth
> > position.
> >
> > # find `pwd` -inum 3932421 -maxdepth 1
> > find: warning: you have specified the -maxdepth option after a non-option argument -inum, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
> >
> > /root/xfstests/check
> >
> > Move -maxdepth option just after find path works fine
> >
> > # find `pwd` -maxdepth 1 -inum 3932421
> > /root/xfstests/check
> >
> > But I'm not sure why I didn't see this warning by running overlay/017..
> 
> man find...
> 
> "The default behavior corresponds to -warn if standard input is a tty,
> and to -nowarn otherwise."

That explains, thanks!

Eryu

> 
> > Anyway, moving -maxdepth around seems better to me.
> >
> 
> Sure.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amir Goldstein April 28, 2017, 6:34 a.m. UTC | #4
On Fri, Apr 28, 2017 at 8:50 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Fri, Apr 28, 2017 at 08:45:22AM +0300, Amir Goldstein wrote:
>> On Fri, Apr 28, 2017 at 8:36 AM, Eryu Guan <eguan@redhat.com> wrote:
>> > On Thu, Apr 27, 2017 at 06:09:31PM +0300, Amir Goldstein wrote:
>> >> Change test to output golden silence on success.
>> >
>> > Some words on why this change is needed would be good.
>> >
>> >>
>> >> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>> >> ---
>> >>  tests/overlay/017     | 4 +++-
>> >>  tests/overlay/017.out | 7 +------
>> >>  2 files changed, 4 insertions(+), 7 deletions(-)
>> >>
>> >> diff --git a/tests/overlay/017 b/tests/overlay/017
>> >> index 5ca3040..d6ba2ae 100755
>> >> --- a/tests/overlay/017
>> >> +++ b/tests/overlay/017
>> >> @@ -89,11 +89,13 @@ done
>> >>
>> >>  # find by inode number - expect to find file by inode number
>> >>  cat $tmp.before | while read ino f; do
>> >> -     find $f -inum $ino -maxdepth 0 | _filter_scratch
>> >> +     find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \
>> >> +             echo "$f not found by ino $ino"
>> >
>> > Hmm, if I run this find command manually, I got warning about -maxdepth
>> > position.
>> >
>> > # find `pwd` -inum 3932421 -maxdepth 1
>> > find: warning: you have specified the -maxdepth option after a non-option argument -inum, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
>> >
>> > /root/xfstests/check
>> >
>> > Move -maxdepth option just after find path works fine
>> >
>> > # find `pwd` -maxdepth 1 -inum 3932421
>> > /root/xfstests/check
>> >
>> > But I'm not sure why I didn't see this warning by running overlay/017..
>>
>> man find...
>>
>> "The default behavior corresponds to -warn if standard input is a tty,
>> and to -nowarn otherwise."
>
> That explains, thanks!
>

In your setup does strace find `pwd` -maxdepth 1 -inum 3932421
show newfstatat  for each inode?
It should be doing stat only for dirs according to the code and
Enabled features of find --version.
Not sure why it does newfstatat for every inode on my kvm machine...

Amir.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan April 28, 2017, 6:50 a.m. UTC | #5
On Fri, Apr 28, 2017 at 09:34:18AM +0300, Amir Goldstein wrote:
> In your setup does strace find `pwd` -maxdepth 1 -inum 3932421
> show newfstatat  for each inode?
> It should be doing stat only for dirs according to the code and
> Enabled features of find --version.
> Not sure why it does newfstatat for every inode on my kvm machine...
> 
> Amir.

My find only calls newfstatat on dirs, find version
findutils-4.5.11-5.el7.x86_64

# strace find `pwd` -maxdepth 1 -inum 3932421 2>&1 | grep newfstatat
newfstatat(AT_FDCWD, "/root/xfstests", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/root/xfstests", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "testlogs", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "tests", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "btrfsstress-v5", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "testpatch", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "btrfsstress-v4", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "include", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "ltp", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "autom4te.cache", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "btrfsstress", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "crash", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "build", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "tools", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "lib", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "btrfsstress-v2", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, ".git", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "configs", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "dmapi", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "patches", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "btrfsstress-v3", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "src", {st_mode=S_IFDIR|0775, st_size=12288, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "results", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "m4", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "doc", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(5, "common", {st_mode=S_IFDIR|0775, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0

Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/overlay/017 b/tests/overlay/017
index 5ca3040..d6ba2ae 100755
--- a/tests/overlay/017
+++ b/tests/overlay/017
@@ -89,11 +89,13 @@  done
 
 # find by inode number - expect to find file by inode number
 cat $tmp.before | while read ino f; do
-	find $f -inum $ino -maxdepth 0 | _filter_scratch
+	find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \
+		echo "$f not found by ino $ino"
 done
 
 # Compare before..after - expect silence
 diff $tmp.before $tmp.after
 
+echo "Silence is golden"
 status=0
 exit
diff --git a/tests/overlay/017.out b/tests/overlay/017.out
index 1f277c5..8222844 100644
--- a/tests/overlay/017.out
+++ b/tests/overlay/017.out
@@ -1,7 +1,2 @@ 
 QA output created by 017
-SCRATCH_MNT/dir
-SCRATCH_MNT/file
-SCRATCH_MNT/symlink
-SCRATCH_MNT/chrdev
-SCRATCH_MNT/blkdev
-SCRATCH_MNT/fifo
+Silence is golden