* [PATCH blktests] nvme/053: provide time extension alternative
@ 2024-12-18 11:13 Luis Chamberlain
2024-12-20 11:37 ` Shinichiro Kawasaki
2025-01-08 20:37 ` Martin Wilck
0 siblings, 2 replies; 6+ messages in thread
From: Luis Chamberlain @ 2024-12-18 11:13 UTC (permalink / raw)
To: shinichiro.kawasaki, martin.wilck; +Cc: linux-block, patches, gost.dev, mcgrof
I get this failure when I run this test:
awk: ...rescan.awk:2: warning: The time extension is obsolete.
Use the timex extension from gawkextlib
I can't find this extension either, so just use systime() and
use system(sleep) for the sleep command.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
tests/nvme/053 | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/nvme/053 b/tests/nvme/053
index 3ade8d368be6..65a7b86519bc 100755
--- a/tests/nvme/053
+++ b/tests/nvme/053
@@ -27,13 +27,14 @@ rescan_controller() {
create_rescan_script() {
cat >"$TMPDIR/rescan.awk" <<EOF
-@load "time"
-
BEGIN {
srand(seed);
- finish = gettimeofday() + strtonum(timeout);
- while (gettimeofday() < finish) {
- sleep(0.1 + 5 * rand());
+ start_time = systime();
+ finish = start_time + strtonum(timeout);
+ while (systime() < finish) {
+ sleep_time = 0.1 + 5 * rand();
+ cmd = "sleep " sleep_time;
+ system(cmd);
printf("1\n") > path;
close(path);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH blktests] nvme/053: provide time extension alternative
2024-12-18 11:13 [PATCH blktests] nvme/053: provide time extension alternative Luis Chamberlain
@ 2024-12-20 11:37 ` Shinichiro Kawasaki
2025-01-04 4:05 ` Luis Chamberlain
2025-01-08 20:12 ` Martin Wilck
2025-01-08 20:37 ` Martin Wilck
1 sibling, 2 replies; 6+ messages in thread
From: Shinichiro Kawasaki @ 2024-12-20 11:37 UTC (permalink / raw)
To: Luis Chamberlain
Cc: martin.wilck@suse.com, linux-block@vger.kernel.org,
patches@lists.linux.dev, gost.dev@samsung.com
On Dec 18, 2024 / 03:13, Luis Chamberlain wrote:
> I get this failure when I run this test:
>
> awk: ...rescan.awk:2: warning: The time extension is obsolete.
> Use the timex extension from gawkextlib
Hi Luis, thank you for catching this.
> I can't find this extension either, so just use systime() and
> use system(sleep) for the sleep command.
FYI, here I share the link to the past discussion that resulted in the awk
script in nvme/053 [1]. In that discussion, Martin noted that
'But the fork-and-exec to "awk" is slow.'
So I wonder if this system(sleep) in the awk while loop could be slow also.
Assuming this system(sleep) approach is slow and not preferred, I suggest to go
back to the approach that the Martin's v1 patch took [2]. The while loop is
implemented with bash. The awk script was introduced for the float calculation
to get the random float number from 0.1 to 5.0. However, I think such
calculation can be done with bash as follows:
get_sleep_time() {
local duration=$((RANDOM % 50 + 1))
echo "$((duration / 10))"."$((duration % 10))"
}
With this, we should be able to drop the awk script form the test case.
Martin, what do you think?
[1] https://lore.kernel.org/linux-nvme/2cb6f86256803af00557f07e9573331c51111953.camel@suse.com/
[2] https://lore.kernel.org/linux-nvme/20240822193814.106111-3-mwilck@suse.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH blktests] nvme/053: provide time extension alternative
2024-12-20 11:37 ` Shinichiro Kawasaki
@ 2025-01-04 4:05 ` Luis Chamberlain
2025-01-08 20:12 ` Martin Wilck
1 sibling, 0 replies; 6+ messages in thread
From: Luis Chamberlain @ 2025-01-04 4:05 UTC (permalink / raw)
To: Shinichiro Kawasaki
Cc: martin.wilck@suse.com, linux-block@vger.kernel.org,
patches@lists.linux.dev, gost.dev@samsung.com
On Fri, Dec 20, 2024 at 11:37:03AM +0000, Shinichiro Kawasaki wrote:
>
> Martin, what do you think?
Martin, poke.
Luis
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH blktests] nvme/053: provide time extension alternative
2024-12-20 11:37 ` Shinichiro Kawasaki
2025-01-04 4:05 ` Luis Chamberlain
@ 2025-01-08 20:12 ` Martin Wilck
2025-01-16 7:17 ` Shinichiro Kawasaki
1 sibling, 1 reply; 6+ messages in thread
From: Martin Wilck @ 2025-01-08 20:12 UTC (permalink / raw)
To: Shinichiro Kawasaki, Luis Chamberlain
Cc: linux-block@vger.kernel.org, patches@lists.linux.dev,
gost.dev@samsung.com
On Fri, 2024-12-20 at 11:37 +0000, Shinichiro Kawasaki wrote:
> On Dec 18, 2024 / 03:13, Luis Chamberlain wrote:
> > I get this failure when I run this test:
> >
> > awk: ...rescan.awk:2: warning: The time extension is obsolete.
> > Use the timex extension from gawkextlib
>
> get_sleep_time() {
> local duration=$((RANDOM % 50 + 1))
>
> echo "$((duration / 10))"."$((duration % 10))"
> }
>
> With this, we should be able to drop the awk script form the test
> case.
>
> Martin, what do you think?
Fine with me, and actually, nice. This way we don't need awk at all.
Do you want me to submit a patch, or will you do it yourself?
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH blktests] nvme/053: provide time extension alternative
2024-12-18 11:13 [PATCH blktests] nvme/053: provide time extension alternative Luis Chamberlain
2024-12-20 11:37 ` Shinichiro Kawasaki
@ 2025-01-08 20:37 ` Martin Wilck
1 sibling, 0 replies; 6+ messages in thread
From: Martin Wilck @ 2025-01-08 20:37 UTC (permalink / raw)
To: Luis Chamberlain, shinichiro.kawasaki; +Cc: linux-block, patches, gost.dev
On Wed, 2024-12-18 at 03:13 -0800, Luis Chamberlain wrote:
> I get this failure when I run this test:
>
> awk: ...rescan.awk:2: warning: The time extension is obsolete.
> Use the timex extension from gawkextlib
>
> I can't find this extension either, so just use systime() and
> use system(sleep) for the sleep command.
While I'm ok with Shinshiro's propsal for working around this issue, I
wonder which gawk version you are using? In the history of gawk, I can
see that the deprecation of the "time" extension (gawk 5.2.0) was taken
back in gawk 5.2.2:
c3c6419 ("Make the time extension deprecated.")
6e195e4 ("Undeprecate the time extension, add strptime, update tests
and doc.")
The NEWS file says "The time extension is no longer deprecated. The
strptime() function from gawkextlib's timex extension has been added to
it."
Regards,
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH blktests] nvme/053: provide time extension alternative
2025-01-08 20:12 ` Martin Wilck
@ 2025-01-16 7:17 ` Shinichiro Kawasaki
0 siblings, 0 replies; 6+ messages in thread
From: Shinichiro Kawasaki @ 2025-01-16 7:17 UTC (permalink / raw)
To: Martin Wilck
Cc: Luis Chamberlain, linux-block@vger.kernel.org,
patches@lists.linux.dev, gost.dev@samsung.com
On Jan 08, 2025 / 21:12, Martin Wilck wrote:
> On Fri, 2024-12-20 at 11:37 +0000, Shinichiro Kawasaki wrote:
> > On Dec 18, 2024 / 03:13, Luis Chamberlain wrote:
> > > I get this failure when I run this test:
> > >
> > > awk: ...rescan.awk:2: warning: The time extension is obsolete.
> > > Use the timex extension from gawkextlib
> >
> > get_sleep_time() {
> > local duration=$((RANDOM % 50 + 1))
> >
> > echo "$((duration / 10))"."$((duration % 10))"
> > }
> >
> > With this, we should be able to drop the awk script form the test
> > case.
> >
> > Martin, what do you think?
>
> Fine with me, and actually, nice. This way we don't need awk at all.
> Do you want me to submit a patch, or will you do it yourself?
Thanks for the response. I have prepared the fix patch, and will post it soon.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-16 7:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 11:13 [PATCH blktests] nvme/053: provide time extension alternative Luis Chamberlain
2024-12-20 11:37 ` Shinichiro Kawasaki
2025-01-04 4:05 ` Luis Chamberlain
2025-01-08 20:12 ` Martin Wilck
2025-01-16 7:17 ` Shinichiro Kawasaki
2025-01-08 20:37 ` Martin Wilck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox