3 # check nofork logic on systems which *can* fork()
4 # NOTE maybe a good candidate for xt/author or something.
7 if ( $ENV{PERL_CORE} ) {
9 @INC = ( '../lib', 'lib' );
22 : ( 'skip_all' => 'your system already has no fork' )
24 use IO::c55Capture; # for util
31 util::stdout_of( sub { system(@args) and die "error $?" } );
34 my @libs = map "-I$_", @INC;
35 my @perl = ( $^X, @libs );
36 my $mod = 'TAP::Parser::Iterator::Process';
38 { # just check the introspective method to start...
39 my $code = qq(print $mod->_use_open3 ? 1 : 2);
41 my $ans = backticks( @perl, '-MNoFork', "-M$mod", '-e', $code );
42 is( $ans, 2, 'says not to fork' );
45 local $ENV{PERL5OPT}; # punt: prevent propogating -MNoFork
46 my $ans = backticks( @perl, "-M$mod", '-e', $code );
47 is( $ans, 1, 'says to fork' );
51 { # and make sure we can run a test
52 my $capture = IO::c55Capture->new_handle;
54 my $harness = TAP::Harness->new(
56 switches => [ @libs, "-MNoFork" ],
61 ( $ENV{PERL_CORE} ? 'lib' : 't' ) . '/sample-tests/simple' );
62 my @output = tied($$capture)->dump;
63 is pop @output, "Result: PASS\n", 'status OK';
64 pop @output; # get rid of summary line
65 is( $output[-1], "All tests successful.\n", 'ran with no fork' );
68 # vim:ts=4:sw=4:et:sta