Tests: Fix some coverage holes

This commit is contained in:
Wilson Snyder 2023-05-13 20:15:03 -04:00
parent 949be301de
commit 46f719ceaa
8 changed files with 102 additions and 5 deletions

View File

@ -0,0 +1,13 @@
%Error: t/t_array_pattern_bad3.v:20:15: Assignment pattern key used multiple times: 1
: ... In instance t
20 | 1: '1};
| ^
%Error: t/t_array_pattern_bad3.v:21:13: Assignment pattern with too many elements
: ... In instance t
21 | arr = '{'0, '1, '0, '1};
| ^~
%Error: t/t_array_pattern_bad3.v:22:13: Assignment pattern missed initializing elements: 2
: ... In instance t
22 | arr = '{'0, '1};
| ^~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env 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.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,25 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2018 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// bug1364
module t (/*AUTOARG*/
// Inputs
clk, res
);
input clk;
input res;
int arr[3];
initial begin
arr = '{default: '0,
1: '0,
1: '1}; // Bad
arr = '{'0, '1, '0, '1}; // Bad, too many
arr = '{'0, '1}; // Bad, too few
end
endmodule

View File

@ -2,7 +2,7 @@
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2023 by Antmicro Ltd. This program is free software; you
# Copyright 2023 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.

View File

@ -38,14 +38,11 @@ foreach my $s (
'Array initialization has too few elements, need element ',
'Assert not allowed under another assert',
'Assigned pin is neither input nor output',
'Assignment pattern key used multiple times: ',
'Assignment pattern with no members',
'Assignment pattern with too many elements',
'Attempted parameter setting of non-parameter: Param ',
'Can\'t find typedef: ',
'Can\'t find varpin scope of ',
'Can\'t resolve module reference: \'',
'Cannot mix DPI import, DPI export, class methods, and/or public ',
'Cannot write preprocessor output: ',
'Circular logic when ordering code (non-cutable edge loop)',
'Deferred assertions must use \'#0\' (IEEE 1800-2017 16.4)',
@ -161,12 +158,14 @@ sub check {
print(" Line is: ", $line, "\n") if $Debug;
}
}
print "\n";
for my $msg (sort keys %Suppressed) {
if (!$used_suppressed{$msg}) {
print "Suppression not used: '$msg'\n";
}
}
}
print "\n";
}
sub read_messages {

View File

@ -0,0 +1,4 @@
%Error: t/t_dpi_import_mix_bad.v:11:32: Cannot mix DPI import, DPI export, class methods, and/or public on same function: 't.foo'
11 | import "DPI-C" function int foo (int i);
| ^~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env 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.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,18 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 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.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
module t ();
import "DPI-C" function int foo (int i);
export "DPI-C" function foo; // Bad mix
initial begin
$stop;
end
endmodule