1#!/usr/bin/env perl 2if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } 3# DESCRIPTION: Verilator: Verilog Test driver/expect definition 4# 5# Copyright 2003 by Wilson Snyder. This program is free software; you 6# can redistribute it and/or modify it under the terms of either the GNU 7# Lesser General Public License Version 3 or the Perl Artistic License 8# Version 2.0. 9# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 10 11scenarios(dist => 1); 12 13my $root = ".."; 14my $Debug; 15 16if (!-r "$root/.git") { 17 skip("Not in a git repository"); 18} else { 19 ### Must trim output before and after our file list 20 my %warns; 21 my $prefix; 22 my $summary; 23 { 24 my $status = `cd $root && git ls-files -o --exclude-standard`; 25 print "ST $status\n" if $Debug; 26 foreach my $file (sort split /\n/, $status) { 27 next if $file =~ /nodist/; 28 if (_has_tabs("$root/$file")) { 29 $warns{$file} = "File not in git or .gitignore (with tabs): $file"; 30 $summary = "Files untracked in git or .gitignore (with tabs):"; 31 } else { 32 $warns{$file} = "File not in git or .gitignore: $file"; 33 $summary ||= "Files untracked in git or .gitignore:"; 34 } 35 } 36 } 37 if (keys %warns) { 38 # First warning lists everything as that's shown in the driver summary 39 error($summary . " ", join(' ', sort keys %warns)); 40 foreach my $file (sort keys %warns) { 41 error($warns{$file}); 42 } 43 } 44} 45 46sub _has_tabs { 47 my $filename = shift; 48 my $contents = file_contents($filename); 49 if ($filename =~ /\.out$/) { 50 # Ignore golden files 51 } elsif ($contents =~ /[\001\002\003\004\005\006]/) { 52 # Ignore binrary files 53 } elsif ($contents =~ /\t/) { 54 return 1; 55 } 56 return 0; 57} 58 59ok(1); 601; 61