* src/sanity/readme.test: A script to check whether all the
directories referenced in README exist. * src/sanity/Makefile.am: Adjust to call `readme.test' when make check is invoked.
This commit is contained in:
parent
3633fced1d
commit
cbdb0feb68
3 changed files with 66 additions and 0 deletions
|
|
@ -1,3 +1,10 @@
|
|||
2010-01-24 Guillaume Sadegh <sadegh@lrde.epita.fr>
|
||||
|
||||
* src/sanity/readme.test: A script to check whether all the
|
||||
directories referenced in README exist.
|
||||
* src/sanity/Makefile.am: Adjust to call `readme.test' when make
|
||||
check is invoked.
|
||||
|
||||
2010-01-24 Guillaume Sadegh <sadegh@lrde.epita.fr>
|
||||
|
||||
Update the README.
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ check-local:
|
|||
$(SHELL) $(srcdir)/80columns.test $(TESTHEADER)
|
||||
INCDIR='$(top_srcdir)/src' \
|
||||
$(SHELL) $(srcdir)/style.test $(TESTHEADER)
|
||||
top_srcdir='$(top_srcdir)' \
|
||||
$(PERL) $(srcdir)/readme.test
|
||||
|
||||
# Ensure we have not forgotten to include an header.
|
||||
installcheck-local:
|
||||
|
|
|
|||
57
src/sanity/readme.test
Executable file
57
src/sanity/readme.test
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#! /usr/bin/perl -w
|
||||
# -*- cperl -*-
|
||||
|
||||
# Check that all the directories in the README exist.
|
||||
# Also has an option --list to print directories which are
|
||||
# documented in the README.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
local $\ = "\n";
|
||||
my $top_srcdir = $ENV{top_srcdir} || "../../";
|
||||
my $list_mode = ($#ARGV != -1 && $ARGV[0] eq "--list");
|
||||
|
||||
unless (-f "$top_srcdir/README")
|
||||
{
|
||||
print STDERR "$top_srcdir/README not found";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
open(FD, "$top_srcdir/README");
|
||||
my @directory = ();
|
||||
my $exit_status = 0;
|
||||
|
||||
while (<FD>)
|
||||
{
|
||||
# We consider Third party software?
|
||||
# last if (/^Third party software$/);
|
||||
next unless (m{^(\s*)(\S+/)\s+});
|
||||
my $level = length($1) / 3;
|
||||
my $name = $2;
|
||||
|
||||
$directory[$level] = $name;
|
||||
$#directory = $level;
|
||||
my $filename = join "", @directory;
|
||||
|
||||
# Use globbing on the filename.
|
||||
for my $directory (glob("$top_srcdir/$filename"))
|
||||
{
|
||||
if ($list_mode)
|
||||
{
|
||||
print "$directory";
|
||||
}
|
||||
else
|
||||
{
|
||||
unless (-d $directory || -f $directory)
|
||||
{
|
||||
print STDERR "$directory does not exist.";
|
||||
$exit_status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(FD);
|
||||
|
||||
exit $exit_status;
|
||||
Loading…
Add table
Add a link
Reference in a new issue