gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, extgawk, updated. 47828911ae88038eda1051


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 47828911ae88038eda1051cfa2232f46eda95fd8
Date: Thu, 28 Jun 2012 14:38:14 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  47828911ae88038eda1051cfa2232f46eda95fd8 (commit)
      from  2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=47828911ae88038eda1051cfa2232f46eda95fd8

commit 47828911ae88038eda1051cfa2232f46eda95fd8
Author: Andrew J. Schorr <address@hidden>
Date:   Thu Jun 28 10:37:36 2012 -0400

    Protect against race condition in test/time.awk.

diff --git a/test/ChangeLog b/test/ChangeLog
index a0f7a64..057434f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-28         Andrew J. Schorr     <address@hidden>
+
+       * time.awk: Avoid possibly throwing a spurious error by protecting
+       a race condition that depends on the order of expression evaluation.
+
 2012-06-25         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (rwarray): New test.
diff --git a/test/time.awk b/test/time.awk
index eeabc7b..517377e 100644
--- a/test/time.awk
+++ b/test/time.awk
@@ -1,10 +1,20 @@
 @load "time"
 
+# make sure gettimeofday() is consistent with systime().  We must call
+# gettimeofday() before systime() to make sure the subtraction gives 0
+# without risk of rolling over to the next second.
+function timecheck(st,res) {
+   res = gettimeofday()
+   st = systime()
+   printf "gettimeofday - systime = %d\n", res-st
+   return res
+}
+
 BEGIN {
    delta = 1.3
-   printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime()
+   t0 = timecheck()
    printf "sleep(%s) = %s\n",delta,sleep(delta)
-   printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime()
+   t1 = timecheck()
    slept = t1-t0
    if ((slept < 0.9*delta) || (slept > 1.3*delta))
       printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n",

-----------------------------------------------------------------------

Summary of changes:
 test/ChangeLog |    5 +++++
 test/time.awk  |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]