2020-05-04 22:42:15 +00:00
|
|
|
#!/usr/bin/env perl
|
2010-01-25 00:00:34 +00:00
|
|
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
|
|
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
|
|
|
#
|
2020-03-21 15:24:24 +00:00
|
|
|
# Copyright 2003 by Wilson Snyder. This program is free software; you
|
|
|
|
# can redistribute it and/or modify it under the terms of either the GNU
|
2010-01-25 00:00:34 +00:00
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
# Version 2.0.
|
2020-03-21 15:24:24 +00:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2010-01-25 00:00:34 +00:00
|
|
|
|
|
|
|
use IO::File;
|
2023-01-26 11:35:59 +00:00
|
|
|
use File::Spec::Functions 'catfile';
|
2010-01-25 00:00:34 +00:00
|
|
|
|
2018-05-08 00:42:28 +00:00
|
|
|
scenarios(dist => 1);
|
|
|
|
|
2010-01-25 00:00:34 +00:00
|
|
|
my $root = "..";
|
|
|
|
my $Debug;
|
|
|
|
|
2023-01-26 11:35:59 +00:00
|
|
|
if (!-r catfile($root, ".git")) {
|
2018-05-08 00:42:28 +00:00
|
|
|
skip("Not in a git repository");
|
2010-01-25 00:00:34 +00:00
|
|
|
} else {
|
|
|
|
### Must trim output before and after our file list
|
|
|
|
my $files = `cd $root && git ls-files --exclude-standard`;
|
|
|
|
print "ST $files\n" if $Debug;
|
2023-01-26 11:35:59 +00:00
|
|
|
foreach my $file (split /\n/, $files) {
|
|
|
|
next if $file =~ m!include/vltstd/vpi_user.h!; # IEEE Standard file - can't change it
|
|
|
|
next if $file =~ m!include/gtkwave/!; # Standard file - can't change it
|
|
|
|
my $filename = catfile($root, $file);
|
|
|
|
@lines = split /\n/, file_contents($filename);
|
|
|
|
@include_lines = grep(/include/, @lines);
|
|
|
|
foreach my $line (@include_lines) {
|
|
|
|
my $hit;
|
|
|
|
$hit = 1 if $line =~ /\bassert\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bctype\.h/;
|
|
|
|
$hit = 1 if $line =~ /\berrno\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bfloat\.h/;
|
|
|
|
$hit = 1 if $line =~ /\blimits\.h/;
|
|
|
|
$hit = 1 if $line =~ /\blocale\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bmath\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bsetjmp\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bsignal\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstdarg\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstdbool\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstddef\.h/;
|
|
|
|
#Not yet: $hit = 1 if $line =~ /\bstdint\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstdio\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstdlib\.h/;
|
|
|
|
$hit = 1 if $line =~ /\bstring\.h/;
|
|
|
|
$hit = 1 if $line =~ /\btime\.h/ && $line !~ m!sys/time.h!;
|
|
|
|
next if !$hit;
|
|
|
|
$names{"$filename: $line"} = 1;
|
|
|
|
}
|
2010-01-25 00:00:34 +00:00
|
|
|
}
|
|
|
|
if (keys %names) {
|
2023-01-26 11:35:59 +00:00
|
|
|
error("Files like stdint.h instead of cstdint:\n ", join("\n ", sort keys %names));
|
2010-01-25 00:00:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(1);
|
|
|
|
1;
|