Tests: Improve warning coverage

This commit is contained in:
Wilson Snyder 2025-05-16 22:32:25 -04:00
parent 2dbe897e1b
commit 7a5c223ccf
18 changed files with 411 additions and 26 deletions

View File

@ -19,38 +19,32 @@ Suppressed = {}
for s in [
' exited with ', # Is hit; driver.py filters out
'Assigned pin is neither input nor output', # Instead earlier error
'Define missing argument \'', # Instead get Define passed too many arguments
'Define or directive not defined: `', # Instead V3ParseImp will warn
'EOF in unterminated string', # Instead get normal unterminated
'Enum ranges must be integral, per spec', # Hard to hit
'Expecting define formal arguments. Found: ', # Instead define syntax error
'Import package not found: ', # Errors earlier, until future parser released
'Return with return value isn\'t underneath a function', # Hard to hit, get other bad return messages
'Syntax error: Range \':\', \'+:\' etc are not allowed in the instance ', # Instead get syntax error
'Syntax error parsing real: \'', # Instead can't lex the number
'Syntax error: Range \':\', \'+:\' etc are not allowed in the instance ', # Instead get syntax error
'Unsupported: Ranges ignored in port-lists', # Hard to hit
'dynamic new() not expected in this context (expected under an assign)', # Instead get syntax error
# Not yet analyzed
' loading non-variable',
'--pins-bv maximum is 65: ',
'--pipe-filter protocol error, unexpected: ',
'--pipe-filter returned bad status',
'--pipe-filter: Can\'t pipe: ',
'--pipe-filter: fork failed: ',
'--threads must be >= 0: ',
'--threads-max-mtasks must be >= 1: ',
'--trace-threads must be >= 1: ',
'/*verilator sformat*/ can only be applied to last argument of ',
'Argument needed for string.',
'Array initialization has too few elements, need element ',
'Assigned pin is neither input nor output',
'Assignment pattern with no members',
'Can\'t find varpin scope of ',
'Can\'t read annotation file: ',
'Can\'t resolve module reference: \'',
'Can\'t write file: ',
'Circular logic when ordering code (non-cutable edge loop)',
'Define missing argument \'',
'Define or directive not defined: `',
'Exceeded limit of ',
'Expecting define formal arguments. Found: ',
'Extern declaration\'s scope is not a defined class',
'File not found: ',
'Format to $display-like function must have constant format string',
@ -80,7 +74,6 @@ for s in [
'Unsupported pullup/down (weak driver) construct.',
'Unsupported tristate construct (not in propagation graph): ',
'Unsupported tristate port expression: ',
'Unsupported/unknown built-in dynamic array method ',
'Unsupported: $bits for queue',
'Unsupported: $c can\'t generate wider than 64 bits',
'Unsupported: &&& expression',
@ -107,20 +100,15 @@ for s in [
'Unsupported: [] dimensions',
'Unsupported: \'default :/\' constraint',
'Unsupported: \'{} .* patterns',
'Unsupported: \'{} tagged patterns',
'Unsupported: always[] (in property expression)',
'Unsupported: assertion items in clocking blocks',
'Unsupported: don\'t know how to deal with ',
'Unsupported: eventually[] (in property expression)',
'Unsupported: extern forkjoin',
'Unsupported: extern interface',
'Unsupported: extern module',
'Unsupported: extern task',
'Unsupported: modport export',
'Unsupported: no_inline for tasks',
'Unsupported: property port \'local\'',
'Unsupported: randsequence production list',
'Unsupported: randsequence repeat',
'Unsupported: repeat event control',
'Unsupported: s_always (in property expression)',
'Unsupported: static cast to ',

View File

@ -0,0 +1,5 @@
%Error: t/t_dpi_display_bad.v:17:69: /*verilator sformat*/ can only be applied to last argument of a function
17 | (input string formatted /*verilator sformat*/ , input string other_bad );
| ^~~~~~~~~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('vlt')
test.lint(fails=True, expect_filename=test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2010 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 ();
`ifndef VERILATOR
`error "Only Verilator supports PLI-ish DPI calls and sformat conversion."
`endif
import "DPI-C" context dpii_display_call
= function void \$dpii_display
(input string formatted /*verilator sformat*/, input string other_bad );
initial begin
$dpii_display("hello", "huh");
$stop;
end
endmodule

View File

@ -24,4 +24,13 @@
: ... note: In instance 't'
29 | b = s.product with (item inside { "hello", "sad", "world" });
| ^
%Error-UNSUPPORTED: t/t_dynarray_method_bad.v:32:13: Unsupported/unknown built-in dynamic array method 'unknown_bad'
: ... note: In instance 't'
32 | b = s.unknown_bad;
| ^~~~~~~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Warning-WIDTHTRUNC: t/t_dynarray_method_bad.v:32:9: Operator ASSIGN expects 1 bits on the Assign RHS, but Assign RHS's METHODCALL 'unknown_bad' generates 64 bits.
: ... note: In instance 't'
32 | b = s.unknown_bad;
| ^
%Error: Exiting due to

View File

@ -29,6 +29,8 @@ module t (/*AUTOARG*/);
b = s.product with (item inside { "hello", "sad", "world" });
`checkh(b, 1'b1);
b = s.unknown_bad;
$write("*-* All Finished *-*\n");
$finish;
end

View File

@ -0,0 +1,2 @@
%Error: --threads must be >= 0: -1
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = 't/t_EXAMPLE.v'
test.run(cmd=["perl", os.environ["VERILATOR_ROOT"] + "/bin/verilator", "--threads -1"],
logfile=test.run_log_filename,
fails=True,
expect_filename=test.golden_filename,
verilator_run=True)
test.passes()

View File

@ -0,0 +1,2 @@
%Error: --threads-max-mtasks must be >= 1: 0
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = 't/t_EXAMPLE.v'
test.run(cmd=["perl", os.environ["VERILATOR_ROOT"] + "/bin/verilator", "--threads-max-mtasks 0"],
logfile=test.run_log_filename,
fails=True,
expect_filename=test.golden_filename,
verilator_run=True)
test.passes()

View File

@ -0,0 +1,2 @@
%Error: --trace-threads must be >= 1: -1
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = 't/t_EXAMPLE.v'
test.lint(verilator_flags2=["--trace-threads -1"],
fails=True,
expect_filename=test.golden_filename)
test.passes()

View File

@ -1,5 +1,11 @@
%Error-UNSUPPORTED: t/t_program_extern.v:7:1: Unsupported: extern program
7 | extern program pgm;
7 | extern program ex_pgm;
| ^~~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_program_extern.v:8:1: Unsupported: extern interface
8 | extern interface ex_ifc;
| ^~~~~~
%Error-UNSUPPORTED: t/t_program_extern.v:9:1: Unsupported: extern module
9 | extern module ex_mod;
| ^~~~~~
%Error: Exiting due to

View File

@ -4,18 +4,18 @@
// any use, without warranty, 2022 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
extern program pgm;
program pgm;
task ptask;
endtask
endprogram
extern program ex_pgm;
extern interface ex_ifc;
extern module ex_mod;
module t(/*AUTOARG*/);
pgm sub ();
ex_pgm u_pgm();
ex_ifc u_ifc();
ex_mod u_mod();
initial begin
ex_task();
$write("*-* All Finished *-*\n");
$finish;
end

View File

@ -149,4 +149,250 @@
%Error-UNSUPPORTED: t/t_randsequence.v:105:38: Unsupported: randsequence production id
105 | one_if: if (i % 10 == 0) count_1 else most;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:105:51: Unsupported: randsequence production id
105 | one_if: if (i % 10 == 0) count_1 else most;
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:105:21: Unsupported: randsequence if
105 | one_if: if (i % 10 == 0) count_1 else most;
| ^~
%Error-UNSUPPORTED: t/t_randsequence.v:105:19: Unsupported: randsequence production
105 | one_if: if (i % 10 == 0) count_1 else most;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:106:20: Unsupported: randsequence production
106 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:107:20: Unsupported: randsequence production
107 | count_2: { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:108:20: Unsupported: randsequence production
108 | count_3: { ++counts[3]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:109:20: Unsupported: randsequence production
109 | count_4: { ++counts[4]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:110:16: Unsupported: randsequence production
110 | bad: { $stop; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:112:24: Unsupported: randsequence production id
112 | 0: bad;
| ^~~
%Error-UNSUPPORTED: t/t_randsequence.v:112:22: Unsupported: randsequence case item
112 | 0: bad;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:113:27: Unsupported: randsequence production id
113 | 1, 2: count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:113:25: Unsupported: randsequence case item
113 | 1, 2: count_2;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:114:30: Unsupported: randsequence production id
114 | 3, 4, 5: count_3;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:114:28: Unsupported: randsequence case item
114 | 3, 4, 5: count_3;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:115:29: Unsupported: randsequence production id
115 | default count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:115:21: Unsupported: randsequence case item
115 | default count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:111:19: Unsupported: randsequence case
111 | most: case (i % 10)
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:111:17: Unsupported: randsequence production
111 | most: case (i % 10)
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:103:10: Unsupported: randsequence
103 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:127:27: Unsupported: randsequence production id
127 | main: repeat(10) count_1;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:127:16: Unsupported: randsequence repeat
127 | main: repeat(10) count_1;
| ^~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:127:14: Unsupported: randsequence production
127 | main: repeat(10) count_1;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:128:17: Unsupported: randsequence production
128 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:126:7: Unsupported: randsequence
126 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:136:29: Unsupported: randsequence production id
136 | main: rand join count_1 count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:136:37: Unsupported: randsequence production id
136 | main: rand join count_1 count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:136:19: Unsupported: randsequence production list
136 | main: rand join count_1 count_2;
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:136:17: Unsupported: randsequence production
136 | main: rand join count_1 count_2;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:137:20: Unsupported: randsequence production
137 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:138:20: Unsupported: randsequence production
138 | count_2: { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:135:10: Unsupported: randsequence
135 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:148:35: Unsupported: randsequence production id
148 | main: rand join (1.0) count_1 count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:148:43: Unsupported: randsequence production id
148 | main: rand join (1.0) count_1 count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:148:19: Unsupported: randsequence production list
148 | main: rand join (1.0) count_1 count_2;
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:148:17: Unsupported: randsequence production
148 | main: rand join (1.0) count_1 count_2;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:149:20: Unsupported: randsequence production
149 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:150:20: Unsupported: randsequence production
150 | count_2: { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:147:10: Unsupported: randsequence
147 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:153:35: Unsupported: randsequence production id
153 | main: rand join (0.0) count_3 count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:153:43: Unsupported: randsequence production id
153 | main: rand join (0.0) count_3 count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:153:19: Unsupported: randsequence production list
153 | main: rand join (0.0) count_3 count_4;
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:153:17: Unsupported: randsequence production
153 | main: rand join (0.0) count_3 count_4;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:154:20: Unsupported: randsequence production
154 | count_3: { ++counts[3]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:155:20: Unsupported: randsequence production
155 | count_4: { ++counts[4]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:152:10: Unsupported: randsequence
152 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:168:19: Unsupported: randsequence production id
168 | main: count_1 check count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:168:27: Unsupported: randsequence production id
168 | main: count_1 check count_2;
| ^~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:168:33: Unsupported: randsequence production id
168 | main: count_1 check count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:168:17: Unsupported: randsequence production
168 | main: count_1 check count_2;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:169:20: Unsupported: randsequence production id
169 | check: count_3 { if (fiftyfifty) break; } count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:169:55: Unsupported: randsequence production id
169 | check: count_3 { if (fiftyfifty) break; } count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:169:18: Unsupported: randsequence production
169 | check: count_3 { if (fiftyfifty) break; } count_4;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:170:20: Unsupported: randsequence production
170 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:171:20: Unsupported: randsequence production
171 | count_2: { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:172:20: Unsupported: randsequence production
172 | count_3: { ++counts[3]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:173:20: Unsupported: randsequence production
173 | count_4: { ++counts[4]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:167:10: Unsupported: randsequence
167 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:186:19: Unsupported: randsequence production id
186 | main: count_1 check count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:186:27: Unsupported: randsequence production id
186 | main: count_1 check count_2;
| ^~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:186:33: Unsupported: randsequence production id
186 | main: count_1 check count_2;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:186:17: Unsupported: randsequence production
186 | main: count_1 check count_2;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:187:20: Unsupported: randsequence production id
187 | check: count_3 { if (fiftyfifty) return; } count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:187:56: Unsupported: randsequence production id
187 | check: count_3 { if (fiftyfifty) return; } count_4;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:187:18: Unsupported: randsequence production
187 | check: count_3 { if (fiftyfifty) return; } count_4;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:188:20: Unsupported: randsequence production
188 | count_1: { ++counts[1]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:189:20: Unsupported: randsequence production
189 | count_2: { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:190:20: Unsupported: randsequence production
190 | count_3: { ++counts[3]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:191:20: Unsupported: randsequence production
191 | count_4: { ++counts[4]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:185:10: Unsupported: randsequence
185 | randsequence(main)
| ^~~~~~~~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:203:19: Unsupported: randsequence production id
203 | main: f_1 f_2 f_3;
| ^~~
%Error-UNSUPPORTED: t/t_randsequence.v:203:23: Unsupported: randsequence production id
203 | main: f_1 f_2 f_3;
| ^~~
%Error-UNSUPPORTED: t/t_randsequence.v:203:27: Unsupported: randsequence production id
203 | main: f_1 f_2 f_3;
| ^~~
%Error-UNSUPPORTED: t/t_randsequence.v:203:17: Unsupported: randsequence production
203 | main: f_1 f_2 f_3;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:204:19: Unsupported: randsequence production id
204 | f_1 : func(10);
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:204:17: Unsupported: randsequence production
204 | f_1 : func(10);
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:205:19: Unsupported: randsequence production id
205 | f_2 : func(20);
| ^~~~
%Error-UNSUPPORTED: t/t_randsequence.v:205:17: Unsupported: randsequence production
205 | f_2 : func(20);
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:206:19: Unsupported: randsequence production id
206 | f_3 : fnoarg;
| ^~~~~~
%Error-UNSUPPORTED: t/t_randsequence.v:206:17: Unsupported: randsequence production
206 | f_3 : fnoarg;
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:207:30: Unsupported: randsequence production
207 | void func(int n) : { counts[1] += n; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:208:25: Unsupported: randsequence production
208 | void fnoarg : { ++counts[2]; };
| ^
%Error-UNSUPPORTED: t/t_randsequence.v:202:10: Unsupported: randsequence
202 | randsequence(main)
| ^~~~~~~~~~~~
%Error: Exiting due to

View File

@ -11,7 +11,9 @@ import vltest_bootstrap
test.scenarios('simulator')
test.compile(fails=test.vlt_all, expect_filename=test.golden_filename)
test.compile(verilator_flags2=['--error-limit 999'],
fails=test.vlt_all,
expect_filename=test.golden_filename)
if not test.vlt_all:
test.execute()

View File

@ -0,0 +1,3 @@
%Error: --pins-bv maximum is 65: 99
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = 't/t_EXAMPLE.v'
test.lint(verilator_flags2=["--pins-bv 99"], fails=True, expect_filename=test.golden_filename)
test.passes()