Skip to content

Commit 59760ce

Browse files
committed
Turn off watchdog when done in tests
If you set a watchdog timer, you should clear it when its no longer needed. Otherwise it can go off, aborting your test script. In these more than two dozen test files, it hasn't mostly been a problem because the script finishes before the timer goes off. But I bet that some heisenbugs have been the result of not clearing it. It actually shouldn't be necessary to clear the timer when that is the final statement in the test file, but we may want to add a porting test that makes sure watchdogs are cleared, and this enables such a test to properly work.
1 parent 4610cbf commit 59760ce

27 files changed

+47
-1
lines changed

dist/IO/t/io_multihomed.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,5 @@ if (my $pid = fork()) {
117117
} else {
118118
die;
119119
}
120+
121+
watchdog(0);

dist/IO/t/io_udp.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ is($buf, 'FOObar');
9999
}
100100
}
101101

102+
watchdog(0);
103+
102104
exit(0);
103105

104106
# EOF

dist/threads-shared/t/wait.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ SYNCH_REFS: {
335335

336336
} # -- SYNCH_REFS block
337337

338+
Test::watchdog(0);
339+
338340
# Done
339341
exit(0);
340342

dist/threads-shared/t/waithires.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ SYNCH_REFS: {
368368

369369
} # -- SYNCH_REFS block
370370

371+
Test::watchdog(0);
372+
371373
# Done
372374
exit(0);
373375

dist/threads/t/free.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ sub threading_3 {
209209
}
210210
ok($COUNT == 2, "Done - $COUNT threads");
211211

212+
Test::watchdog(0);
213+
212214
exit(0);
213215

214216
# EOF

dist/threads/t/free2.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ TEST_STARTS_HERE:
333333
}
334334
ok($COUNT == 17, "Done - $COUNT threads");
335335

336+
Test::watchdog(0);
337+
336338
exit(0);
337339

338340
# EOF

dist/threads/t/libc.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ for (1..$i) {
4949
is($threads[$_]->join(), 0, 'localtime() thread-safe');
5050
}
5151

52+
watchdog(0);
53+
5254
exit(0);
5355

5456
# EOF

ext/XS-APItest/t/keyword_plugin_threads.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ for my $t (1 .. 3) {
2626
})->join;
2727
}
2828
29+
watchdog(0);
30+
2931
print "all is well\n";
3032
----
3133
all is well

ext/re/t/re_funcs_u.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
128128
# New tests go here ^^^
129129

130130
{ # Keep these tests last, as whole script will be interrupted if times out
131-
# Bug #72998; this can loop
131+
# Bug #72998; this can loop
132132
watchdog(10);
133133
eval '"\x{100}\x{FB00}" =~ /\x{100}\N{U+66}+/i';
134134
pass("Didn't loop");
@@ -137,6 +137,7 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
137137
no warnings; # Because the 8 may be warned on
138138
eval 'qr/\18/';
139139
pass(q"qr/\18/ didn't loop");
140+
watchdog(0);
140141
}
141142

142143
done_testing();

t/io/closepid.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ SKIP:
4242
kill $killsig, $pid;
4343
open STDIN, "<&", $savein;
4444
}
45+
46+
watchdog(0);

0 commit comments

Comments
 (0)