2020-05-04 22:42:15 +00:00
|
|
|
#!/usr/bin/env perl
|
2008-09-23 14:02:31 +00:00
|
|
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
2008-05-08 14:38:07 +00:00
|
|
|
# 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
|
2009-05-04 21:07:57 +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
|
2008-05-08 14:38:07 +00:00
|
|
|
|
2018-05-08 00:42:28 +00:00
|
|
|
scenarios(dist => 1);
|
|
|
|
|
2008-05-08 14:38:07 +00:00
|
|
|
my $root = "..";
|
|
|
|
|
2008-05-08 15:18:42 +00:00
|
|
|
### Must trim output before and after our file list
|
2017-09-11 23:18:58 +00:00
|
|
|
my %files = %{get_manifest_files($root)};
|
2008-05-08 14:38:07 +00:00
|
|
|
|
|
|
|
my $all_files = `cd $root && find . -type f -print`;
|
|
|
|
foreach my $file (split /\s+/,$all_files) {
|
|
|
|
next if $file eq '';
|
|
|
|
$file =~ s!^\./!!;
|
|
|
|
$files{$file} |= 2;
|
|
|
|
}
|
|
|
|
|
2009-11-15 14:15:33 +00:00
|
|
|
my %file_regexps;
|
2008-05-08 14:38:07 +00:00
|
|
|
my $skip = file_contents("$root/MANIFEST.SKIP");
|
|
|
|
foreach my $file (sort keys %files) {
|
|
|
|
foreach my $skip (split /\s+/,$skip) {
|
2018-05-07 02:39:18 +00:00
|
|
|
if ($file =~ /$skip/) {
|
|
|
|
$files{$file} |= 4;
|
|
|
|
$file_regexps{$file} = $skip;
|
|
|
|
}
|
2008-05-08 14:38:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-15 23:02:17 +00:00
|
|
|
# The repo may be a Git worktree
|
|
|
|
my $git_dir = `cd $root ; git rev-parse --git-common-dir`;
|
|
|
|
chomp $git_dir;
|
|
|
|
if (! -d $git_dir) {
|
|
|
|
$git_dir = ".git";
|
|
|
|
}
|
|
|
|
|
2019-07-30 22:27:36 +00:00
|
|
|
# Ignore files locally excluded
|
2019-05-15 23:02:17 +00:00
|
|
|
my $git_exclude = `cd $root && git ls-files --others --ignored --exclude-from $git_dir/info/exclude`;
|
|
|
|
foreach my $exclude (split /\s+/, $git_exclude) {
|
|
|
|
if (exists $files{$exclude}) {
|
2019-06-13 02:41:51 +00:00
|
|
|
$files{$exclude} |= 8;
|
2019-05-15 23:02:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-06 22:52:54 +00:00
|
|
|
my %warns;
|
2008-05-08 14:38:07 +00:00
|
|
|
foreach my $file (sort keys %files) {
|
|
|
|
my $tar = $files{$file}&1;
|
|
|
|
my $dir = $files{$file}&2;
|
|
|
|
my $skip = $files{$file}&4;
|
2019-05-15 23:02:17 +00:00
|
|
|
my $exclude = $files{$file}&8;
|
2008-05-08 14:38:07 +00:00
|
|
|
|
|
|
|
print +(($tar ? "TAR ":" ")
|
2018-05-07 02:39:18 +00:00
|
|
|
.($dir ? "DIR ":" ")
|
|
|
|
.($skip ? "SKIP ":" ")
|
2019-05-15 23:02:17 +00:00
|
|
|
.($exclude ? "EXCL ":" ")
|
|
|
|
." $file\n") if $Self->{verbose};
|
2008-05-08 14:38:07 +00:00
|
|
|
|
2019-05-15 23:02:17 +00:00
|
|
|
if ($dir && !$tar && !$skip && !$exclude) {
|
2018-05-07 02:39:18 +00:00
|
|
|
$warns{$file} = "File not in manifest or MANIFEST.SKIP: $file";
|
2008-05-08 14:38:07 +00:00
|
|
|
} elsif (!$dir && $tar && !$skip) {
|
2018-05-07 02:39:18 +00:00
|
|
|
$warns{$file} = "File in manifest, but not directory: $file";
|
2009-11-15 14:15:33 +00:00
|
|
|
} elsif ($dir && $tar && $skip) {
|
2018-05-07 02:39:18 +00:00
|
|
|
$warns{$file} = "File in manifest and also MANIFEST.SKIP, too general skip regexp '$file_regexps{$file}'?: $file";
|
2009-11-06 22:52:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keys %warns) {
|
|
|
|
# First warning lists everything as that's shown in the driver summary
|
2018-05-08 00:42:28 +00:00
|
|
|
error("Files mismatch with manifest: ",join(' ',sort keys %warns));
|
2009-11-06 22:52:54 +00:00
|
|
|
foreach my $file (sort keys %warns) {
|
2018-05-08 00:42:28 +00:00
|
|
|
error($warns{$file});
|
2008-05-08 14:38:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(1);
|
|
|
|
1;
|
2017-09-11 23:18:58 +00:00
|
|
|
|
|
|
|
sub get_manifest_files {
|
|
|
|
my $root = shift;
|
2020-05-31 13:03:51 +00:00
|
|
|
`cd $root && $ENV{MAKE} dist-file-list`;
|
|
|
|
my $manifest_files = `cd $root && $ENV{MAKE} dist-file-list`;
|
2017-09-11 23:18:58 +00:00
|
|
|
$manifest_files =~ s!.*begin-dist-file-list:!!sg;
|
|
|
|
$manifest_files =~ s!end-dist-file-list:.*$!!sg;
|
2017-09-19 01:36:18 +00:00
|
|
|
print "MF $manifest_files\n" if $Self->{verbose};
|
2017-09-11 23:18:58 +00:00
|
|
|
my %files;
|
|
|
|
foreach my $file (split /\s+/,$manifest_files) {
|
2018-05-07 02:39:18 +00:00
|
|
|
next if $file eq '';
|
|
|
|
$files{$file} |= 1;
|
2017-09-11 23:18:58 +00:00
|
|
|
}
|
|
|
|
return \%files;
|
|
|
|
}
|