Tests: Comment driver.pl with some argument meanings. No functional change.

This commit is contained in:
Wilson Snyder 2023-12-19 22:43:18 -05:00
parent 21b2e874ce
commit 7a537765bc
1 changed files with 41 additions and 28 deletions

View File

@ -333,22 +333,23 @@ use strict;
sub new { sub new {
my $class = shift; my $class = shift;
my $self = { my $self = {
# Parameters # Arguments
driver_log_filename => undef, driver_log_filename => undef,
quiet => 0, quiet => 0,
# Counts # Counts
all_cnt => 0, all_cnt => 0,
left_cnt => 0, left_cnt => 0,
ok_cnt => 0, ok_cnt => 0, # Argument passed when rerunning
fail1_cnt => 0, fail1_cnt => 0, # Argument passed when rerunning
fail_cnt => 0, fail_cnt => 0,
skip_cnt => 0, skip_cnt => 0, # Argument passed when rerunning
skip_msgs => [], skip_msgs => [],
fail_msgs => [], fail_msgs => [],
fail_tests => [], fail_tests => [],
# Per-task identifiers # Per-task identifiers
running_ids => {}, running_ids => {},
@_}; @_ # All legal arguments shown immediately above
};
bless $self, $class; bless $self, $class;
return $self; return $self;
} }
@ -357,7 +358,11 @@ sub fail_count { return $_[0]->{fail_cnt}; }
sub one_test { sub one_test {
my $self = shift; my $self = shift;
my @params = @_; my @params = (# Parameters:
# pl_filename =>
# rerun_skipping =>
# {scenario_name} => 1
@_); # All legal arguments shown immediately above
my %params = (@params); my %params = (@params);
$self->{all_cnt}++; $self->{all_cnt}++;
$self->{left_cnt}++; $self->{left_cnt}++;
@ -484,7 +489,7 @@ sub print_summary {
my $self = shift; my $self = shift;
my %params = (force => 0, # Force printing my %params = (force => 0, # Force printing
show_running => 0, # Show running processes show_running => 0, # Show running processes
@_); @_); # All legal arguments shown immediately above
if (!$self->{quiet} || $params{force} if (!$self->{quiet} || $params{force}
|| ($self->{left_cnt} < 5) || ($self->{left_cnt} < 5)
|| (time() - ($self->{_last_summary_time} || 0) >= 15)) { # Don't show for interactive gdb etc || (time() - ($self->{_last_summary_time} || 0) >= 15)) { # Don't show for interactive gdb etc
@ -564,7 +569,7 @@ sub defineOpt {
sub new { sub new {
my $class = shift; my $class = shift;
my $self = {@_}; my $self = {@_}; # Supports arbitrary arguments
$self->{name} ||= $2 if $self->{pl_filename} =~ m!^(.*/)?([^/]*)\.pl$!; $self->{name} ||= $2 if $self->{pl_filename} =~ m!^(.*/)?([^/]*)\.pl$!;
@ -787,8 +792,7 @@ sub skip {
sub scenarios { sub scenarios {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
my %params = (@_); my %params = (@_); # Called from tests as: scenarios(...);
# Called from tests as: scenarios(...);
# to specify which scenarios this test runs under. # to specify which scenarios this test runs under.
# Where ... is one cases listed in All_Scenarios # Where ... is one cases listed in All_Scenarios
if ((scalar keys %params) < 1) { if ((scalar keys %params) < 1) {
@ -903,7 +907,8 @@ sub clean_objs {
sub compile_vlt_cmd { sub compile_vlt_cmd {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
my %param = (%{$self}, @_); # Default arguments are from $self my %param = (%{$self}, # Default arguments are from $self
@_); # Supports arbitrary arguments
return 1 if $self->errors || $self->skips; return 1 if $self->errors || $self->skips;
my @vlt_cmd = ( my @vlt_cmd = (
@ -918,7 +923,8 @@ sub compile_vlt_cmd {
sub compile_vlt_flags { sub compile_vlt_flags {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
my %param = (%{$self}, @_); # Default arguments are from $self my %param = (%{$self}, # Default arguments are from $self
@_); # Supports arbitrary arguments
return 1 if $self->errors || $self->skips; return 1 if $self->errors || $self->skips;
my $checkflags = (' '.join(' ', my $checkflags = (' '.join(' ',
@ -988,14 +994,15 @@ sub lint {
make_top_shell => 0, make_top_shell => 0,
verilator_flags2 => ["--lint-only"], verilator_flags2 => ["--lint-only"],
verilator_make_gmake => 0, verilator_make_gmake => 0,
@_); @_); # Supports arbitrary arguments
$self->compile(%param); $self->compile(%param);
} }
sub compile { sub compile {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
my %param = (tee => 1, my %param = (tee => 1,
%{$self}, @_); # Default arguments are from $self %{$self}, # Default arguments are from $self
@_); # Supports arbitrary arguments
return 1 if $self->errors || $self->skips; return 1 if $self->errors || $self->skips;
$self->oprint("Compile\n") if $self->{verbose}; $self->oprint("Compile\n") if $self->{verbose};
@ -1254,7 +1261,8 @@ sub compile {
sub execute { sub execute {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
return 1 if $self->errors || $self->skips; return 1 if $self->errors || $self->skips;
my %param = (%{$self}, @_); # Default arguments are from $self my %param = (%{$self}, # Default arguments are from $self
@_); # Supports arbitrary arguments
# params may be expect or {tool}_expect # params may be expect or {tool}_expect
$self->oprint("Run\n") if $self->{verbose}; $self->oprint("Run\n") if $self->{verbose};
@ -1403,8 +1411,6 @@ sub inline_checks {
return 1 if $self->errors || $self->skips; return 1 if $self->errors || $self->skips;
return 1 if !$self->{vlt_all}; return 1 if !$self->{vlt_all};
my %param = (%{$self}, @_); # Default arguments are from $self
my $covfn = $Self->{coverage_filename}; my $covfn = $Self->{coverage_filename};
my $contents = $self->file_contents($covfn); my $contents = $self->file_contents($covfn);
@ -1592,15 +1598,21 @@ sub vm_prefix {
sub run { sub run {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
$self->_run(@_); $self->_run(@_); # See _run() for arguments
} }
sub _run { sub _run {
my $self = (ref $_[0] ? shift : $Self); my $self = (ref $_[0] ? shift : $Self);
my %param = (tee => 1, my %param = (tee => 1,
# cmd => [...]
# check_finished => 0 # Check for All Finished
# entering => # Print entering directory information # entering => # Print entering directory information
# expect => # Regexp to expect in output
# expect_filename => # Filename that should match logfile
# fails => 0 # Command should fail
# logfile => # Filename to write putput to
# verilator_run => # Move gcov data to parallel area # verilator_run => # Move gcov data to parallel area
@_); @_); # All legal arguments shown immediately above
my $command = join(' ', @{$param{cmd}}); my $command = join(' ', @{$param{cmd}});
$command = "time $command" if $opt_benchmark && $command !~ /^cd /; $command = "time $command" if $opt_benchmark && $command !~ /^cd /;
@ -1760,7 +1772,8 @@ sub _try_regex {
# 1 if $text ~= /$regex/ms # 1 if $text ~= /$regex/ms
# 0 if no match # 0 if no match
# -1 if $regex is invalid, doesn't compile # -1 if $regex is invalid, doesn't compile
my ($text, $regex) = @_; my $text = shift;
my $regex = shift;
my $result; my $result;
{ {
local $@; local $@;
@ -2583,7 +2596,7 @@ sub extract {
regexp => qr/.*/, regexp => qr/.*/,
lineno_adjust => -9999, lineno_adjust => -9999,
lines => undef, #'#, #-#', lines => undef, #'#, #-#',
@_); @_); # All legal arguments shown immediately above
my $temp_fn = $param{out}; my $temp_fn = $param{out};
$temp_fn =~ s!.*/!!g; $temp_fn =~ s!.*/!!g;