]> eyrie.org Git - kerberos/krb5-strength.git/blob - tests/perl/strict-t
New upstream version 3.2
[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 #
9 # The canonical version of this file is maintained in the rra-c-util package,
10 # which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
11 #
12 # Written by Russ Allbery <eagle@eyrie.org>
13 # Copyright 2016, 2019 Russ Allbery <eagle@eyrie.org>
14 # Copyright 2012-2014
15 #     The Board of Trustees of the Leland Stanford Junior University
16 #
17 # Permission is hereby granted, free of charge, to any person obtaining a
18 # copy of this software and associated documentation files (the "Software"),
19 # to deal in the Software without restriction, including without limitation
20 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
21 # and/or sell copies of the Software, and to permit persons to whom the
22 # Software is furnished to do so, subject to the following conditions:
23 #
24 # The above copyright notice and this permission notice shall be included in
25 # all copies or substantial portions of the Software.
26 #
27 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
30 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
32 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
33 # DEALINGS IN THE SOFTWARE.
34 #
35 # SPDX-License-Identifier: MIT
36
37 use 5.008;
38 use strict;
39 use warnings;
40
41 use lib "$ENV{C_TAP_SOURCE}/tap/perl";
42
43 use Test::RRA qw(skip_unless_automated use_prereq);
44 use Test::RRA::Automake qw(automake_setup perl_dirs);
45 use Test::RRA::Config qw(@STRICT_IGNORE @STRICT_PREREQ);
46
47 use Test::More;
48
49 # Skip for normal user installs since this doesn't affect functionality.
50 skip_unless_automated('Strictness tests');
51
52 # Load prerequisite modules.
53 use_prereq('Test::Strict', '0.25');
54
55 # Check whether all prerequisites are available, and skip the test if any of
56 # them are not.
57 for my $module (@STRICT_PREREQ) {
58     use_prereq($module);
59 }
60
61 # Set up Automake testing.  This must be done after loading Test::Strict,
62 # since it wants to use FindBin to locate this script.
63 automake_setup();
64
65 # Run the actual tests.  We also want to check warnings.
66 $Test::Strict::TEST_WARNINGS = 1;
67 all_perl_files_ok(perl_dirs({ skip => [@STRICT_IGNORE] }));
68
69 # Suppress "used only once" warnings.
70 END { $Test::Strict::TEST_WARNINGS = 0 }