Upgrade to Time-HiRes-1.85
[p5sagit/p5-mst-13.2.git] / ext / Time / HiRes / t / HiRes.t
CommitLineData
88cb3de1 1#!./perl -w
2
dcf686c9 3BEGIN {
3f2ee006 4 if ($ENV{PERL_CORE}) {
5 chdir 't' if -d 't';
6 @INC = '../lib';
df2f6354 7 require Config; import Config;
8 if (" $Config{'extensions'} " !~ m[ Time/HiRes ]) {
9 print "1..0 # Skip -- Perl configured without Time::HiRes module\n";
10 exit 0;
11 }
3f2ee006 12 }
dcf686c9 13}
14
170c5524 15BEGIN { $| = 1; print "1..33\n"; }
dcf686c9 16
0cf8ddea 17END { print "not ok 1\n" unless $loaded }
dcf686c9 18
19use Time::HiRes qw(tv_interval);
20
21$loaded = 1;
22
23print "ok 1\n";
24
25use strict;
26
170c5524 27my $have_gettimeofday = &Time::HiRes::d_gettimeofday;
28my $have_usleep = &Time::HiRes::d_usleep;
29my $have_nanosleep = &Time::HiRes::d_nanosleep;
30my $have_ualarm = &Time::HiRes::d_ualarm;
31my $have_clock_gettime = &Time::HiRes::d_clock_gettime;
32my $have_clock_getres = &Time::HiRes::d_clock_getres;
33my $have_clock_nanosleep = &Time::HiRes::d_clock_nanosleep;
34my $have_clock = &Time::HiRes::d_clock;
dcf686c9 35
b311af62 36sub has_symbol {
37 my $symbol = shift;
a5929ff3 38 eval "use Time::HiRes qw($symbol)";
b311af62 39 return 0 unless $@ eq '';
a5929ff3 40 eval "my \$a = $symbol";
41 return $@ eq '';
b311af62 42}
43
170c5524 44printf "# have_gettimeofday = %d\n", $have_gettimeofday;
45printf "# have_usleep = %d\n", $have_usleep;
46printf "# have_nanosleep = %d\n", $have_nanosleep;
47printf "# have_ualarm = %d\n", $have_ualarm;
48printf "# have_clock_gettime = %d\n", $have_clock_gettime;
49printf "# have_clock_getres = %d\n", $have_clock_getres;
50printf "# have_clock_nanosleep = %d\n", $have_clock_nanosleep;
51printf "# have_clock = %d\n", $have_clock;
3d0346a5 52
dcf686c9 53import Time::HiRes 'gettimeofday' if $have_gettimeofday;
54import Time::HiRes 'usleep' if $have_usleep;
44d3ce20 55import Time::HiRes 'nanosleep' if $have_nanosleep;
dcf686c9 56import Time::HiRes 'ualarm' if $have_ualarm;
ced84e60 57import Time::HiRes 'clock_gettime' if $have_clock_gettime;
58import Time::HiRes 'clock_getres' if $have_clock_getres;
170c5524 59import Time::HiRes 'clock_nanosleep' if $have_clock_nanosleep;
60import Time::HiRes 'clock' if $have_clock;
dcf686c9 61
3c72ec00 62use Config;
63
82cbdcc3 64use Time::HiRes qw(gettimeofday);
65
690f7c5f 66my $have_alarm = $Config{d_alarm};
67my $have_fork = $Config{d_fork};
3d0346a5 68my $waitfor = 60; # 10-20 seconds is normal (load affects this).
69my $timer_pid;
b311af62 70my $TheEnd;
690f7c5f 71
72if ($have_fork) {
3d0346a5 73 print "# I am the main process $$, starting the timer process...\n";
74 $timer_pid = fork();
75 if (defined $timer_pid) {
76 if ($timer_pid == 0) { # We are the kid, set up the timer.
77 print "# I am the timer process $$, sleeping for $waitfor seconds...\n";
690f7c5f 78 sleep($waitfor);
3d0346a5 79 warn "\n$0: overall time allowed for tests (${waitfor}s) exceeded!\n";
80 print "# Terminating the main process...\n";
690f7c5f 81 kill('TERM', getppid());
3d0346a5 82 print "# This is the timer process $$, over and out.\n";
690f7c5f 83 exit(0);
3d0346a5 84 } else {
b311af62 85 print "# The timer process $timer_pid launched, continuing testing...\n";
86 $TheEnd = time() + $waitfor;
690f7c5f 87 }
88 } else {
89 warn "$0: fork failed: $!\n";
90 }
91} else {
3d0346a5 92 print "# No timer process (need fork)\n";
690f7c5f 93}
94
12724655 95my $xdefine = '';
3f2ee006 96
97if (open(XDEFINE, "xdefine")) {
98 chomp($xdefine = <XDEFINE>);
99 close(XDEFINE);
100}
101
0740bb5b 102# Ideally, we'd like to test that the timers are rather precise.
103# However, if the system is busy, there are no guarantees on how
104# quickly we will return. This limit used to be 10%, but that
105# was occasionally triggered falsely.
106# Try 20%.
107# Another possibility might be to print "ok" if the test completes fine
108# with (say) 10% slosh, "skip - system may have been busy?" if the test
109# completes fine with (say) 30% slosh, and fail otherwise. If you do that,
110# consider changing over to test.pl at the same time.
111# --A.D., Nov 27, 2001
112my $limit = 0.20; # 20% is acceptable slosh for testing timers
113
dcf686c9 114sub skip {
3f2ee006 115 map { print "ok $_ # skipped\n" } @_;
dcf686c9 116}
117
118sub ok {
119 my ($n, $result, @info) = @_;
120 if ($result) {
121 print "ok $n\n";
122 }
123 else {
124 print "not ok $n\n";
125 print "# @info\n" if @info;
126 }
127}
128
3d0346a5 129unless ($have_gettimeofday) {
dcf686c9 130 skip 2..6;
131}
132else {
133 my @one = gettimeofday();
134 ok 2, @one == 2, 'gettimeofday returned ', 0+@one, ' args';
135 ok 3, $one[0] > 850_000_000, "@one too small";
136
137 sleep 1;
138
139 my @two = gettimeofday();
140 ok 4, ($two[0] > $one[0] || ($two[0] == $one[0] && $two[1] > $one[1])),
141 "@two is not greater than @one";
142
c9ff6e92 143 my $f = Time::HiRes::time();
dcf686c9 144 ok 5, $f > 850_000_000, "$f too small";
0740bb5b 145 ok 6, $f - $two[0] < 2, "$f - $two[0] >= 2";
dcf686c9 146}
147
3d0346a5 148unless ($have_usleep) {
dcf686c9 149 skip 7..8;
150}
151else {
82cbdcc3 152 use Time::HiRes qw(usleep);
dcf686c9 153 my $one = time;
154 usleep(10_000);
155 my $two = time;
156 usleep(10_000);
157 my $three = time;
158 ok 7, $one == $two || $two == $three, "slept too long, $one $two $three";
159
3d0346a5 160 unless ($have_gettimeofday) {
dcf686c9 161 skip 8;
162 }
163 else {
c9ff6e92 164 my $f = Time::HiRes::time();
dcf686c9 165 usleep(500_000);
c9ff6e92 166 my $f2 = Time::HiRes::time();
dcf686c9 167 my $d = $f2 - $f;
0740bb5b 168 ok 8, $d > 0.4 && $d < 0.9, "slept $d secs $f to $f2";
dcf686c9 169 }
170}
171
172# Two-arg tv_interval() is always available.
173{
174 my $f = tv_interval [5, 100_000], [10, 500_000];
6cf89afa 175 ok 9, abs($f - 5.4) < 0.001, $f;
dcf686c9 176}
177
3d0346a5 178unless ($have_gettimeofday) {
dcf686c9 179 skip 10;
180}
181else {
182 my $r = [gettimeofday()];
183 my $f = tv_interval $r;
184 ok 10, $f < 2, $f;
185}
186
3d0346a5 187unless ($have_usleep && $have_gettimeofday) {
dcf686c9 188 skip 11;
189}
190else {
82cbdcc3 191 my $r = [ gettimeofday() ];
dcf686c9 192 Time::HiRes::sleep( 0.5 );
193 my $f = tv_interval $r;
0740bb5b 194 ok 11, $f > 0.4 && $f < 0.9, "slept $f instead of 0.5 secs.";
dcf686c9 195}
196
3d0346a5 197unless ($have_ualarm && $have_alarm) {
dcf686c9 198 skip 12..13;
199}
200else {
201 my $tick = 0;
64a7a97c 202 local $SIG{ ALRM } = sub { $tick++ };
dcf686c9 203
64a7a97c 204 my $one = time; $tick = 0; ualarm(10_000); while ($tick == 0) { }
205 my $two = time; $tick = 0; ualarm(10_000); while ($tick == 0) { }
dcf686c9 206 my $three = time;
207 ok 12, $one == $two || $two == $three, "slept too long, $one $two $three";
64a7a97c 208 print "# tick = $tick, one = $one, two = $two, three = $three\n";
dcf686c9 209
64a7a97c 210 $tick = 0; ualarm(10_000, 10_000); while ($tick < 3) { }
dcf686c9 211 ok 13, 1;
212 ualarm(0);
64a7a97c 213 print "# tick = $tick, one = $one, two = $two, three = $three\n";
dcf686c9 214}
215
64a7a97c 216# Did we even get close?
dcf686c9 217
ced84e60 218unless ($have_gettimeofday) {
64a7a97c 219 skip 14;
c9ff6e92 220} else {
1fbb4de4 221 my ($s, $n, $i) = (0);
222 for $i (1 .. 100) {
456811e8 223 $s += Time::HiRes::time() - time();
224 $n++;
64cc9c1c 225 }
456811e8 226 # $s should be, at worst, equal to $n
227 # (time() may be rounding down, up, or closest)
228 ok 14, abs($s) / $n <= 1.0, "Time::HiRes::time() not close to time()";
229 print "# s = $s, n = $n, s/n = ", $s/$n, "\n";
dcf686c9 230}
231
3f2ee006 232my $has_ualarm = $Config{d_ualarm};
233
234$has_ualarm ||= $xdefine =~ /-DHAS_UALARM/;
235
236unless ( defined &Time::HiRes::gettimeofday
dcf686c9 237 && defined &Time::HiRes::ualarm
c7f7de79 238 && defined &Time::HiRes::usleep
3f2ee006 239 && $has_ualarm) {
dcf686c9 240 for (15..17) {
3f2ee006 241 print "ok $_ # Skip: no gettimeofday or no ualarm or no usleep\n";
dcf686c9 242 }
243} else {
ced84e60 244 use Time::HiRes qw(time alarm sleep);
dcf686c9 245
cb203acc 246 my ($f, $r, $i, $not, $ok);
dcf686c9 247
dcf686c9 248 $f = time;
add58217 249 print "# time...$f\n";
250 print "ok 15\n";
dcf686c9 251
c9ff6e92 252 $r = [Time::HiRes::gettimeofday()];
dcf686c9 253 sleep (0.5);
add58217 254 print "# sleep...", Time::HiRes::tv_interval($r), "\nok 16\n";
dcf686c9 255
c9ff6e92 256 $r = [Time::HiRes::gettimeofday()];
dcf686c9 257 $i = 5;
258 $SIG{ALRM} = "tick";
6ea166ef 259 while ($i > 0)
dcf686c9 260 {
0e172911 261 alarm(0.3);
c7f7de79 262 select (undef, undef, undef, 3);
263 my $ival = Time::HiRes::tv_interval ($r);
264 print "# Select returned! $i $ival\n";
cb203acc 265 print "# ", abs($ival/3 - 1), "\n";
266 # Whether select() gets restarted after signals is
267 # implementation dependent. If it is restarted, we
268 # will get about 3.3 seconds: 3 from the select, 0.3
269 # from the alarm. If this happens, let's just skip
270 # this particular test. --jhi
271 if (abs($ival/3.3 - 1) < $limit) {
3f2ee006 272 $ok = "Skip: your select() may get restarted by your SIGALRM (or just retry test)";
cb203acc 273 undef $not;
274 last;
275 }
c7f7de79 276 my $exp = 0.3 * (5 - $i);
0740bb5b 277 # This test is more sensitive, so impose a softer limit.
cb203acc 278 if (abs($ival/$exp - 1) > 3*$limit) {
0740bb5b 279 my $ratio = abs($ival/$exp);
280 $not = "while: $exp sleep took $ival ratio $ratio";
c7f7de79 281 last;
282 }
cb203acc 283 $ok = $i;
dcf686c9 284 }
285
286 sub tick
287 {
dcf686c9 288 $i--;
c7f7de79 289 my $ival = Time::HiRes::tv_interval ($r);
290 print "# Tick! $i $ival\n";
291 my $exp = 0.3 * (5 - $i);
0740bb5b 292 # This test is more sensitive, so impose a softer limit.
cb203acc 293 if (abs($ival/$exp - 1) > 3*$limit) {
0740bb5b 294 my $ratio = abs($ival/$exp);
295 $not = "tick: $exp sleep took $ival ratio $ratio";
c7f7de79 296 $i = 0;
297 }
dcf686c9 298 }
c7f7de79 299
d0b83b2b 300 alarm(0); # can't cancel usig %SIG
dcf686c9 301
cb203acc 302 print $not ? "not ok 17 # $not\n" : "ok 17 # $ok\n";
dcf686c9 303}
304
3f2ee006 305unless ( defined &Time::HiRes::setitimer
3c72ec00 306 && defined &Time::HiRes::getitimer
b311af62 307 && has_symbol('ITIMER_VIRTUAL')
d0b83b2b 308 && $Config{sig_name} =~ m/\bVTALRM\b/) {
3c72ec00 309 for (18..19) {
0e172911 310 print "ok $_ # Skip: no virtual interval timers\n";
3c72ec00 311 }
312} else {
b311af62 313 use Time::HiRes qw(setitimer getitimer ITIMER_VIRTUAL);
3c72ec00 314
315 my $i = 3;
c9ff6e92 316 my $r = [Time::HiRes::gettimeofday()];
3c72ec00 317
318 $SIG{VTALRM} = sub {
b311af62 319 $i ? $i-- : setitimer(&ITIMER_VIRTUAL, 0);
3c72ec00 320 print "# Tick! $i ", Time::HiRes::tv_interval($r), "\n";
321 };
322
0e172911 323 print "# setitimer: ", join(" ", setitimer(ITIMER_VIRTUAL, 0.5, 0.4)), "\n";
324
0740bb5b 325 # Assume interval timer granularity of $limit * 0.5 seconds. Too bold?
b311af62 326 my $virt = getitimer(&ITIMER_VIRTUAL);
4ed0e2d4 327 print "not " unless defined $virt && abs($virt / 0.5) - 1 < $limit;
0e172911 328 print "ok 18\n";
3c72ec00 329
330 print "# getitimer: ", join(" ", getitimer(ITIMER_VIRTUAL)), "\n";
331
b311af62 332 while (getitimer(&ITIMER_VIRTUAL)) {
3f2ee006 333 my $j;
334 for (1..1000) { $j++ } # Can't be unbreakable, must test getitimer().
3c72ec00 335 }
336
337 print "# getitimer: ", join(" ", getitimer(ITIMER_VIRTUAL)), "\n";
338
b311af62 339 $virt = getitimer(&ITIMER_VIRTUAL);
4ed0e2d4 340 print "not " unless defined $virt && $virt == 0;
0e172911 341 print "ok 19\n";
342
3c72ec00 343 $SIG{VTALRM} = 'DEFAULT';
344}
345
82cbdcc3 346if ($have_gettimeofday &&
347 $have_usleep) {
348 use Time::HiRes qw(usleep);
349
9c735d59 350 my ($t0, $td);
52d72fba 351
9c735d59 352 my $sleep = 1.5; # seconds
9c735d59 353 my $msg;
354
355 $t0 = gettimeofday();
356 $a = abs(sleep($sleep) / $sleep - 1.0);
357 $td = gettimeofday() - $t0;
0740bb5b 358 my $ratio = 1.0 + $a;
9c735d59 359
0740bb5b 360 $msg = "$td went by while sleeping $sleep, ratio $ratio.\n";
9c735d59 361
362 if ($td < $sleep * (1 + $limit)) {
363 print $a < $limit ? "ok 20 # $msg" : "not ok 20 # $msg";
364 } else {
365 print "ok 20 # Skip: $msg";
366 }
367
368 $t0 = gettimeofday();
369 $a = abs(usleep($sleep * 1E6) / ($sleep * 1E6) - 1.0);
370 $td = gettimeofday() - $t0;
0740bb5b 371 $ratio = 1.0 + $a;
9c735d59 372
0740bb5b 373 $msg = "$td went by while sleeping $sleep, ratio $ratio.\n";
9c735d59 374
375 if ($td < $sleep * (1 + $limit)) {
376 print $a < $limit ? "ok 21 # $msg" : "not ok 21 # $msg";
377 } else {
378 print "ok 21 # Skip: $msg";
379 }
380
381} else {
382 for (20..21) {
383 print "ok $_ # Skip: no gettimeofday\n";
384 }
385}
52d72fba 386
3d0346a5 387unless ($have_nanosleep) {
44d3ce20 388 skip 22..23;
389}
390else {
391 my $one = CORE::time;
392 nanosleep(10_000_000);
393 my $two = CORE::time;
394 nanosleep(10_000_000);
395 my $three = CORE::time;
396 ok 22, $one == $two || $two == $three, "slept too long, $one $two $three";
397
3d0346a5 398 unless ($have_gettimeofday) {
44d3ce20 399 skip 23;
400 }
401 else {
402 my $f = Time::HiRes::time();
403 nanosleep(500_000_000);
404 my $f2 = Time::HiRes::time();
405 my $d = $f2 - $f;
406 ok 23, $d > 0.4 && $d < 0.9, "slept $d secs $f to $f2";
407 }
408}
409
f7916ddb 410eval { sleep(-1) };
411print $@ =~ /::sleep\(-1\): negative time not invented yet/ ?
44d3ce20 412 "ok 24\n" : "not ok 24\n";
f7916ddb 413
414eval { usleep(-2) };
415print $@ =~ /::usleep\(-2\): negative time not invented yet/ ?
44d3ce20 416 "ok 25\n" : "not ok 25\n";
f7916ddb 417
ec77158c 418if ($have_ualarm) {
c46d5038 419 eval { alarm(-3) };
420 print $@ =~ /::alarm\(-3, 0\): negative time not invented yet/ ?
44d3ce20 421 "ok 26\n" : "not ok 26\n";
c46d5038 422
ec77158c 423 eval { ualarm(-4) };
424 print $@ =~ /::ualarm\(-4, 0\): negative time not invented yet/ ?
44d3ce20 425 "ok 27\n" : "not ok 27\n";
426} else {
427 skip 26;
428 skip 27;
429}
430
431if ($have_nanosleep) {
432 eval { nanosleep(-5) };
433 print $@ =~ /::nanosleep\(-5\): negative time not invented yet/ ?
434 "ok 28\n" : "not ok 28\n";
ec77158c 435} else {
44d3ce20 436 skip 28;
ec77158c 437}
690f7c5f 438
3d0346a5 439if ($have_ualarm && $] >= 5.008001) {
440 # http://groups.google.com/group/perl.perl5.porters/browse_thread/thread/adaffaaf939b042e/20dafc298df737f0%2320dafc298df737f0?sa=X&oi=groupsr&start=0&num=3
441 # Perl changes [18765] and [18770], perl bug [perl #20920]
ced84e60 442
443 # First we will find the loop size N (a for() loop 0..N-1)
444 # that will take more than T seconds.
445
446 my $T = 0.01;
447 use Time::HiRes qw(time);
448 my $N = 1024;
449 my $i;
450 N: {
451 do {
452 my $t0 = time();
453 for ($i = 0; $i < $N; $i++) { }
454 my $t1 = time();
455 my $dt = $t1 - $t0;
456 print "# N = $N, t1 = $t1, t0 = $t0, dt = $dt\n";
457 last N if $dt > $T;
458 $N *= 2;
459 } while (1);
460 }
461
462 # The time-burner which takes at least T seconds.
463 my $F = sub {
464 my $c = @_ ? shift : 1;
465 my $n = $c * $N;
466 my $i;
467 for ($i = 0; $i < $n; $i++) { }
468 };
469
470 # Then we will setup a periodic timer (the two-argument alarm() of
471 # Time::HiRes, behind the curtains the libc ualarm()) which has
472 # a signal handler that takes so much time (on the first initial
473 # invocation) that the first periodic invocation (second invocation)
474 # will happen before the first invocation has finished. In Perl 5.8.0
475 # the "safe signals" concept was implemented, with unfortunately at least
476 # one bug that caused a core dump on reentering the handler. This bug
477 # was fixed by the time of Perl 5.8.1.
478
b311af62 479 # Do not try mixing sleep() and alarm() for testing this.
480
ced84e60 481 my $a = 0; # Number of alarms we receive.
482 my $A = 2; # Number of alarms we will handle before disarming.
483 # (We may well get $A + 1 alarms.)
484
485 $SIG{ALRM} = sub {
486 $a++;
487 print "# Alarm $a - ", time(), "\n";
488 alarm(0) if $a >= $A; # Disarm the alarm.
489 $F->(2); # Try burning CPU at least for 2T seconds.
490 };
491
3d0346a5 492 use Time::HiRes qw(alarm);
ced84e60 493 alarm($T, $T); # Arm the alarm.
494
495 $F->(10); # Try burning CPU at least for 10T seconds.
496
3d0346a5 497 print "ok 29\n"; # Not core dumping by now is considered to be the success.
498} else {
499 skip 29;
500}
501
b311af62 502if ($have_clock_gettime &&
503 # All implementations of clock_gettime()
504 # are SUPPOSED TO support CLOCK_REALTIME.
505 has_symbol('CLOCK_REALTIME')) {
a5929ff3 506 my $ok = 0;
507 TRY: {
508 for my $try (1..3) {
509 print "# CLOCK_REALTIME: try = $try\n";
510 my $t0 = clock_gettime(&CLOCK_REALTIME);
511 use Time::HiRes qw(sleep);
512 my $T = 1.5;
513 sleep($T);
514 my $t1 = clock_gettime(&CLOCK_REALTIME);
515 if ($t0 > 0 && $t1 > $t0) {
516 print "# t1 = $t1, t0 = $t0\n";
517 my $dt = $t1 - $t0;
518 my $rt = abs(1 - $dt / $T);
519 print "# dt = $dt, rt = $rt\n";
520 if ($rt <= 2 * $limit) {
521 $ok = 1;
522 last TRY;
523 }
524 } else {
525 print "# Error: t0 = $t0, t1 = $t1\n";
526 }
527 my $r = rand() + rand();
170c5524 528 printf "# Sleeping for %.6f seconds...\n", $r;
a5929ff3 529 sleep($r);
ced84e60 530 }
a5929ff3 531 }
532 if ($ok) {
533 print "ok 30\n";
ced84e60 534 } else {
a5929ff3 535 print "not ok 30\n";
ced84e60 536 }
537} else {
538 print "# No clock_gettime\n";
539 skip 30;
540}
541
542if ($have_clock_getres) {
543 my $tr = clock_getres();
170c5524 544 if ($tr > 0) {
545 print "ok 31 # tr = $tr\n";
546 } else {
547 print "not ok 31 # tr = $tr\n";
548 }
ced84e60 549} else {
550 print "# No clock_getres\n";
551 skip 31;
552}
553
170c5524 554if ($have_clock_nanosleep &&
555 has_symbol('CLOCK_REALTIME')) {
556 my $s = 1.5;
557 my $t = clock_nanosleep(&CLOCK_REALTIME, $s);
558 my $r = abs(1 - $t / $s);
559 if ($r < 2 * $limit) {
560 print "ok 32\n";
561 } else {
562 print "not ok 32 # $t = $t, r = $r\n";
563 }
564} else {
565 print "# No clock_nanosleep\n";
566 skip 32;
567}
568
569if ($have_clock) {
570 my @clock = clock();
571 print "# clock = @clock\n";
572 for my $i (1..3) {
573 for (my $j = 0; $j < 1e6; $j++) { }
574 push @clock, clock();
575 print "# clock = @clock\n";
576 }
577 if ($clock[1] > $clock[0] &&
578 $clock[2] > $clock[1] &&
579 $clock[3] > $clock[2]) {
580 print "ok 32\n";
581 } else {
582 print "not ok 33\n";
583 }
584} else {
585 print "# No clock\n";
586 skip 33;
587}
588
3d0346a5 589END {
590 if (defined $timer_pid) {
b311af62 591 my $left = $TheEnd - time();
592 printf "# I am the main process $$, terminating the timer process $timer_pid\n# before it terminates me in %d seconds (testing took %d seconds).\n", $left, $waitfor - $left;
3d0346a5 593 kill('TERM', $timer_pid); # We are done, the timer can go.
594 unlink("ktrace.out"); # Used in BSD system call tracing.
595 print "# All done.\n";
596 }
690f7c5f 597}
598