Skip to content

Instantly share code, notes, and snippets.

@schwern
Created November 30, 2011 10:06
Show Gist options
  • Save schwern/1408557 to your computer and use it in GitHub Desktop.
Save schwern/1408557 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
pass("Before fork");
my $tb = Test::More->builder;
# Don't use numbers, so test synchronization between processes is not
# at issue.
$tb->use_numbers(0);
# Don't check in the parent process that the correct number of tests was run.
$tb->no_ending(1);
my $pid = fork;
if( ! defined $pid ) { # failed
die "fork() failed: $!";
}
elsif( $pid ) { # parent
pass("Parent $_") for 1..600;
}
else { # child
pass("Child $_") for 1..500;
exit;
}
wait;
pass("After fork");
# A hard coded plan so the parent process does not need to count
done_testing(500 + 600 + 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment