summaryrefslogtreecommitdiff
path: root/tests/tap/perl/Test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tap/perl/Test')
-rw-r--r--tests/tap/perl/Test/RRA.pm71
-rw-r--r--tests/tap/perl/Test/RRA/Automake.pm2
-rw-r--r--tests/tap/perl/Test/RRA/Config.pm13
3 files changed, 66 insertions, 20 deletions
diff --git a/tests/tap/perl/Test/RRA.pm b/tests/tap/perl/Test/RRA.pm
index 49c0d06..bb7de7d 100644
--- a/tests/tap/perl/Test/RRA.pm
+++ b/tests/tap/perl/Test/RRA.pm
@@ -10,7 +10,7 @@
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2013
+# Copyright 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
@@ -51,29 +51,47 @@ our (@EXPORT_OK, @ISA, $VERSION);
# consistency is good).
BEGIN {
@ISA = qw(Exporter);
- @EXPORT_OK = qw(skip_unless_maintainer use_prereq);
+ @EXPORT_OK = qw(skip_unless_author skip_unless_automated use_prereq);
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '5.00';
+ $VERSION = '5.05';
}
-# Skip this test unless maintainer tests are requested. Takes a short
-# description of what tests this script would perform, which is used in the
-# skip message. Calls plan skip_all, which will terminate the program.
+# Skip this test unless author tests are requested. Takes a short description
+# of what tests this script would perform, which is used in the skip message.
+# Calls plan skip_all, which will terminate the program.
#
# $description - Short description of the tests
#
# Returns: undef
-sub skip_unless_maintainer {
+sub skip_unless_author {
my ($description) = @_;
- if (!$ENV{RRA_MAINTAINER_TESTS}) {
- plan skip_all => "$description only run for maintainer";
+ if (!$ENV{AUTHOR_TESTING}) {
+ plan skip_all => "$description only run for author";
}
return;
}
+# Skip this test unless doing automated testing or release testing. This is
+# used for tests that should be run by CPAN smoke testing or during releases,
+# but not for manual installs by end users. Takes a short description of what
+# tests this script would perform, which is used in the skip message. Calls
+# plan skip_all, which will terminate the program.
+#
+# $description - Short description of the tests
+#
+# Returns: undef
+sub skip_unless_automated {
+ my ($description) = @_;
+ for my $env (qw(AUTOMATED_TESTING RELEASE_TESTING AUTHOR_TESTING)) {
+ return if $ENV{$env};
+ }
+ plan skip_all => "$description normally skipped";
+ return;
+}
+
# Attempt to load a module and skip the test if the module could not be
# loaded. If the module could be loaded, call its import function manually.
# If the module could not be loaded, calls plan skip_all, which will terminate
@@ -143,10 +161,14 @@ Test::RRA - Support functions for Perl tests
=head1 SYNOPSIS
- use Test::RRA qw(skip_unless_maintainer use_prereq);
+ use Test::RRA
+ qw(skip_unless_author skip_unless_automated use_prereq);
- # Skip this test unless maintainer tests are requested.
- skip_unless_maintainer('Coding style tests');
+ # Skip this test unless author tests are requested.
+ skip_unless_author('Coding style tests');
+
+ # Skip this test unless doing automated or release testing.
+ skip_unless_automated('POD syntax tests');
# Load modules, skipping the test if they're not available.
use_prereq('Perl6::Slurp', 'slurp');
@@ -166,12 +188,23 @@ script should be explicitly imported.
=over 4
-=item skip_unless_maintainer(DESC)
+=item skip_unless_author(DESC)
-Checks whether RRA_MAINTAINER_TESTS is set in the environment and skips
-the whole test (by calling C<plan skip_all> from Test::More) if it is not.
+Checks whether AUTHOR_TESTING is set in the environment and skips the
+whole test (by calling C<plan skip_all> from Test::More) if it is not.
DESC is a description of the tests being skipped. A space and C<only run
-for maintainer> will be appended to it and used as the skip reason.
+for author> will be appended to it and used as the skip reason.
+
+=item skip_unless_automated(DESC)
+
+Checks whether AUTHOR_TESTING, AUTOMATED_TESTING, or RELEASE_TESTING are
+set in the environment and skips the whole test (by calling C<plan
+skip_all> from Test::More) if they are not. This should be used by tests
+that should not run during end-user installs of the module, but which
+should run as part of CPAN smoke testing and release testing.
+
+DESC is a description of the tests being skipped. A space and C<normally
+skipped> will be appended to it and used as the skip reason.
=item use_prereq(MODULE[, VERSION][, IMPORT ...])
@@ -192,7 +225,7 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2013 The Board of Trustees of the Leland Stanford Junior
+Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
University
Permission is hereby granted, free of charge, to any person obtaining a
@@ -220,4 +253,8 @@ Test::More(3), Test::RRA::Automake(3), Test::RRA::Config(3)
This module is maintained in the rra-c-util package. The current version
is available from L<http://www.eyrie.org/~eagle/software/rra-c-util/>.
+The functions to control when tests are run use environment variables
+defined by the L<Lancaster
+Consensus|https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md>.
+
=cut
diff --git a/tests/tap/perl/Test/RRA/Automake.pm b/tests/tap/perl/Test/RRA/Automake.pm
index b80a8fe..a064ed9 100644
--- a/tests/tap/perl/Test/RRA/Automake.pm
+++ b/tests/tap/perl/Test/RRA/Automake.pm
@@ -87,7 +87,7 @@ BEGIN {
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '5.00';
+ $VERSION = '5.05';
}
# Perl directories to skip globally for perl_dirs. We ignore the perl
diff --git a/tests/tap/perl/Test/RRA/Config.pm b/tests/tap/perl/Test/RRA/Config.pm
index 5c3df7b..3e77650 100644
--- a/tests/tap/perl/Test/RRA/Config.pm
+++ b/tests/tap/perl/Test/RRA/Config.pm
@@ -31,12 +31,13 @@ BEGIN {
@EXPORT_OK = qw(
$COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
$MINIMUM_VERSION %MINIMUM_VERSION @POD_COVERAGE_EXCLUDE @STRICT_IGNORE
+ @STRICT_PREREQ
);
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '5.00';
+ $VERSION = '5.05';
}
# If BUILD or SOURCE are set in the environment, look for data/perl.conf under
@@ -65,6 +66,7 @@ our $MINIMUM_VERSION = '5.008';
our %MINIMUM_VERSION;
our @POD_COVERAGE_EXCLUDE;
our @STRICT_IGNORE;
+our @STRICT_PREREQ;
# Load the configuration.
if (!do($PATH)) {
@@ -163,6 +165,13 @@ for C<use strict> and C<use warnings>. The contents of this directory
must be either top-level directory names or directory names starting with
F<tests/>.
+=item @STRICT_PREREQ
+
+A list of Perl modules that have to be available in order to do meaningful
+Test::Strict testing. If any of the modules cannot be loaded via C<use>,
+Test::Strict checking will be skipped. There is currently no way to
+require specific versions of the modules.
+
=back
No variables are exported by default, but the variables can be imported
@@ -174,7 +183,7 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2013 The Board of Trustees of the Leland Stanford Junior
+Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
University
Permission is hereby granted, free of charge, to any person obtaining a