From 5dbff89a903136b6cddd6b8b54777b31adb04676 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 29 Dec 2022 20:18:28 -0500 Subject: [PATCH] Internal line coverage fixes --- test_regress/t/t_array_pattern_bad2.out | 5 +++++ test_regress/t/t_array_pattern_bad2.pl | 19 +++++++++++++++++++ test_regress/t/t_array_pattern_bad2.v | 25 +++++++++++++++++++++++++ test_regress/t/t_dist_warn_coverage.pl | 8 ++------ test_regress/t/t_sys_fopen_bad.out | 4 ++++ test_regress/t/t_sys_fopen_bad.pl | 19 +++++++++++++++++++ test_regress/t/t_sys_fopen_bad.v | 17 +++++++++++++++++ 7 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 test_regress/t/t_array_pattern_bad2.out create mode 100755 test_regress/t/t_array_pattern_bad2.pl create mode 100644 test_regress/t/t_array_pattern_bad2.v create mode 100644 test_regress/t/t_sys_fopen_bad.out create mode 100755 test_regress/t/t_sys_fopen_bad.pl create mode 100644 test_regress/t/t_sys_fopen_bad.v diff --git a/test_regress/t/t_array_pattern_bad2.out b/test_regress/t/t_array_pattern_bad2.out new file mode 100644 index 000000000..bc5533253 --- /dev/null +++ b/test_regress/t/t_array_pattern_bad2.out @@ -0,0 +1,5 @@ +%Error: t/t_array_pattern_bad2.v:22:16: Multiple '{ default: } clauses + : ... In instance t + 22 | myinfo = '{default: '0, + | ^~ +%Error: Exiting due to diff --git a/test_regress/t/t_array_pattern_bad2.pl b/test_regress/t/t_array_pattern_bad2.pl new file mode 100755 index 000000000..a60503a1f --- /dev/null +++ b/test_regress/t/t_array_pattern_bad2.pl @@ -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; diff --git a/test_regress/t/t_array_pattern_bad2.v b/test_regress/t/t_array_pattern_bad2.v new file mode 100644 index 000000000..5401630bc --- /dev/null +++ b/test_regress/t/t_array_pattern_bad2.v @@ -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; + + typedef struct packed { + logic [3:0] port_num; + } info_t; + + info_t myinfo; + always_comb + myinfo = '{default: '0, + default: '1}; // Bad + +endmodule diff --git a/test_regress/t/t_dist_warn_coverage.pl b/test_regress/t/t_dist_warn_coverage.pl index 25a463a25..258b74a8f 100755 --- a/test_regress/t/t_dist_warn_coverage.pl +++ b/test_regress/t/t_dist_warn_coverage.pl @@ -23,6 +23,7 @@ my %Suppressed; foreach my $s ( ' exited with ', # Is hit; driver.pl filters out 'EOF in unterminated string', # Instead get normal unterminated + 'Enum names without values only allowed on numeric types', # Hard to hit 'Enum ranges must be integral, per spec', # Hard to hit 'Return with return value isn\'t underneath a function', # Hard to hit, get other bad return messages 'Select from non-array ', # Instead get type does not have a bit range @@ -32,8 +33,6 @@ foreach my $s ( # Not yet analyzed ' is not an in/out/inout/param/interface: ', ' loading non-variable', - '$fopen mode should be <= 4 characters', - '\'foreach\' loop variable expects simple variable name', '--pipe-filter protocol error, unexpected: ', '/*verilator sformat*/ can only be applied to last argument of ', 'Argument needed for string.', @@ -51,7 +50,6 @@ foreach my $s ( 'Circular logic when ordering code (non-cutable edge loop)', 'Deferred assertions must use \'#0\' (IEEE 1800-2017 16.4)', 'Define or directive not defined: `', - 'Enum names without values only allowed on numeric types', 'Exceeded limit of ', 'Extern declaration\'s scope is not a defined class', 'Format to $display-like function must have constant format string', @@ -67,7 +65,6 @@ foreach my $s ( 'Modport item not found: ', 'Modport not referenced as .', 'Modport not referenced from underneath an interface: ', - 'Multiple \'{ default: } clauses', 'Non-interface used as an interface: ', 'Not marked as function return var', 'Parameter not found in sub-module: Param ', @@ -88,7 +85,6 @@ foreach my $s ( 'Unknown `pragma', 'Unknown built-in event method ', 'Unsized numbers/parameters not allowed in streams.', - 'Unsupported LHS tristate construct: ', 'Unsupported RHS tristate construct: ', 'Unsupported or syntax error: Unsized range in instance or other declaration', 'Unsupported pullup/down (weak driver) construct.', @@ -98,7 +94,6 @@ foreach my $s ( 'Unsupported/unknown built-in dynamic array method ', 'Unsupported: $bits for queue', 'Unsupported: $c can\'t generate wider than 64 bits', - 'Unsupported: --no-structs-packed', 'Unsupported: 4-state numbers in this context', 'Unsupported: Concatenation to form ', 'Unsupported: Non-variable on LHS of built-in method \'', @@ -118,6 +113,7 @@ foreach my $s ( 'Unsupported: no_inline for tasks', 'Unsupported: static cast to ', 'Unsupported: super', + '\'foreach\' loop variable expects simple variable name', ) { $Suppressed{$s} = 1; } if (!-r "$root/.git") { diff --git a/test_regress/t/t_sys_fopen_bad.out b/test_regress/t/t_sys_fopen_bad.out new file mode 100644 index 000000000..b788b2245 --- /dev/null +++ b/test_regress/t/t_sys_fopen_bad.out @@ -0,0 +1,4 @@ +%Error: t/t_sys_fopen_bad.v:14:34: $fopen mode should be <= 4 characters + 14 | file = $fopen("/dev/null", "somereallywidebad"); + | ^~~~~~~~~~~~~~~~~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_sys_fopen_bad.pl b/test_regress/t/t_sys_fopen_bad.pl new file mode 100755 index 000000000..a5846c699 --- /dev/null +++ b/test_regress/t/t_sys_fopen_bad.pl @@ -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(vlt => 1); + +lint( + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_sys_fopen_bad.v b/test_regress/t/t_sys_fopen_bad.v new file mode 100644 index 000000000..9d633d4fe --- /dev/null +++ b/test_regress/t/t_sys_fopen_bad.v @@ -0,0 +1,17 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// Copyright 2022 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 (); + + integer file; + + initial begin + file = $fopen("/dev/null", "somereallywidebad"); + end + +endmodule