CPAN
view release on metacpan or search on metacpan
t/31sessions.t view on Meta::CPAN
require CPAN::FirstTime;
my $pair;
for $pair (@pairs) {
my($prg,$module) = @$pair;
next if $CPAN::META->has_inst($module);
next if CPAN::FirstTime::find_exe($prg,\@path);
$exit_message = "Module '$module' not installed and fallback program '$prg' not found in path[@path].";
last;
}
}
if ($exit_message) {
$|=1;
print "1..0 # SKIP $exit_message\n";
eval "require POSIX; 1" and POSIX::_exit(0);
warn "Error while trying to load POSIX: $@";
exit(0);
}
}
use File::Copy qw(cp);
use File::Spec;
use Test::More;
=pod
It was our intent to shape the force pragma as follows:
Do we want to repeat testing?
command session restored_state
Distro
OK no no no
FAIL no yes yes
Module/Bundle
OK/FAIL pass everything through to underlying distros
=cut
BEGIN {
for my $x (
"_f",
"read_myconfig",
"mydiag",
"run_shell_cmd_lit",
) {
no strict "refs";
*$x = \&{"local_utils\::$x"};
}
}
END {
unlink "test-$$.out";
local_utils::cleanup_dot_cpan();
}
our(@SESSIONS, $default_system, $prompt_re);
BEGIN {
my $cwd = CPAN::anycwd();
# 2>&1 is no solution. I intertwingled them, I missed a few "ok"
$default_system = join(" ", map { "\"$_\"" } run_shell_cmd_lit($cwd,$$))." > test-$$.out";
open FH, (">" . _f"t/dot-cpan-$$/prefs/TestDistroPrefsFile.yml") or die "Could not open: $!";
print FH <<EOF;
---
match:
distribution: "ANDK/CPAN-Test-Dummy-Perl5-Make-Features-"
features:
- "rice"
EOF
close FH or die "Could not close 't/dot-cpan-$$/prefs/TestDistroPrefsFile.yml': $!";
@SESSIONS =
(
{
name => "illegal-regexp",
perl_mm_use_default => 0,
pairs =>
[
"o conf /*list/" => "Cannot parse",
]
},
{
name => "notest-test-dep",
perl_mm_use_default => 0,
pairs =>
[
"notest test CPAN::Test::Dummy::Perl5::Build::DepeFails" => join
("",
"Running\\sBuild\\sfor[\\s\\S]+",
"Skipping test because of notest pragma[\\s\\S]+",
"Skipping test because of notest pragma[\\s\\S]+",
),
]
},
{
name => "recommends",
tabu => ["CPAN::Test::Dummy::Perl5::Make::CircularPrereq"],
perl_mm_use_default => 0,
pairs =>
[
"o conf recommends_policy 1" => ".",
"test CPAN::Test::Dummy::Perl5::Make::OptionalPrereq" => join
("",
"Running\\smake\\sfor\\sA/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-OptionalPrereq[\\s\\S]+",
"Circular.+?requires,optional[\\s\\S]+",
"00_load.t.+?ok[\\s\\S]+",
"Running\\smake\\sfor\\sA/AN/ANDK/CPAN-Test-Dummy-Perl5-Make-CircularPrereq[\\s\\S]+",
"00_load.t.+?ok[\\s\\S]+",
),
]
},
{
name => "simple make call on a configure_requires",
perl_mm_use_default => 0,
pairs =>
[
"make CPAN::Test::Dummy::Perl5::Make::ConfReq" => "make(?:\\.exe)? -- OK",
]
},
{
name => "rm while degraded",
perl_mm_use_default => 0,
pairs =>
[
"test CPAN::Test::Dummy::Perl5::Make" => "00_load.t\\b.*\\bok",
"test CPAN::Test::Dummy::Perl5::Make" => "Has already been tested successfully",
"! print \$::tmp_build_dir=CPAN::Shell->expand('Module','CPAN::Test::Dummy::Perl5::Make')->distribution->{build_dir}, \$/" => ".",
"! use File::Path qw(rmtree); rmtree \$::tmp_build_dir, 0; print 'rmtreeed',\$/" => "rmtreeed",
"test CPAN::Test::Dummy::Perl5::Make" => "00_load.t\\b.*\\bok",
"force test CPAN::Test::Dummy::Perl5::Make" => "00_load.t\\b.*\\bok",
t/31sessions.t view on Meta::CPAN
"get CPAN::Test::Dummy::Perl5::Make" => "(?sx:
not.installed,.falling.back.*
will.not.store.persistent.state)",
"make CPAN::Test::Dummy::Perl5::Make" => "Falling back to other methods to determine prerequisites",
"test CPAN::Test::Dummy::Perl5::Make" => "All tests successful",
"clean CPAN::Test::Dummy::Perl5::Make" => "clean.*-- OK",
]
},
{
name => "focussing test circdepe",
perl_mm_use_default => 1,
pairs =>
[
"dump \$::x=4*6+1" => "= 25;",
"test CPAN::Test::Dummy::Perl5::Make::CircDepeOne" =>
"(?xs:
Running.test.for.module.+CPAN::Test::Dummy::Perl5::Make::CircDepeOne.+
CPAN::Test::Dummy::Perl5::Make::CircDepeThree.+\\[requires\\].+
CPAN::Test::Dummy::Perl5::Make::CircDepeTwo.+\\[requires\\].+
CPAN::Test::Dummy::Perl5::Make::CircDepeOne.+\\[requires\\].+
Recursive.dependency.detected
)",
],
},
{
name => "focussing test unsatprereq",
perl_mm_use_default => 1,
pairs =>
[
"dump \$::x=4*6+1" => "= 25;",
"test CPAN::Test::Dummy::Perl5::Make::UnsatPrereq" =>
"(?xs:
Warning:.+?
Prerequisite.+?
CPAN::Test::Dummy::Perl5::Make.+?
99999999.99.+?
not[ ]available[ ]according[ ]to[ ]the[ ]ind
)",
],
},
{
name => "halt_on_failure",
perl_mm_use_default => 1,
pairs =>
[
"dump \$::x=4*6+1" => "= 25;",
"o conf halt_on_failure 1" => "1",
"test CPAN::Test::Dummy::Perl5::Build::Fails CPAN::Test::Dummy::Perl5::Make::Failearly" =>
"FAIL",
# must not see Failearly in the failed summary
"failed" => q{(?x:Failed \s during \s this \s session: \s+
\S+ Build-Fails \S+: \s+ make_test \s+ NO \s*\z)},
"o conf dontload_list pop" => ".",
"o conf dontload_list pop" => ".",
"o conf dontload_list pop" => ".",
"o conf dontload_list pop" => ".",
"o conf commit" => "commit: wrote",
],
},
{
# loads distroprefs for the C:T:D:P:M:Features module where
# we demand the feature "rice". this feature then requires
# CPAN::Test::Dummy::Perl5::Build which we do not have so we
# build it first and then C:T:D:P:M:Features can also be
# built
name => "optional_features",
perl_mm_use_default => 1,
pairs =>
[
"dump \$::x=6*6+9" => "= 45;",
"o conf build_dir" => "build_dir",
"o conf prefs_dir '$cwd/t/dot-cpan-$$/prefs'" => "(?m:prefs_dir.+prefs)",
"test CPAN::Test::Dummy::Perl5::Make::Features" =>
"(?sx:Builds.rice.+
ANDK/CPAN-Test-Dummy-Perl5-Build-\\d.+
\\./Build[ ]test[ ]--[ ]OK.+
ANDK/CPAN-Test-Dummy-Perl5-Make-Features-\\d.+
make\\S*[ ]test[ ]--[ ]OK)",
]
},
{
name => "configure_requires",
perl_mm_use_default => 1,
pairs =>
[
"test CPAN::Test::Dummy::Perl5::Make::ConfReq" => "test.*-- OK",
"clean CPAN::Test::Dummy::Perl5::Make::ConfReq" => "clean.*-- OK",
"clean CPAN::Test::Dummy::Perl5::Make" => "clean.*-- OK",
]
},
{
name => "ls",
perl_mm_use_default => 1,
requires => [qw(Text::Glob)],
pairs =>
[
"ls ANDK/patches" => "-SADAHIRO-",
"ls ANDK/patches/" => "-SADAHIRO-",
"ls ANDK/pa*/*SADA*" => "-SADAHIRO-",
"ls ANDK/patches/*SADA*" => "-SADAHIRO-",
]
},
);
SESSION_CNT: for my $session (@SESSIONS) {
if (%limit_to_sessions) {
next SESSION_CNT unless $limit_to_sessions{$session->{name}};
}
$cnt++;
if (my $requires = $session->{requires}) {
for my $req (@$requires) {
unless ($CPAN::META->has_inst($req)) {
$session->{name} .= " [skipping because $req missing]";
$session->{pairs} = [];
}
}
}
for (my $i = 0; $i<$#{$session->{pairs}}; $i+=2) {
$cnt++;
}
}
plan tests => $cnt
+ 1 # the MyConfig verification
;
$prompt_re = "\\ncpan(?:[^>]*)> ";
print "# cnt[$cnt]prompt_re[$prompt_re]\n";
}
is($CPAN::Config->{'7yYQS7'} => 'vGcVJQ');
our $VERBOSE = $ENV{VERBOSE} || 0;
my $devnull = File::Spec->devnull;
SESSION_RUN: for my $si (0..$#SESSIONS) {
( run in 1.982 second using v1.01-cache-2.11-cpan-5b529ec07f3 )