Hello all, I strongly suspect that these two failures are linked. The failure in the fork test is most likely caused by a failure in the rand calls in that test (why use rand, anyway?) We only want to test fork, and rand has a non-zero chance of collision, which makes it a false positive failure.
So, with this test: #!/usr/bin/perl use POSIX ":sys_wait_h"; my $count = 0; for (0.. 99) { &do_test(1); } print "Test (rand) passed $count % of the time\n"; $count = 0; for (0.. 99) { &do_test(0); } print "Test (fixed) passed $count % of the time\n"; sub do_test { my $try = shift; pipe(RDR,WTR) or die $!; my $pid = fork; die "fork: $!" if !defined $pid; if ($pid == 0) { my $rand_child; if ($try == 1) { $rand_child = rand; } else { $rand_child = 2; } close RDR; print WTR $rand_child, "\n"; close WTR; exit 0; } elsif ($pid > 0) { my $rand_parent; if ($try == 1) { $rand_parent = rand; } else { $rand_parent = 1; } close WTR; chomp(my $rand_child = <RDR>); close RDR; my $kid; do { $kid = waitpid($pid, 0); } until $kid > 0; $count++ if ($rand_child ne $rand_parent); } else { die "Can't fork: $!\n"; } } I get: Test (rand) passed 1 % of the time Test (fixed) passed 100 % of the time This is because the parent and the child get the same value for rand() almost every time (although oddly, the first time almost always succeeds in getting different values, so the original test passed most of the time). I suggest changing the fork test to something using predefined values, as above. As for why rand fails so often when called so close together, I haven't looked at that yet. -- ----------------------------------------------------------------- | ,''`. Stephen Gran | | : :' : [EMAIL PROTECTED] | | `. `' Debian user, admin, and developer | | `- http://www.debian.org | -----------------------------------------------------------------
signature.asc
Description: Digital signature