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');
17 if ($ENV{PERL_CORE}) {
19 print "1..0 # Skip pending resolution of how to set the library with -I\n";
30 : ( 'skip_all' => 'your system already has no fork' )
32 use IO::c55Capture; # for util
39 util::stdout_of( sub { system(@args) and die "error $?" } );
42 my @perl = ( $^X, '-Ilib', '-It/lib' );
43 my $mod = 'TAP::Parser::Iterator::Process';
45 { # just check the introspective method to start...
46 my $code = qq(print $mod->_use_open3 ? 1 : 2);
48 my $ans = backticks( @perl, '-MNoFork', "-M$mod", '-e', $code );
49 is( $ans, 2, 'says not to fork' );
52 local $ENV{PERL5OPT}; # punt: prevent propogating -MNoFork
53 my $ans = backticks( @perl, "-M$mod", '-e', $code );
54 is( $ans, 1, 'says to fork' );
58 { # and make sure we can run a test
59 my $capture = IO::c55Capture->new_handle;
61 my $harness = TAP::Harness->new(
63 switches => [ '-It/lib', "-MNoFork" ],
67 $harness->runtests(($ENV{PERL_CORE} ? 'lib' : 't') . '/sample-tests/simple');
68 my @output = tied($$capture)->dump;
69 is pop @output, "Result: PASS\n", 'status OK';
70 pop @output; # get rid of summary line
71 is( $output[-1], "All tests successful.\n", 'ran with no fork' );
74 # vim:ts=4:sw=4:et:sta