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