Tests: Close some test coverage holes.

This commit is contained in:
Wilson Snyder 2019-06-30 17:38:41 -04:00
parent 1aae6df669
commit ec32a9b976
15 changed files with 159 additions and 6 deletions

View File

@ -173,7 +173,7 @@ void V3Options::checkParameters() {
it != m_parameters.end(); ++it) {
msg << " " << it->first;
}
v3fatal(msg.str()<<endl);
v3error(msg.str());
}
}

View File

@ -381,8 +381,8 @@ sub sprint_summary {
my $delta = time() - $::Start;
my $leftmsg = $::Have_Forker ? $self->{left_cnt} : "NO-FORKER";
my $out = "";
$out .= " Left $leftmsg" if $self->{left_cnt};
$out .= " Passed $self->{ok_cnt}";
$out .= "Left $leftmsg " if $self->{left_cnt};
$out .= "Passed $self->{ok_cnt}";
# Ordered below most severe to least severe
$out .= " Failed $self->{fail_cnt}";
$out .= " Failed-First $self->{fail1_cnt}";
@ -778,7 +778,8 @@ sub lint {
sub compile {
my $self = (ref $_[0]? shift : $Self);
my %param = (%{$self}, @_); # Default arguments are from $self
my %param = (tee => 1,
%{$self}, @_); # Default arguments are from $self
return 1 if $self->errors || $self->skips || $self->unsupporteds;
$self->oprint("Compile\n") if $self->{verbose};
@ -909,6 +910,7 @@ sub compile {
$self->_run(logfile=>"$self->{obj_dir}/vlt_compile.log",
fails=>$param{fails},
tee=>$param{tee},
expect=>$param{expect},
expect_filename=>$param{expect_filename},
cmd=>\@cmdargs) if $::Opt_Verilation;

View File

@ -0,0 +1,2 @@
%Error: t/t_display_esc_bad.v:8: Unknown escape sequence: \x
%Error: Exiting due to

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# 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
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(vlt => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,10 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
module t;
initial begin
$display("\x\y\z"); // Illegal escapes
end
endmodule

View File

@ -0,0 +1,4 @@
%Warning-VARHIDDEN: t/t_enum_bad_hide.v:10: Declaration of enum value hides declaration in upper scope: HIDE_VALUE
t/t_enum_bad_hide.v:6: ... Location of original declaration
... Use "/* verilator lint_off VARHIDDEN */" and lint_on around source to disable this message.
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# 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
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(linter => 1);
lint(
verilator_flags2 => ["--lint-only -Wwarn-VARHIDDEN"],
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,12 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
typedef enum { HIDE_VALUE = 0 } hide_enum_t;
module t;
typedef enum { HIDE_VALUE = 0 } hide_enum_t;
endmodule

View File

@ -7,7 +7,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(vlt => 1);
scenarios(vlt_all => 1);
compile(
v_flags2 => ["--debug --no-debug-leak"],

View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2008 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(vlt_all => 1);
compile(
v_flags2 => ["--debugi 9"],
tee => 0,
verilator_make_gcc => 0,
make_top_shell => 0,
make_main => 0,
);
ok(1);
1;

View File

@ -0,0 +1,11 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Wilson Snyder.
module t;
initial begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -10,6 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
foreach my $prog (
# See also t_flag_version.pl
"../bin/verilator",
"../bin/verilator_coverage",
"../bin/verilator_difftree",
@ -17,7 +18,7 @@ foreach my $prog (
"../bin/verilator_profcfunc",
) {
run(fails => 1,
cmd => ["perl",$prog,
cmd => ["perl", $prog,
"--help"],
logfile => "$Self->{obj_dir}/t_help.log",
tee => 0,

View File

@ -0,0 +1,2 @@
%Error: Parameters from the command line were not found in the design: PARAM_THAT_DOES_NON_EXIST
%Error: Exiting due to

View File

@ -0,0 +1,22 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2008 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(vlt => 1);
top_filename("t/t_flag_parameter.v");
lint(
fails => 1,
# It is not possible to put them into the options file
v_flags2 => ['-GPARAM_THAT_DOES_NON_EXIST=1'],
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,29 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003-2009 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(dist => 1);
foreach my $prog (
# See also t_flag_help.pl
"../bin/verilator",
"../bin/verilator_coverage",
#"../bin/verilator_difftree",
#"../bin/verilator_gantt",
#"../bin/verilator_profcfunc",
) {
run(fails => 0,
cmd => ["perl", $prog,
"--version"],
logfile => "$Self->{obj_dir}/t_help.log",
expect => qr/^Verilator/,
);
}
ok(1);
1;