spot/tests/sanity
Alexandre Duret-Lutz 4c94e14f86 parseaut: replace std::map by robin_hood::unordered_flat_map
This improves the parsing performance a bit more.

* spot/parseaut/parsedecl.hh, spot/parseaut/parseaut.yy: Here.
* tests/sanity/style.test: Handle parsedecl.hh as a private header.
2021-09-15 16:53:00 +02:00
..
.gitignore move the sanity tests in tests/sanity/ 2016-01-05 17:20:51 +01:00
80columns.test * tests/sanity/80columns.test: Force LC_ALL. 2020-05-30 14:29:20 +02:00
bin.test tests: use $PERL instead of perl 2020-09-23 11:33:15 +02:00
getenv.test sanity: ensure that all environment variables are documented 2017-05-31 20:32:56 +02:00
includes.test includes: must not check *.hxx 2020-06-03 10:33:53 +02:00
ipynb.pl python: report dot errors 2016-02-16 14:34:57 +01:00
namedprop.test twa: implement a copy_named_properties_of() method 2021-07-08 10:33:15 +02:00
private.test sanity: fix race conditions in the test suite 2016-02-16 17:29:06 +01:00
readme.pl move the sanity tests in tests/sanity/ 2016-01-05 17:20:51 +01:00
style.test parseaut: replace std::map by robin_hood::unordered_flat_map 2021-09-15 16:53:00 +02:00

#! /usr/bin/perl -w
# -*- cperl; coding: utf-8 -*-
#
# Copyright (C) 2010, 2015, 2016 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Check that all the directories documented in README exist, and that
# all directories listed in configure.ac are documented.
#
# Also has an option --list to print directories which are
# documented.

use strict;
use warnings;

local $\ = "\n";
my $srcdir = $ENV{srcdir} || ".";
my $top_srcdir = "$srcdir/../..";
my $top_srcdir_len = length($top_srcdir) + 1;
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")
  or die "$!: cannot open $top_srcdir/README";
my @directory = ();
my $exit_status = 0;

my %documenteddirs;

while (<FD>)
{
  # Skip non-distributed directories.
  next if /Not distributed/i;
  # 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"))
  {
    my $striped = substr($directory, $top_srcdir_len);
    $documenteddirs{$striped} = 1;
    if ($list_mode)
    {
      print "$striped";
    }
    else
    {
      unless (-d $directory || -f $directory)
      {
        print STDERR "$directory mentioned in README does not exist.";
        $exit_status = 1;
      }
    }
  }
}

close(FD);

open(FD, "$top_srcdir/configure.ac")
  or die "$!: cannot open $top_srcdir/configure.ac";
while (<FD>)
{
  next unless m{\s*(\S+/)Makefile};
  unless (exists $documenteddirs{$1})
  {
    print STDERR "$1 directory undocumented in README.";
    $exit_status = 1;
  }
}
close(FD);

exit $exit_status;