/
01build-perl.t
44 lines (36 loc) · 965 Bytes
/
01build-perl.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use strict;
use warnings;
use Cwd;
use File::Temp qw(tempdir);
use Test::More;
$| = 1;
use_ok('App::NoPAN');
my $tempdir = tempdir(CLEANUP => 1);
# test build
unless (my $pid = fork) {
die "fork failed:$!"
unless defined $pid;
# child process
open my $fh, '>', "$tempdir/build.log"
or die "failed to open temporary file:$tempdir/build.log:$!";
open STDOUT, '>&', $fh
or die "failed to redirect STDOUT:$!";
open STDERR, '>&', $fh,
or die "failed to redirect STDERR:$!";
close $fh;
exec(
$^X,
qw(blib/script/nopan --no-install),
"file://@{[getcwd]}/t.assets/perl/",
);
die "could not exec nopan:$!";
}
while (wait == -1) {}
my $exit_status = $?;
open my $fh, '<', "$tempdir/build.log"
or die "failed to open $tempdir/build.log:$!";
print STDERR "******** $_"
for ("log of test build:\n", <$fh>);
close $fh;
is $exit_status, 0, "build and test";
done_testing;