]> eyrie.org Git - kerberos/krb5-strength.git/blob - tests/perl/strict-t
Add Perl testing from rra-c-util
[kerberos/krb5-strength.git] / tests / perl / strict-t
1 #!/usr/bin/perl
2 #
3 # Check Perl scripts for strict, warnings, and syntax.
4 #
5 # Checks all Perl scripts in the tree for problems uncovered by Test::Strict.
6 # This includes using strict and warnings for every script and ensuring they
7 # all pass a syntax check.  Currently, test suite coverage is not checked.
8 # This test is disabled unless RRA_MAINTAINER_TESTS is set, since some scripts
9 # may require dependencies that aren't necessarily present.
10 #
11 # The canonical version of this file is maintained in the rra-c-util package,
12 # which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
13 #
14 # Written by Russ Allbery <rra@stanford.edu>
15 # Copyright 2012, 2013
16 #     The Board of Trustees of the Leland Stanford Junior University
17 #
18 # Permission is hereby granted, free of charge, to any person obtaining a
19 # copy of this software and associated documentation files (the "Software"),
20 # to deal in the Software without restriction, including without limitation
21 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
22 # and/or sell copies of the Software, and to permit persons to whom the
23 # Software is furnished to do so, subject to the following conditions:
24 #
25 # The above copyright notice and this permission notice shall be included in
26 # all copies or substantial portions of the Software.
27 #
28 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34 # DEALINGS IN THE SOFTWARE.
35
36 use 5.006;
37 use strict;
38 use warnings;
39
40 use lib "$ENV{SOURCE}/tap/perl";
41
42 use Test::More;
43 use Test::RRA qw(use_prereq);
44 use Test::RRA::Automake qw(automake_setup perl_dirs);
45 use Test::RRA::Config qw(@STRICT_IGNORE);
46
47 # Load prerequisite modules.
48 use_prereq('Test::Strict');
49
50 # Set up Automake testing.  This must be done after loading Test::Strict,
51 # since it wants to use FindBin to locate this script.
52 automake_setup();
53
54 # Run the actual tests.  We also want to check warnings.
55 $Test::Strict::TEST_WARNINGS = 1;
56 all_perl_files_ok(perl_dirs({ skip => [@STRICT_IGNORE] }));
57
58 # Suppress "used only once" warnings.
59 END { $Test::Strict::TEST_WARNINGS = 0 }