# In this file, we use the latter "Baby Perl" approach, and increment
# will be worked over by t/op/inc.t
+$| = 1;
$Level = 1;
my $test = 1;
my $planned;
$source_dir = '.'
}
}
- if ($source_dir) {
+ if ($ENV{'PERL_BUILD_PACKAGING'}) {
+ $reason = 'PERL_BUILD_PACKAGING is set';
+ } elsif ($source_dir) {
my $version_string = `git --version`;
if (defined $version_string
&& $version_string =~ /\Agit version (\d+\.\d+\.\d+)(.*)/) {
} else {
$reason = 'not being run from a git checkout';
}
- if ($ENV{'PERL_BUILD_PACKAGING'}) {
- $reason = 'PERL_BUILD_PACKAGING is set';
- }
skip_all($reason) if $_[0] && $_[0] eq 'all';
skip($reason, @_);
}
my $tempfile_count = 0;
sub tempfile {
while(1){
- my $try = "tmp$$";
+ my $try = (-d "t" ? "t/" : "")."tmp$$";
my $alpha = _num_to_alpha($tempfile_count,2);
last unless defined $alpha;
$try = $try . $alpha;
local @::__capture;
local $SIG {__WARN__} = \&__capture;
+ local $Level = 1;
&$code;
return @::__capture;
}
}
}
+# Orphaned Docker or Linux containers do not necessarily attach to PID 1. They might attach to 0 instead.
+sub is_linux_container {
+
+ if ($^O eq 'linux' && open my $fh, '<', '/proc/1/cgroup') {
+ while(<$fh>) {
+ if (m{^\d+:pids:(.*)} && $1 ne '/init.scope') {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
1;