Ready for 0.01
[p5sagit/B-Hooks-EndOfScope-WithFallback.git] / t / 11-test_without_vm_pure_pp.t
CommitLineData
4befcbc3 1use strict;
2use warnings;
3use Test::More;
4
5use B::Hooks::EndOfScope::WithFallback;
6
7plan skip_all => "Tests already executed in pure-perl mode"
8 unless B::Hooks::EndOfScope::WithFallback::__HAS_VM;
9
10eval { require Devel::Hide }
11 or plan skip_all => "Devel::Hide required for this test in presence of Variable::Magic";
12
13use Config;
14use FindBin qw($Bin);
15use IPC::Open2 qw(open2);
16
17# for the $^X-es
18$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
19
20# rerun the tests under the assumption of no vm at all
21
22for my $fn (glob("$Bin/*.t")) {
23 next if $fn =~ /test_without_/;
24
25 local $ENV{DEVEL_HIDE_VERBOSE} = 0;
26 note "retesting $fn";
27 my @cmd = ( $^X, '-MDevel::Hide=Variable::Magic', $fn );
28
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, @cmd);
34 while (my $ln = <$out>) {
35 print " $ln";
36 }
37
38 wait;
39 ok (! $?, "Exit $? from: @cmd");
40}
41
42done_testing;