aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-11 22:36:11 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-11 22:39:23 -0700
commit1329e6db944a6fce5578b249de08a8250a920877 (patch)
tree2dd24e191af3767a93a21db9cd6b183164dbe491
parentbf513da9cc1bc6f125aded53685cf71083c5ae56 (diff)
Test for Perl strict and minimum version
Fix strictness issues across the whole code base, and ensure that all Perl scripts enable warnings. (Hopefully enabling warnings won't cause problems for the server.) Change-Id: I4dee49f7a6bcbeeee21d74bf61a1fd26514f832c Reviewed-on: https://gerrit.stanford.edu/1532 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
-rw-r--r--Makefile.am8
-rw-r--r--README34
-rwxr-xr-xcontrib/wallet-summary33
-rwxr-xr-xcontrib/wallet-unknown-hosts36
-rw-r--r--perl/lib/Wallet/ACL.pm3
-rw-r--r--perl/lib/Wallet/ACL/Base.pm3
-rw-r--r--perl/lib/Wallet/ACL/Krb5.pm3
-rw-r--r--perl/lib/Wallet/ACL/Krb5/Regex.pm3
-rw-r--r--perl/lib/Wallet/ACL/LDAP/Attribute.pm3
-rw-r--r--perl/lib/Wallet/ACL/NetDB.pm3
-rw-r--r--perl/lib/Wallet/ACL/NetDB/Root.pm3
-rw-r--r--perl/lib/Wallet/Admin.pm3
-rw-r--r--perl/lib/Wallet/Config.pm1
-rw-r--r--perl/lib/Wallet/Database.pm3
-rw-r--r--perl/lib/Wallet/Kadmin.pm3
-rw-r--r--perl/lib/Wallet/Kadmin/Heimdal.pm1
-rw-r--r--perl/lib/Wallet/Kadmin/MIT.pm3
-rw-r--r--perl/lib/Wallet/Object/Base.pm3
-rw-r--r--perl/lib/Wallet/Object/Duo.pm1
-rw-r--r--perl/lib/Wallet/Object/File.pm3
-rw-r--r--perl/lib/Wallet/Object/Keytab.pm3
-rw-r--r--perl/lib/Wallet/Object/WAKeyring.pm3
-rw-r--r--perl/lib/Wallet/Report.pm3
-rw-r--r--perl/lib/Wallet/Server.pm3
-rw-r--r--perl/t/data/perl.conf7
-rwxr-xr-xperl/t/general/acl.t5
-rwxr-xr-xperl/t/general/admin.t7
-rwxr-xr-xperl/t/general/config.t7
-rwxr-xr-xperl/t/general/init.t5
-rwxr-xr-xperl/t/general/report.t7
-rwxr-xr-xperl/t/general/server.t7
-rw-r--r--perl/t/lib/Util.pm3
-rwxr-xr-xperl/t/object/base.t5
-rwxr-xr-xperl/t/object/file.t7
-rwxr-xr-xperl/t/object/keytab.t11
-rwxr-xr-xperl/t/style/minimum-version.t47
-rwxr-xr-xperl/t/style/strict.t56
-rwxr-xr-xperl/t/util/kadmin.t7
-rwxr-xr-xperl/t/verifier/basic.t5
-rwxr-xr-xperl/t/verifier/ldap-attr.t5
-rwxr-xr-xperl/t/verifier/netdb.t7
-rwxr-xr-xserver/keytab-backend1
-rwxr-xr-xserver/wallet-backend1
-rw-r--r--tests/TESTS2
-rw-r--r--tests/client/full-t.in12
-rw-r--r--tests/client/prompt-t.in14
-rwxr-xr-xtests/data/fake-kadmin7
-rwxr-xr-xtests/perl/minimum-version-t69
-rwxr-xr-xtests/perl/strict-t66
49 files changed, 437 insertions, 98 deletions
diff --git a/Makefile.am b/Makefile.am
index 19dbe11..8e65151 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,7 @@ PERL_FILES = perl/Build.PL perl/MANIFEST perl/MANIFEST.SKIP \
perl/t/general/server.t perl/t/lib/Util.pm perl/t/object/base.t \
perl/t/object/duo.t perl/t/object/file.t perl/t/object/keytab.t \
perl/t/object/wa-keyring.t perl/t/policy/stanford.t \
+ perl/t/style/minimum-version.t perl/t/style/strict.t \
perl/t/util/kadmin.t perl/t/verifier/basic.t \
perl/t/verifier/ldap-attr.t perl/t/verifier/netdb.t
@@ -99,9 +100,10 @@ EXTRA_DIST = .gitignore LICENSE autogen client/wallet.pod \
tests/data/fake-keytab-partial-result tests/data/fake-keytab-rekey \
tests/data/fake-keytab-unknown tests/data/fake-srvtab \
tests/data/full.conf tests/data/perl.conf tests/data/wallet.conf \
- tests/docs/pod-spelling-t tests/docs/pod-t tests/server/admin-t \
- tests/server/backend-t tests/server/keytab-t tests/server/report-t \
- tests/tap/kerberos.sh tests/tap/libtap.sh \
+ tests/docs/pod-spelling-t tests/docs/pod-t \
+ tests/perl/minimum-version-t tests/perl/strict-t \
+ tests/server/admin-t tests/server/backend-t tests/server/keytab-t \
+ tests/server/report-t tests/tap/kerberos.sh tests/tap/libtap.sh \
tests/tap/perl/Test/RRA.pm tests/tap/perl/Test/RRA/Automake.pm \
tests/tap/perl/Test/RRA/Config.pm tests/tap/remctl.sh \
tests/util/xmalloc-t $(PERL_FILES)
diff --git a/README b/README
index e72bc80..ef910bd 100644
--- a/README
+++ b/README
@@ -118,16 +118,30 @@ REQUIREMENTS
server.
To run the full test suite, all of the above software requirements must
- be met. Tests requiring some bit of software that's not installed
- should be skipped, but not all the permutations have been checked. The
- full test suite also requires the Test::Pod Perl module (available from
- CPAN), that remctld be installed and available on the user's path or in
- /usr/local/sbin or /usr/sbin, that sqlite3 be installed and available on
- the user's path, that test cases can run services on and connect to port
- 14373 on 127.0.0.1, and that kinit and either kvno or kgetcred (which
- come with Kerberos) be installed and available on the user's path. The
- full test suite also requires a local keytab and some additional
- configuration.
+ be met. The full test suite also requires that remctld be installed and
+ available on the user's path or in /usr/local/sbin or /usr/sbin, that
+ sqlite3 be installed and available on the user's path, that test cases
+ can run services on and connect to port 14373 on 127.0.0.1, and that
+ kinit and either kvno or kgetcred (which come with Kerberos) be
+ installed and available on the user's path. The full test suite also
+ requires a local keytab and some additional configuration.
+
+ The following additional Perl modules will be used if present:
+
+ Test::MinimumVersion
+ Test::Pod
+ Test::Spelling
+ Test::Strict
+
+ All are available on CPAN. Those tests will be skipped if the modules
+ are not available.
+
+ To enable tests that don't detect functionality problems but are used to
+ sanity-check the release, set the environment variable RELEASE_TESTING
+ to a true value. To enable tests that may be sensitive to the local
+ environment or that produce a lot of false positives without uncovering
+ many problems, set the environment variable AUTHOR_TESTING to a true
+ value.
To bootstrap from a Git checkout, or if you change the Automake files
and need to regenerate Makefile.in, you will need Automake 1.11 or
diff --git a/contrib/wallet-summary b/contrib/wallet-summary
index 55501ad..5cbf6e0 100755
--- a/contrib/wallet-summary
+++ b/contrib/wallet-summary
@@ -1,8 +1,23 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Summarize keytabs in the wallet database.
##############################################################################
+# Modules and declarations
+##############################################################################
+
+require 5.005;
+
+use strict;
+use vars qw($ADDRESS $DUMPFILE @PATTERNS $REPORTS);
+use warnings;
+
+use Getopt::Long qw(GetOptions);
+use File::Path qw(mkpath);
+use POSIX qw(strftime);
+use Wallet::Report ();
+
+##############################################################################
# Site configuration
##############################################################################
@@ -30,20 +45,6 @@ $ADDRESS = 'nobody@example.com';
[qr(^service/), 'service/*', 'Service principals']);
##############################################################################
-# Modules and declarations
-##############################################################################
-
-require 5.005;
-
-use strict;
-use vars qw($ADDRESS $DUMPFILE @PATTERNS $REPORTS);
-
-use Getopt::Long qw(GetOptions);
-use File::Path qw(mkpath);
-use POSIX qw(strftime);
-use Wallet::Report ();
-
-##############################################################################
# Database queries
##############################################################################
@@ -145,7 +146,7 @@ if ($mail) {
}
# Run the report.
-my @principals = read_dump;
+my @principals = read_dump ();
report_principals (@principals);
# If -m was given, take the saved report and mail it as well.
diff --git a/contrib/wallet-unknown-hosts b/contrib/wallet-unknown-hosts
index 339983d..50b5a04 100755
--- a/contrib/wallet-unknown-hosts
+++ b/contrib/wallet-unknown-hosts
@@ -1,8 +1,21 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Report host keytabs in wallet for unknown hosts.
##############################################################################
+# Modules and declarations
+##############################################################################
+
+require 5.006;
+
+use strict;
+use warnings;
+
+use DB_File ();
+use Wallet::Report ();
+use Wallet::Server ();
+
+##############################################################################
# Site configuration
##############################################################################
@@ -22,9 +35,10 @@ our $MIN = 3;
our $THRESHOLD = time - 30 * 24 * 60 * 60;
# Set up a Net::DNS resolver that will be used by local_check_keytab.
+my $DNS;
BEGIN {
use Net::DNS;
- our $DNS = Net::DNS::Resolver->new;
+ $DNS = Net::DNS::Resolver->new;
}
# Pre-filter. This is called for all host-based keytabs and is the place to
@@ -55,18 +69,6 @@ sub local_check_keytab {
}
##############################################################################
-# Modules and declarations
-##############################################################################
-
-require 5.006;
-
-use strict;
-
-use DB_File ();
-use Wallet::Report ();
-use Wallet::Server ();
-
-##############################################################################
# Utility functions
##############################################################################
@@ -97,6 +99,7 @@ sub check_host {
# Do a scan of all host-based keytabs in wallet and record those that are not
# found in DNS or which should not be used according to site configuration.
sub check {
+ my %history;
tie %history, 'DB_File', $HISTORY;
my @keytabs = list_keytabs;
for my $keytab (@keytabs) {
@@ -124,6 +127,7 @@ sub check {
# list (given as a threshold time in seconds since epoch).
sub report {
my ($min, $threshold) = @_;
+ my %history;
tie %history, 'DB_File', $HISTORY;
for my $keytab (sort keys %history) {
my ($count, $time) = split (',', $history{$keytab});
@@ -142,6 +146,7 @@ sub report {
sub purge {
my ($user, $min, $threshold) = @_;
my $wallet = Wallet::Server->new ($user, 'localhost');
+ my %history;
tie %history, 'DB_File', $HISTORY;
for my $keytab (sort keys %history) {
my ($count, $time) = split (',', $history{$keytab});
@@ -161,7 +166,7 @@ sub purge {
my $command = shift or die "Usage: $0 (check | report | purge)\n";
if ($command eq 'check') {
- check;
+ check ();
} elsif ($command eq 'report') {
my ($min, $threshold) = @_;
$min = $MIN unless defined ($min);
@@ -170,6 +175,7 @@ if ($command eq 'check') {
report ($min, $threshold);
} elsif ($command eq 'purge') {
my $user = $ENV{REMOTE_USER} or die "$0: REMOTE_USER must be set\n";
+ my ($min, $threshold) = @_;
$min = $MIN unless defined ($min);
die "$0: minimum count must be at least 1\n" if $min < 1;
$threshold = $THRESHOLD unless defined ($threshold);
diff --git a/perl/lib/Wallet/ACL.pm b/perl/lib/Wallet/ACL.pm
index 808be3c..9507c64 100644
--- a/perl/lib/Wallet/ACL.pm
+++ b/perl/lib/Wallet/ACL.pm
@@ -1,7 +1,7 @@
# Wallet::ACL -- Implementation of ACLs in the wallet system.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2013
+# Copyright 2007, 2008, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use DBI;
diff --git a/perl/lib/Wallet/ACL/Base.pm b/perl/lib/Wallet/ACL/Base.pm
index b6e4ce3..a2b07cc 100644
--- a/perl/lib/Wallet/ACL/Base.pm
+++ b/perl/lib/Wallet/ACL/Base.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Base -- Parent class for wallet ACL verifiers.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Base;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
# This version should be increased on any code change to this module. Always
diff --git a/perl/lib/Wallet/ACL/Krb5.pm b/perl/lib/Wallet/ACL/Krb5.pm
index ed0b7df..80d32bd 100644
--- a/perl/lib/Wallet/ACL/Krb5.pm
+++ b/perl/lib/Wallet/ACL/Krb5.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Krb5 -- Wallet Kerberos v5 principal ACL verifier.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Krb5;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Base;
diff --git a/perl/lib/Wallet/ACL/Krb5/Regex.pm b/perl/lib/Wallet/ACL/Krb5/Regex.pm
index 30f5527..4934cfc 100644
--- a/perl/lib/Wallet/ACL/Krb5/Regex.pm
+++ b/perl/lib/Wallet/ACL/Krb5/Regex.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Krb5::Regex -- Wallet Kerberos v5 principal regex ACL verifier
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Krb5::Regex;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Krb5;
diff --git a/perl/lib/Wallet/ACL/LDAP/Attribute.pm b/perl/lib/Wallet/ACL/LDAP/Attribute.pm
index aea8a72..c27729e 100644
--- a/perl/lib/Wallet/ACL/LDAP/Attribute.pm
+++ b/perl/lib/Wallet/ACL/LDAP/Attribute.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::LDAP::Attribute -- Wallet LDAP attribute ACL verifier.
#
# Written by Russ Allbery
-# Copyright 2012, 2013
+# Copyright 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::LDAP::Attribute;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Authen::SASL ();
diff --git a/perl/lib/Wallet/ACL/NetDB.pm b/perl/lib/Wallet/ACL/NetDB.pm
index b76d4ed..ad2164b 100644
--- a/perl/lib/Wallet/ACL/NetDB.pm
+++ b/perl/lib/Wallet/ACL/NetDB.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::NetDB -- Wallet NetDB role ACL verifier.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::NetDB;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Base;
diff --git a/perl/lib/Wallet/ACL/NetDB/Root.pm b/perl/lib/Wallet/ACL/NetDB/Root.pm
index 6c95c6e..34163e7 100644
--- a/perl/lib/Wallet/ACL/NetDB/Root.pm
+++ b/perl/lib/Wallet/ACL/NetDB/Root.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::NetDB::Root -- Wallet NetDB role ACL verifier (root instances).
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::NetDB::Root;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::NetDB;
diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm
index 3a05284..d39c272 100644
--- a/perl/lib/Wallet/Admin.pm
+++ b/perl/lib/Wallet/Admin.pm
@@ -1,7 +1,7 @@
# Wallet::Admin -- Wallet system administrative interface.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2011, 2012, 2013
+# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Admin;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::ACL;
diff --git a/perl/lib/Wallet/Config.pm b/perl/lib/Wallet/Config.pm
index 5b0ab1c..527658c 100644
--- a/perl/lib/Wallet/Config.pm
+++ b/perl/lib/Wallet/Config.pm
@@ -10,6 +10,7 @@ package Wallet::Config;
require 5.006;
use strict;
+use warnings;
use vars qw($PATH $VERSION);
# This version should be increased on any code change to this module. Always
diff --git a/perl/lib/Wallet/Database.pm b/perl/lib/Wallet/Database.pm
index 031be9e..3a4e130 100644
--- a/perl/lib/Wallet/Database.pm
+++ b/perl/lib/Wallet/Database.pm
@@ -6,7 +6,7 @@
# like DBIx::Class objects in the rest of the code.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2012, 2013
+# Copyright 2008, 2009, 2010, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -19,6 +19,7 @@ package Wallet::Database;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Schema;
diff --git a/perl/lib/Wallet/Kadmin.pm b/perl/lib/Wallet/Kadmin.pm
index 4ea7920..65a5700 100644
--- a/perl/lib/Wallet/Kadmin.pm
+++ b/perl/lib/Wallet/Kadmin.pm
@@ -1,7 +1,7 @@
# Wallet::Kadmin -- Kerberos administration API for wallet keytab backend.
#
# Written by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2009, 2010
+# Copyright 2009, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Kadmin;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Kadmin/Heimdal.pm b/perl/lib/Wallet/Kadmin/Heimdal.pm
index 42de8e0..1208801 100644
--- a/perl/lib/Wallet/Kadmin/Heimdal.pm
+++ b/perl/lib/Wallet/Kadmin/Heimdal.pm
@@ -14,6 +14,7 @@ package Wallet::Kadmin::Heimdal;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Heimdal::Kadm5 qw(KRB5_KDB_DISALLOW_ALL_TIX);
diff --git a/perl/lib/Wallet/Kadmin/MIT.pm b/perl/lib/Wallet/Kadmin/MIT.pm
index 1ae01bf..ac45265 100644
--- a/perl/lib/Wallet/Kadmin/MIT.pm
+++ b/perl/lib/Wallet/Kadmin/MIT.pm
@@ -2,7 +2,7 @@
#
# Written by Russ Allbery <eagle@eyrie.org>
# Pulled into a module by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2007, 2008, 2009, 2010
+# Copyright 2007, 2008, 2009, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -15,6 +15,7 @@ package Wallet::Kadmin::MIT;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Object/Base.pm b/perl/lib/Wallet/Object/Base.pm
index 8debac9..a009d76 100644
--- a/perl/lib/Wallet/Object/Base.pm
+++ b/perl/lib/Wallet/Object/Base.pm
@@ -1,7 +1,7 @@
# Wallet::Object::Base -- Parent class for any object stored in the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2011
+# Copyright 2007, 2008, 2010, 2011, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::Base;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use DBI;
diff --git a/perl/lib/Wallet/Object/Duo.pm b/perl/lib/Wallet/Object/Duo.pm
index e5773c8..e3fe2da 100644
--- a/perl/lib/Wallet/Object/Duo.pm
+++ b/perl/lib/Wallet/Object/Duo.pm
@@ -14,6 +14,7 @@ package Wallet::Object::Duo;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use JSON;
diff --git a/perl/lib/Wallet/Object/File.pm b/perl/lib/Wallet/Object/File.pm
index 4afef04..1ff1288 100644
--- a/perl/lib/Wallet/Object/File.pm
+++ b/perl/lib/Wallet/Object/File.pm
@@ -1,7 +1,7 @@
# Wallet::Object::File -- File object implementation for the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2010
+# Copyright 2008, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::File;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Digest::MD5 qw(md5_hex);
diff --git a/perl/lib/Wallet/Object/Keytab.pm b/perl/lib/Wallet/Object/Keytab.pm
index 24c3302..975179b 100644
--- a/perl/lib/Wallet/Object/Keytab.pm
+++ b/perl/lib/Wallet/Object/Keytab.pm
@@ -1,7 +1,7 @@
# Wallet::Object::Keytab -- Keytab object implementation for the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2009, 2010, 2013
+# Copyright 2007, 2008, 2009, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::Keytab;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Object/WAKeyring.pm b/perl/lib/Wallet/Object/WAKeyring.pm
index f8bd0f7..3e80300 100644
--- a/perl/lib/Wallet/Object/WAKeyring.pm
+++ b/perl/lib/Wallet/Object/WAKeyring.pm
@@ -1,7 +1,7 @@
# Wallet::Object::WAKeyring -- WebAuth keyring object implementation.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2012, 2013
+# Copyright 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::WAKeyring;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Digest::MD5 qw(md5_hex);
diff --git a/perl/lib/Wallet/Report.pm b/perl/lib/Wallet/Report.pm
index 1085546..bf48308 100644
--- a/perl/lib/Wallet/Report.pm
+++ b/perl/lib/Wallet/Report.pm
@@ -1,7 +1,7 @@
# Wallet::Report -- Wallet system reporting interface.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2013
+# Copyright 2008, 2009, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Report;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::ACL;
diff --git a/perl/lib/Wallet/Server.pm b/perl/lib/Wallet/Server.pm
index 3266928..2765d34 100644
--- a/perl/lib/Wallet/Server.pm
+++ b/perl/lib/Wallet/Server.pm
@@ -1,7 +1,7 @@
# Wallet::Server -- Wallet system server implementation.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2011, 2013
+# Copyright 2007, 2008, 2010, 2011, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Server;
require 5.006;
use strict;
+use warnings;
use vars qw(%MAPPING $VERSION);
use Wallet::ACL;
diff --git a/perl/t/data/perl.conf b/perl/t/data/perl.conf
new file mode 100644
index 0000000..ca05568
--- /dev/null
+++ b/perl/t/data/perl.conf
@@ -0,0 +1,7 @@
+# Configuration for Perl tests. -*- perl -*-
+
+# Default minimum version requirement.
+$MINIMUM_VERSION = '5.008';
+
+# File must end with this line.
+1;
diff --git a/perl/t/general/acl.t b/perl/t/general/acl.t
index e633f46..01b4801 100755
--- a/perl/t/general/acl.t
+++ b/perl/t/general/acl.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet ACL API.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 101;
diff --git a/perl/t/general/admin.t b/perl/t/general/admin.t
index 41bc33a..7c62932 100755
--- a/perl/t/general/admin.t
+++ b/perl/t/general/admin.t
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 26;
use Wallet::Admin;
@@ -44,7 +47,7 @@ is ($admin->register_object ('base', 'Wallet::Object::Base'), 1,
'Registering Wallet::Object::Base works');
is ($admin->register_object ('base', 'Wallet::Object::Base'), undef,
' and cannot be registered twice');
-$server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
+my $server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
is ($@, '', 'Creating a server instance did not die');
is ($server->create ('base', 'service/admin'), 1,
' and creating base:service/admin succeeds');
@@ -83,7 +86,7 @@ SKIP: {
is ($retval, 1, ' and performing an upgrade to 0.08 succeeds');
my $sql = "select version from dbix_class_schema_versions order by"
. " version DESC";
- $version = $admin->dbh->selectall_arrayref ($sql);
+ my $version = $admin->dbh->selectall_arrayref ($sql);
is (@$version, 2, ' and versions table has correct number of rows');
is (@{ $version->[0] }, 1, ' and correct number of columns');
is ($version->[0][0], '0.08', ' and the schema version is correct');
diff --git a/perl/t/general/config.t b/perl/t/general/config.t
index 881f2bd..bc200de 100755
--- a/perl/t/general/config.t
+++ b/perl/t/general/config.t
@@ -1,13 +1,16 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet server configuration.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2010
+# Copyright 2008, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 6;
# Silence warnings since we're not using use.
diff --git a/perl/t/general/init.t b/perl/t/general/init.t
index b8ec3c9..58b9a4c 100755
--- a/perl/t/general/init.t
+++ b/perl/t/general/init.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for database initialization.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 18;
use Wallet::ACL;
diff --git a/perl/t/general/report.t b/perl/t/general/report.t
index 9563362..8d348ed 100755
--- a/perl/t/general/report.t
+++ b/perl/t/general/report.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet reporting interface.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 197;
use Wallet::Admin;
@@ -39,7 +42,7 @@ is ($acls[0][0], 1, ' and that is ACL ID 1');
is ($acls[0][1], 'ADMIN', ' with the right name');
# Create an object.
-$server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
+my $server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
is ($@, '', 'Creating a server instance did not die');
is ($server->create ('base', 'service/admin'), 1,
' and creating base:service/admin succeeds');
diff --git a/perl/t/general/server.t b/perl/t/general/server.t
index 9026439..0a527a5 100755
--- a/perl/t/general/server.t
+++ b/perl/t/general/server.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet server API.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 382;
use POSIX qw(strftime);
@@ -33,7 +36,7 @@ is ($@, '', 'Database initialization did not die');
is ($setup->reinitialize ($admin), 1, 'Database initialization succeeded');
# Now test the new method.
-$server = eval { Wallet::Server->new (@trace) };
+my $server = eval { Wallet::Server->new (@trace) };
is ($@, '', 'Reopening with new did not die');
ok ($server->isa ('Wallet::Server'), ' and returned the right class');
my $schema = $server->schema;
diff --git a/perl/t/lib/Util.pm b/perl/t/lib/Util.pm
index 9e5b95e..187e483 100644
--- a/perl/t/lib/Util.pm
+++ b/perl/t/lib/Util.pm
@@ -1,7 +1,7 @@
# Utility class for wallet tests.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008
+# Copyright 2007, 2008, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -10,6 +10,7 @@ package Util;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA @EXPORT $VERSION);
use Wallet::Config;
diff --git a/perl/t/object/base.t b/perl/t/object/base.t
index 0432a23..11f18b7 100755
--- a/perl/t/object/base.t
+++ b/perl/t/object/base.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the basic object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 137;
diff --git a/perl/t/object/file.t b/perl/t/object/file.t
index 0aecd9d..201f46d 100755
--- a/perl/t/object/file.t
+++ b/perl/t/object/file.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the file object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 56;
@@ -39,7 +42,7 @@ my $history = '';
my $date = strftime ('%Y-%m-%d %H:%M:%S', localtime $trace[2]);
# Test error handling in the absence of configuration.
-$object = eval {
+my $object = eval {
Wallet::Object::File->create ('file', 'test', $schema, @trace)
};
ok (defined ($object), 'Creating a basic file object succeeds');
diff --git a/perl/t/object/keytab.t b/perl/t/object/keytab.t
index 127762a..0f4a8b8 100755
--- a/perl/t/object/keytab.t
+++ b/perl/t/object/keytab.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the keytab object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 141;
@@ -117,7 +120,7 @@ sub enctypes {
next unless /^ *\d+ /;
my ($string) = /\((.*)\)\s*$/;
next unless $string;
- $enctype = $enctype{lc $string} || 'UNKNOWN';
+ my $enctype = $enctype{lc $string} || 'UNKNOWN';
push (@enctypes, $enctype);
}
close KLIST;
@@ -174,7 +177,7 @@ SKIP: {
# Test that object creation without KEYTAB_TMP fails.
undef $Wallet::Config::KEYTAB_TMP;
- $object = eval {
+ my $object = eval {
Wallet::Object::Keytab->create ('keytab', 'wallet/one', $schema,
@trace)
};
@@ -634,7 +637,7 @@ EOO
is ("@values", "@enctypes", ' and we get back the right enctype list');
my $eshow = join ("\n" . (' ' x 17), @enctypes);
$eshow =~ s/\s+\z/\n/;
- $expected = <<"EOO";
+ my $expected = <<"EOO";
Type: keytab
Name: wallet/one
Enctypes: $eshow
diff --git a/perl/t/style/minimum-version.t b/perl/t/style/minimum-version.t
new file mode 100755
index 0000000..e4eeafd
--- /dev/null
+++ b/perl/t/style/minimum-version.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+#
+# Check that too-new features of Perl are not being used.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# 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
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Config qw($MINIMUM_VERSION);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Minimum version tests');
+
+# Load prerequisite modules.
+use_prereq('Test::MinimumVersion');
+
+# Check all files in the Perl distribution.
+all_minimum_version_ok($MINIMUM_VERSION);
diff --git a/perl/t/style/strict.t b/perl/t/style/strict.t
new file mode 100755
index 0000000..7137b15
--- /dev/null
+++ b/perl/t/style/strict.t
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Test Perl code for strict, warnings, and syntax.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# 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
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use File::Spec;
+use Test::RRA qw(skip_unless_automated use_prereq);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Strictness tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Strict');
+
+# Test everything in the distribution directory except the Build and
+# Makefile.PL scripts generated by Module::Build. We also want to check use
+# warnings.
+$Test::Strict::TEST_SKIP = ['Build', 'Makefile.PL'];
+$Test::Strict::TEST_WARNINGS = 1;
+all_perl_files_ok(File::Spec->curdir);
+
+# Hack to suppress "used only once" warnings.
+END {
+ $Test::Strict::TEST_SKIP = [];
+ $Test::Strict::TEST_WARNINGS = 0;
+}
diff --git a/perl/t/util/kadmin.t b/perl/t/util/kadmin.t
index 8eabc6b..2a3d984 100755
--- a/perl/t/util/kadmin.t
+++ b/perl/t/util/kadmin.t
@@ -1,13 +1,16 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the kadmin object implementation.
#
# Written by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2009, 2010, 2012, 2013
+# Copyright 2009, 2010, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 34;
diff --git a/perl/t/verifier/basic.t b/perl/t/verifier/basic.t
index 5697ae6..ce44d44 100755
--- a/perl/t/verifier/basic.t
+++ b/perl/t/verifier/basic.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the basic wallet ACL verifiers.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 57;
use Wallet::ACL::Base;
diff --git a/perl/t/verifier/ldap-attr.t b/perl/t/verifier/ldap-attr.t
index d8e416b..3c132e2 100755
--- a/perl/t/verifier/ldap-attr.t
+++ b/perl/t/verifier/ldap-attr.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the LDAP attribute ACL verifier.
#
@@ -11,6 +11,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More;
use lib 't/lib';
diff --git a/perl/t/verifier/netdb.t b/perl/t/verifier/netdb.t
index d8fe561..7048ef9 100755
--- a/perl/t/verifier/netdb.t
+++ b/perl/t/verifier/netdb.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the NetDB wallet ACL verifiers.
#
@@ -12,6 +12,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 5;
use Wallet::ACL::NetDB;
@@ -35,7 +38,7 @@ SKIP: {
$Wallet::Config::NETDB_REMCTL_HOST = $netdb;
# Finally, we can test.
- $verifier = eval { Wallet::ACL::NetDB->new };
+ my $verifier = eval { Wallet::ACL::NetDB->new };
ok (defined $verifier, ' and now creation succeeds');
is ($@, q{}, ' with no errors');
ok ($verifier->isa ('Wallet::ACL::NetDB'), ' and returns the right class');
diff --git a/server/keytab-backend b/server/keytab-backend
index cf283bb..bd5a3f9 100755
--- a/server/keytab-backend
+++ b/server/keytab-backend
@@ -21,6 +21,7 @@
##############################################################################
use strict;
+use warnings;
use Sys::Syslog qw(openlog syslog);
diff --git a/server/wallet-backend b/server/wallet-backend
index 0b6a3fa..a97c8ce 100755
--- a/server/wallet-backend
+++ b/server/wallet-backend
@@ -7,6 +7,7 @@
##############################################################################
use strict;
+use warnings;
use Getopt::Long qw(GetOptions);
use Sys::Syslog qw(openlog syslog);
diff --git a/tests/TESTS b/tests/TESTS
index 807d944..d947e97 100644
--- a/tests/TESTS
+++ b/tests/TESTS
@@ -4,6 +4,8 @@ client/prompt
client/rekey
docs/pod
docs/pod-spelling
+perl/minimum-version
+perl/strict
portable/asprintf
portable/mkstemp
portable/setenv
diff --git a/tests/client/full-t.in b/tests/client/full-t.in
index 9822b37..4861723 100644
--- a/tests/client/full-t.in
+++ b/tests/client/full-t.in
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# End-to-end tests for the wallet client.
#
@@ -8,12 +8,14 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
# Point to our server configuration. This must be done before Wallet::Config
# is loaded, and it's pulled in as a prerequisite for Wallet::Admin.
BEGIN { $ENV{WALLET_CONFIG} = "$ENV{SOURCE}/data/wallet.conf" }
-BEGIN { our $total = 59 }
-use Test::More tests => $total;
+use Test::More tests => 59;
use lib "$ENV{SOURCE}/../perl/lib";
use Wallet::Admin;
@@ -56,10 +58,10 @@ sub wallet {
chdir "$ENV{SOURCE}" or die "Cannot chdir to $ENV{SOURCE}: $!\n";
SKIP: {
- skip 'no keytab configuration', $total
+ skip 'no keytab configuration', 59
unless -f "$ENV{BUILD}/config/keytab";
my $remctld = '@REMCTLD@';
- skip 'remctld not found', $total unless $remctld;
+ skip 'remctld not found', 59 unless $remctld;
# Spawn remctld and get local tickets. Don't destroy the user's Kerberos
# ticket cache.
diff --git a/tests/client/prompt-t.in b/tests/client/prompt-t.in
index 8467411..686cc88 100644
--- a/tests/client/prompt-t.in
+++ b/tests/client/prompt-t.in
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Password prompting tests for the wallet client.
#
@@ -8,8 +8,10 @@
#
# See LICENSE for licensing terms.
-BEGIN { our $total = 5 }
-use Test::More tests => $total;
+use strict;
+use warnings;
+
+use Test::More tests => 5;
use lib "$ENV{SOURCE}/../perl/lib";
use Wallet::Admin;
@@ -21,12 +23,12 @@ use Util;
chdir "$ENV{SOURCE}" or die "Cannot chdir to $ENV{SOURCE}: $!\n";
SKIP: {
- skip 'no password configuration', $total
+ skip 'no password configuration', 5
unless -f "$ENV{BUILD}/config/password";
my $remctld = '@REMCTLD@';
- skip 'remctld not found', $total unless $remctld;
+ skip 'remctld not found', 5 unless $remctld;
eval { require Expect };
- skip 'Expect module not found', $total if $@;
+ skip 'Expect module not found', 5 if $@;
# Disable sending of wallet's output to our standard output. Do this
# twice to avoid Perl warnings.
diff --git a/tests/data/fake-kadmin b/tests/data/fake-kadmin
index 57f9c97..ff90f88 100755
--- a/tests/data/fake-kadmin
+++ b/tests/data/fake-kadmin
@@ -1,13 +1,16 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Fake kadmin.local used to test the keytab backend.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007
+# Copyright 2007, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
unless ($ARGV[0] eq '-q' && @ARGV == 2) {
die "invalid arguments\n";
}
diff --git a/tests/perl/minimum-version-t b/tests/perl/minimum-version-t
new file mode 100755
index 0000000..8c49327
--- /dev/null
+++ b/tests/perl/minimum-version-t
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+#
+# Check that too-new features of Perl are not being used.
+#
+# This version of the check script supports mapping various directories to
+# different version numbers. This allows a newer version of Perl to be
+# required for internal tools than for public code.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2012, 2013, 2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib "$ENV{SOURCE}/tap/perl";
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Automake qw(automake_setup perl_dirs);
+use Test::RRA::Config qw($MINIMUM_VERSION %MINIMUM_VERSION);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Minimum version tests');
+
+# Load prerequisite modules.
+use_prereq('Test::MinimumVersion');
+
+# Set up Automake testing.
+automake_setup();
+
+# For each exception case in %MINIMUM_VERSION, check the files that should
+# have that minium version. Sort for reproducible test order. Also
+# accumulate the list of directories we've already tested.
+my @tested;
+for my $version (sort keys %MINIMUM_VERSION) {
+ my $paths_ref = $MINIMUM_VERSION{$version};
+ all_minimum_version_ok($version, { paths => $paths_ref, no_plan => 1 });
+ push(@tested, @{$paths_ref});
+}
+
+# Now, check anything that's left against the default minimum version.
+my @paths = perl_dirs({ skip => [@tested] });
+all_minimum_version_ok($MINIMUM_VERSION, { paths => \@paths, no_plan => 1 });
+
+# Tell the TAP harness that we're done.
+done_testing();
diff --git a/tests/perl/strict-t b/tests/perl/strict-t
new file mode 100755
index 0000000..2df6d58
--- /dev/null
+++ b/tests/perl/strict-t
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+#
+# Check Perl scripts for strict, warnings, and syntax.
+#
+# Checks all Perl scripts in the tree for problems uncovered by Test::Strict.
+# This includes using strict and warnings for every script and ensuring they
+# all pass a syntax check. Currently, test suite coverage is not checked.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2012, 2013, 2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib "$ENV{SOURCE}/tap/perl";
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Automake qw(automake_setup perl_dirs);
+use Test::RRA::Config qw(@STRICT_IGNORE @STRICT_PREREQ);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Strictness tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Strict');
+
+# Check whether all prerequisites are available, and skip the test if any of
+# them are not.
+for my $module (@STRICT_PREREQ) {
+ use_prereq($module);
+}
+
+# Set up Automake testing. This must be done after loading Test::Strict,
+# since it wants to use FindBin to locate this script.
+automake_setup();
+
+# Run the actual tests. We also want to check warnings.
+$Test::Strict::TEST_WARNINGS = 1;
+all_perl_files_ok(perl_dirs({ skip => [@STRICT_IGNORE] }));
+
+# Suppress "used only once" warnings.
+END { $Test::Strict::TEST_WARNINGS = 0 }