| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# Check that too-new features of Perl are not being used. |
| 4 |
# |
| 5 |
# This version of the check script supports mapping various directories to |
| 6 |
# different version numbers. This allows a newer version of Perl to be |
| 7 |
# required for internal tools than for public code. |
| 8 |
# |
| 9 |
# The canonical version of this file is maintained in the rra-c-util package, |
| 10 |
# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. |
| 11 |
# |
| 12 |
# Written by Russ Allbery <[email protected]> |
| 13 |
# Copyright 2012, 2013, 2014 |
| 14 |
# The Board of Trustees of the Leland Stanford Junior University |
| 15 |
# |
| 16 |
# Permission is hereby granted, free of charge, to any person obtaining a |
| 17 |
# copy of this software and associated documentation files (the "Software"), |
| 18 |
# to deal in the Software without restriction, including without limitation |
| 19 |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 20 |
# and/or sell copies of the Software, and to permit persons to whom the |
| 21 |
# Software is furnished to do so, subject to the following conditions: |
| 22 |
# |
| 23 |
# The above copyright notice and this permission notice shall be included in |
| 24 |
# all copies or substantial portions of the Software. |
| 25 |
# |
| 26 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 27 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 28 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 29 |
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 30 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 31 |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 32 |
# DEALINGS IN THE SOFTWARE. |
| 33 |
|
| 34 |
use 5.006; |
| 35 |
use strict; |
| 36 |
use warnings; |
| 37 |
|
| 38 |
use lib "$ENV{SOURCE}/tap/perl"; |
| 39 |
|
| 40 |
use Test::More; |
| 41 |
use Test::RRA qw(skip_unless_automated use_prereq); |
| 42 |
use Test::RRA::Automake qw(automake_setup perl_dirs); |
| 43 |
use Test::RRA::Config qw($MINIMUM_VERSION %MINIMUM_VERSION); |
| 44 |
|
| 45 |
# Skip for normal user installs since this doesn't affect functionality. |
| 46 |
skip_unless_automated('Minimum version tests'); |
| 47 |
|
| 48 |
# Load prerequisite modules. |
| 49 |
use_prereq('Test::MinimumVersion'); |
| 50 |
|
| 51 |
# Set up Automake testing. |
| 52 |
automake_setup(); |
| 53 |
|
| 54 |
# For each exception case in %MINIMUM_VERSION, check the files that should |
| 55 |
# have that minium version. Sort for reproducible test order. Also |
| 56 |
# accumulate the list of directories we've already tested. |
| 57 |
my @tested; |
| 58 |
for my $version (sort keys %MINIMUM_VERSION) { |
| 59 |
my $paths_ref = $MINIMUM_VERSION{$version}; |
| 60 |
all_minimum_version_ok($version, { paths => $paths_ref, no_plan => 1 }); |
| 61 |
push(@tested, @{$paths_ref}); |
| 62 |
} |
| 63 |
|
| 64 |
# Now, check anything that's left against the default minimum version. |
| 65 |
my @paths = perl_dirs({ skip => [@tested] }); |
| 66 |
all_minimum_version_ok($MINIMUM_VERSION, { paths => \@paths, no_plan => 1 }); |
| 67 |
|
| 68 |
# Tell the TAP harness that we're done. |
| 69 |
done_testing(); |