Fix pure-perl implementation incorrectly reporting GD during END phase (liz++)
[p5sagit/Devel-GlobalDestruction.git] / t / 10_pure-perl.t
CommitLineData
9aaf3646 1use strict;
2use warnings;
3use FindBin qw($Bin);
4use Config;
5use IPC::Open2;
c65b758f 6use File::Glob 'bsd_glob'; # support spaces in names unlike glob()
9aaf3646 7
8# rerun the tests under the assumption of pure-perl
9
10# for the $^X-es
11$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
12$ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST} = 1;
13
14my $this_file = quotemeta(__FILE__);
15
c65b758f 16my @tests = grep { $_ !~ /${this_file}$/ } bsd_glob("$Bin/*.t");
9aaf3646 17print "1..@{[ scalar @tests ]}\n";
18
6d3e0a6f 19my $had_error = 0;
20END { $? = $had_error }
9aaf3646 21sub ok ($$) {
6d3e0a6f 22 $had_error++, print "not " if !$_[0];
9aaf3646 23 print "ok";
24 print " - $_[1]" if defined $_[1];
25 print "\n";
26}
27
28for my $fn (@tests) {
29 # this is cheating, and may even hang here and there (testing on windows passed fine)
30 # if it does - will have to fix it somehow (really *REALLY* don't want to pull
31 # in IPC::Cmd just for a fucking test)
32 # the alternative would be to have an ENV check in each test to force a subtest
33 open2(my $out, my $in, $^X, $fn );
34 while (my $ln = <$out>) {
35 print " $ln";
36 }
37
38 wait;
39 ok (! $?, "Exit $? from: $^X $fn");
40}