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