]> git.vpit.fr Git - perl/modules/re-engine-Hooks.git/blob - configure_test.pl
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/re-engine-Hooks.git] / configure_test.pl
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use POSIX qw/WIFEXITED WEXITSTATUS EXIT_FAILURE/;
7
8 BEGIN {
9  no warnings 'redefine';
10  local $@;
11  *WIFEXITED   = sub { 1 }             unless eval { WIFEXITED(0);   1 };
12  *WEXITSTATUS = sub { shift() >> 8 }  unless eval { WEXITSTATUS(0); 1 };
13 }
14
15 my @args;
16 {
17  my $args_dat = './args.dat';
18
19  open my $fh, '<', $args_dat or die "open(<$args_dat): $!";
20
21  {
22   local $/ = "\n";
23   @args = <$fh>;
24  }
25  for (@args) {
26   1 while chomp;
27   s{\[([0-9]+)\]}{chr $1}ge;
28  }
29 }
30
31 my $ret = EXIT_FAILURE;
32 {
33  sub CwdSaver::DESTROY {
34   my $cwd = $_[0]->{cwd};
35   chdir $cwd or die "chdir('$cwd'): $!";
36  }
37
38  my $guard = bless { cwd => do { require Cwd; Cwd::cwd() } }, 'CwdSaver';
39
40  chdir 't/re-engine-Hooks-TestDist'
41                                or die "chdir('t/re-engine-Hooks-TestDist'): $!";
42
43  system { $^X } $^X, 'Makefile.PL', @args;
44  if ($? == -1) {
45   die "$^X Makefile.PL @args: $!";
46  } elsif (WIFEXITED($?)) {
47   $ret = WEXITSTATUS($?);
48  }
49 }
50
51 exit $ret;