Commit 145e375c authored by Russ Allbery's avatar Russ Allbery

Add documentation tests

parent 20746587
......@@ -7,8 +7,9 @@
# See LICENSE for licensing terms.
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = .gitignore LICENSE autogen patches/README patches/heimdal-1.3.1 \
patches/mit-krb5-1.4.4 patches/mit-krb5-1.8.3 tools/krb5-sync.pod
EXTRA_DIST = .gitignore LICENSE autogen patches/README \
patches/heimdal-1.3.1 patches/mit-krb5-1.4.4 patches/mit-krb5-1.8.3 \
tests/docs/pod-spelling-t tests/docs/pod-t tools/krb5-sync.pod
AM_CPPFLAGS = $(KRB5_CPPFLAGS)
......
docs/pod
docs/pod-spelling
portable/asprintf
portable/snprintf
portable/strlcat
......
#!/usr/bin/perl -w
#
# Check for spelling errors in POD documentation
#
# Checks all POD files in the tree for spelling problems using Pod::Spell and
# either aspell or ispell. aspell is preferred. This test is disabled unless
# RRA_MAINTAINER_TESTS is set, since spelling dictionaries vary too much
# between environments.
#
# Copyright 2008, 2009, 2011 Russ Allbery <rra@stanford.edu>
#
# See LICENSE for licensing terms.
use strict;
use Test::More;
# Skip all spelling tests unless the maintainer environment variable is set.
plan skip_all => 'spelling tests only run for maintainer'
unless $ENV{RRA_MAINTAINER_TESTS};
# Load required Perl modules.
eval 'use Test::Pod 1.00';
plan skip_all => 'Test::Pod 1.00 required for testing POD' if $@;
eval 'use Pod::Spell';
plan skip_all => 'Pod::Spell required to test POD spelling' if $@;
# Locate a spell-checker. hunspell is not currently supported due to its lack
# of support for contractions (at least in the version in Debian).
my @spell;
my %options = (aspell => [ qw(-d en_US --home-dir=./ list) ],
ispell => [ qw(-d american -l -p /dev/null) ]);
SEARCH: for my $program (qw/aspell ispell/) {
for my $dir (split ':', $ENV{PATH}) {
if (-x "$dir/$program") {
@spell = ("$dir/$program", @{ $options{$program} });
}
last SEARCH if @spell;
}
}
plan skip_all => 'aspell or ispell required to test POD spelling'
unless @spell;
# Prerequisites are satisfied, so we're going to do some testing. Figure out
# what POD files we have and from that develop our plan.
$| = 1;
my @pod = map {
my $pod = "$ENV{SOURCE}/../" . $_;
$pod =~ s,[^/.][^/]*/../,,g;
$pod;
} qw(tools/krb5-sync-backend tools/krb5-sync.pod);
plan tests => scalar @pod;
# Finally, do the checks.
for my $pod (@pod) {
my $child = open (CHILD, '-|');
if (not defined $child) {
BAIL_OUT ("cannot fork: $!");
} elsif ($child == 0) {
my $pid = open (SPELL, '|-', @spell)
or BAIL_OUT ("cannot run @spell: $!");
open (POD, '<', $pod) or BAIL_OUT ("cannot open $pod: $!");
my $parser = Pod::Spell->new;
$parser->parse_from_filehandle (\*POD, \*SPELL);
close POD;
close SPELL;
exit ($? >> 8);
} else {
my @words = <CHILD>;
close CHILD;
SKIP: {
skip "@spell failed for $pod", 1 unless $? == 0;
for (@words) {
s/^\s+//;
s/\s+$//;
}
is ("@words", '', $pod);
}
}
}
#!/usr/bin/perl -w
#
# Test formatting of POD documentation.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2008, 2009, 2011
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
use strict;
use Test::More;
my @podfiles = qw(tools/krb5-sync-backend tools/krb5-sync.pod);
eval 'use Test::Pod 1.00';
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
my $srcdir = "$ENV{SOURCE}";
$srcdir =~ s,[^/]+/*$,,;
chdir "$srcdir" or die "$0: cannot chdir to $srcdir: $!\n";
all_pod_files_ok (@podfiles);
......@@ -281,6 +281,9 @@ EOH
# Documentation
##############################################################################
=for stopwords
krb5-sync-backend krb5-sync UTC Allbery timestamp username propagations
=head1 NAME
krb5-sync-backend - Manipulate Kerberos password and status change queue
......
=for stopwords
krb5-sync keytab LDAP username jdoe jdoe's Allbery
=head1 NAME
krb5-sync - Synchronize passwords and status with Active Directory
......@@ -74,7 +77,7 @@ B<krb5-sync> utility. Therefore, if this utility reports success but no
change is happening, double-check the configuration to ensure that all
required options are present.
The C<ad_keytab> option specifies the location of a srvtab or keytab for
The C<ad_keytab> option specifies the location of a keytab for
authenticating to the other realm, the C<ad_principal> option specifies
the principal to authenticate as (using the key in the keytab), and the
C<ad_realm> option specifies the foreign realm. C<ad_admin_server> is the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment