From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] copy_file_range03: comparing timestamp in tst_timespec_diff
Date: Mon, 6 Sep 2021 10:59:55 +0200 [thread overview]
Message-ID: <YTXYixG37nBTzhXk@yuki> (raw)
In-Reply-To: <20210906060020.3219023-1-liwang@redhat.com>
Hi!
> - updated_timestamp = get_timestamp(fd_dest);
> + timestamp2 = get_timestamp(fd_dest);
>
> - if (timestamp == updated_timestamp)
> + diff = tst_timespec_diff(timestamp1, timestamp2);
> +
> + if (!diff.tv_sec && !diff.tv_nsec)
> tst_brk(TFAIL, "copy_file_range did not update timestamp.");
So as we changed the code to sleep for 1.5 sec I guess that we can
expect the difference to be at least 1 second because:
- the minimal granularity is 1s in which case we will get exactly 1s in
the diff
- if the granularity is greater, we will get a bit more than 1s
So I would go for something as:
long long diff_us = tst_timespec_diff_us(timestamp2, timestamp1);
if (diff_us >= 1000000 && diff_us <= 2000000)
tst_res(TPASS, "...");
Which expects that the difference between timestamps is in a sane range
not that it just have been changed.
> tst_res(TPASS, "copy_file_range sucessfully updated the timestamp");
> --
> 2.31.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
WARNING: multiple messages have this Message-ID (diff)
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] copy_file_range03: comparing timestamp in tst_timespec_diff
Date: Mon, 6 Sep 2021 10:59:55 +0200 [thread overview]
Message-ID: <YTXYixG37nBTzhXk@yuki> (raw)
Message-ID: <20210906085955.yAm7u0V_4gZBhoXhXJ2CcVrm66t0zvomWyey-c4qSmY@z> (raw)
In-Reply-To: <20210906060020.3219023-1-liwang@redhat.com>
Hi!
> - updated_timestamp = get_timestamp(fd_dest);
> + timestamp2 = get_timestamp(fd_dest);
>
> - if (timestamp == updated_timestamp)
> + diff = tst_timespec_diff(timestamp1, timestamp2);
> +
> + if (!diff.tv_sec && !diff.tv_nsec)
> tst_brk(TFAIL, "copy_file_range did not update timestamp.");
So as we changed the code to sleep for 1.5 sec I guess that we can
expect the difference to be at least 1 second because:
- the minimal granularity is 1s in which case we will get exactly 1s in
the diff
- if the granularity is greater, we will get a bit more than 1s
So I would go for something as:
long long diff_us = tst_timespec_diff_us(timestamp2, timestamp1);
if (diff_us >= 1000000 && diff_us <= 2000000)
tst_res(TPASS, "...");
Which expects that the difference between timestamps is in a sane range
not that it just have been changed.
> tst_res(TPASS, "copy_file_range sucessfully updated the timestamp");
> --
> 2.31.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-09-06 8:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 6:00 [LTP] [PATCH v2] copy_file_range03: comparing timestamp in tst_timespec_diff Li Wang
2021-09-06 6:00 ` Li Wang
2021-09-06 7:54 ` xuyang2018.jy
2021-09-06 7:54 ` xuyang2018.jy
2021-09-06 8:59 ` Cyril Hrubis [this message]
2021-09-06 8:59 ` Cyril Hrubis
2021-09-06 10:35 ` Li Wang
2021-09-06 10:35 ` Li Wang
2021-09-06 10:38 ` Cyril Hrubis
2021-09-06 10:38 ` Cyril Hrubis
2021-09-06 10:42 ` Li Wang
2021-09-06 10:42 ` Li Wang
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=YTXYixG37nBTzhXk@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox