# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #43250]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43250 >


Test 5 of F<t/dynoplibs/myops.t> has some very strong timing constraint.
 Two sleeps of a second each (and a few minor int/print ops) may not be
faster than a two seconds alarm.  This often doesn't work out on my box
(Windows XP, Visual C++).

t\dynoplibs\myops....NOK 5#     Failed test (t\dynoplibs\myops.t at line 77)
#          got: '1
# 2
# alarm
# 3
# done.
# '
#     expected: '1
# alarm
# 2
# 3
# done.
# '

Attached patch unrolls the loop, which may or may not be more readable,
but more importantly opens a +/- 1 second time window for the alarm.

$ prove t\dynoplibs\myops.t
t\dynoplibs\myops....ok
All tests successful.
Files=1, Tests=8, 10 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)

Ron
Index: t/dynoplibs/myops.t
===================================================================
--- t/dynoplibs/myops.t (revision 19083)
+++ t/dynoplibs/myops.t (working copy)
@@ -80,14 +80,16 @@
 .sub main :main
     find_global P0, "_alarm"
     alarm 2.0, P0
-    set I0, 1
-loop:
     sleep 1
-    print I0
-    print "\n"
-    inc I0
-    # check_events
-    le I0, 3, loop
+    print "1\n"
+
+    # alarm should be triggered half-way
+    # during this sleep
+    sleep 2
+    print "2\n"
+
+    sleep 1
+    print "3\n"
     print "done.\n"
 .end
 

Reply via email to