All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Yugui <wangyugui@e16-tech.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Zorro Lang <zlang@redhat.com>, fstests@vger.kernel.org
Subject: Re: [PATCH] generic/297: fix the delta time based on stat
Date: Fri, 10 Jun 2022 13:12:03 +0800	[thread overview]
Message-ID: <20220610131203.887B.409509F4@e16-tech.com> (raw)
In-Reply-To: <20220610050302.GX1098723@dread.disaster.area>

Hi,

> On Fri, Jun 10, 2022 at 12:36:24PM +0800, Wang Yugui wrote:
> > Hi,
> > 
> > > On Fri, Jun 10, 2022 at 10:35:53AM +0800, Wang Yugui wrote:
> > > > stat -c '%Y' report seconds as int, so the delta 2.01s may result as 3s.
> > > > 
> > > > Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
> > > > ---
> > > >  tests/generic/297 | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/tests/generic/297 b/tests/generic/297
> > > > index 6bdc3e1c..e3082202 100755
> > > > --- a/tests/generic/297
> > > > +++ b/tests/generic/297
> > > > @@ -51,7 +51,7 @@ for i in $(seq 0 $fnr); do
> > > >  	touch $TEST_DIR/after
> > > >  	before=$(stat -c '%Y' $TEST_DIR/before)
> > > >  	after=$(stat -c '%Y' $TEST_DIR/after)
> > > > -	delta=$((after - before))
> > > > +	delta=$((after - before -1)) # 2.01s may result as 3s; so -1
> > > 
> > > What issue is this change trying to fix? "timeout=8"s is not long enough?
> > 
> > for the command
> > $TIMEOUT_PROG -s INT ${kill_after}s
> > 
> > delta=$((after - before )) may report 'kill_after+1' in some case.
> 
> Yes, that's what it is supposed to report. The process is
> killed 2s after the test starts, so delta is going to be kill_after
> + the delay for the task to exit and the 'touch $TEST_DIR/after'
> command to run. This can take a second or two, depending on how fast
> the reflink operation is proceeding (e.g. waiting on IO).
> 
> > so no relationship to "timeout=8" or "timeout=2".
> 
> If the reflink doesn't get killed within 6s then delta will be
> greater than the timeout (8) and the test fails. So if delta is 2 or
> 3, then it makes no difference to the test result, right?
> 
> > '$XFS_IO_PROG -f -c reflink' without '$TIMEOUT_PROG -s INT ${kill_after}s'
> > may take 20s because this is a very complex reflink.
> 
> Yes, and if it takes 20s (i.e. delta=20s) then it means that the
> kill signal was not delivered and acted upon correctly and so the
> test should fail.

If we want to detect the 'timeout', a simple way it to check
the return value of '$TIMEOUT_PROG '

#timeout exit with status 124.

now we just fix this delta value error because of float/int.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/06/10



  reply	other threads:[~2022-06-10  5:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  2:35 [PATCH] generic/297: fix the delta time based on stat Wang Yugui
2022-06-10  4:24 ` Zorro Lang
2022-06-10  4:36   ` Wang Yugui
2022-06-10  5:03     ` Dave Chinner
2022-06-10  5:12       ` Wang Yugui [this message]
2022-06-10  5:19     ` Zorro Lang
2022-06-10  6:00       ` Wang Yugui

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=20220610131203.887B.409509F4@e16-tech.com \
    --to=wangyugui@e16-tech.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.