2020-05-04 22:42:15 +00:00
|
|
|
#!/usr/bin/env perl
|
2009-11-06 22:52:54 +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
|
2009-11-06 22:52:54 +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
|
2009-11-06 22:52:54 +00:00
|
|
|
|
2018-05-08 00:42:28 +00:00
|
|
|
scenarios(dist => 1);
|
|
|
|
|
2009-11-06 22:52:54 +00:00
|
|
|
my $root = "..";
|
|
|
|
my $Debug;
|
|
|
|
|
|
|
|
if (!-r "$root/.git") {
|
2018-05-08 00:42:28 +00:00
|
|
|
skip("Not in a git repository");
|
2009-11-06 22:52:54 +00:00
|
|
|
} else {
|
|
|
|
### Must trim output before and after our file list
|
|
|
|
my %warns;
|
2017-10-10 02:08:22 +00:00
|
|
|
my $prefix;
|
|
|
|
my $summary;
|
|
|
|
{
|
|
|
|
my $status = `cd $root && git ls-files -o --exclude-standard`;
|
|
|
|
print "ST $status\n" if $Debug;
|
|
|
|
foreach my $file (sort split /\n/, $status) {
|
|
|
|
next if $file =~ /nodist/;
|
|
|
|
if (_has_tabs("$root/$file")) {
|
|
|
|
$warns{$file} = "File not in git or .gitignore (with tabs): $file";
|
2021-09-08 03:50:28 +00:00
|
|
|
$summary = "Files untracked in git or .gitignore (with tabs):";
|
2017-10-10 02:08:22 +00:00
|
|
|
} else {
|
|
|
|
$warns{$file} = "File not in git or .gitignore: $file";
|
2021-09-08 03:50:28 +00:00
|
|
|
$summary ||= "Files untracked in git or .gitignore:";
|
2017-10-10 02:08:22 +00:00
|
|
|
}
|
|
|
|
}
|
2009-11-06 22:52:54 +00:00
|
|
|
}
|
|
|
|
if (keys %warns) {
|
2017-10-10 02:08:22 +00:00
|
|
|
# First warning lists everything as that's shown in the driver summary
|
2021-09-08 03:50:28 +00:00
|
|
|
error($summary . " ", join(' ', sort keys %warns));
|
2017-10-10 02:08:22 +00:00
|
|
|
foreach my $file (sort keys %warns) {
|
2018-05-08 00:42:28 +00:00
|
|
|
error($warns{$file});
|
2017-10-10 02:08:22 +00:00
|
|
|
}
|
2009-11-06 22:52:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-10 02:08:22 +00:00
|
|
|
sub _has_tabs {
|
|
|
|
my $filename = shift;
|
|
|
|
my $contents = file_contents($filename);
|
|
|
|
if ($filename =~ /\.out$/) {
|
|
|
|
# Ignore golden files
|
|
|
|
} elsif ($contents =~ /[\001\002\003\004\005\006]/) {
|
2023-01-08 23:17:24 +00:00
|
|
|
# Ignore binary files
|
2017-10-10 02:08:22 +00:00
|
|
|
} elsif ($contents =~ /\t/) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-11-06 22:52:54 +00:00
|
|
|
ok(1);
|
|
|
|
1;
|