Add --quiet-exit, bug1436.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Todd Strader 2019-05-14 06:47:51 -04:00 committed by Wilson Snyder
parent 16997d153f
commit d0fbdfac07
4 changed files with 46 additions and 2 deletions

View File

@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
* Verilator 4.015 devel
*** Add --quiet-exit, bug1436. [Todd Strader]
**** Support VerilatedFstC set_time_unit, bug1433. [Pieter Kapsenberg]
**** Fix sign-compare warning in verilated.cpp, bug1437. [Sergey Kvachonok]

View File

@ -42,6 +42,7 @@ autoflush STDERR 1;
$Debug = 0;
my $opt_gdb;
my $opt_gdbbt;
my $opt_quiet_exit;
# No arguments can't do anything useful. Give help
if ($#ARGV < 0) {
@ -58,7 +59,7 @@ foreach my $sw (@ARGV) {
}
Getopt::Long::config("no_auto_abbrev","pass_through");
if (! GetOptions(
if (! GetOptions (
# Major operating modes
"help" => \&usage,
"debug:s" => \&debug,
@ -66,6 +67,7 @@ if (! GetOptions(
# Switches
"gdb!" => \$opt_gdb,
"gdbbt!" => \$opt_gdbbt,
"quiet-exit!" => \$opt_quiet_exit,
# Additional parameters
"<>" => sub {}, # Ignored
)) {
@ -195,7 +197,14 @@ sub run {
warn "%Error: Verilator threw signal $status. Consider trying --debug --gdbbt\n" if !$Debug;
}
}
die "%Error: Command Failed $command\n";
if ($opt_quiet_exit) {
# Same return code as die
exit $! if $!; # errno
exit $? >> 8 if $? >> 8; # child exit status
exit 255; # last resort
} else {
die "%Error: Command Failed $command\n";
}
}
}
@ -346,6 +355,7 @@ detailed descriptions in L</"VERILATION ARGUMENTS"> for more information.
--private Debugging; see docs
--public Debugging; see docs
-pvalue+<name>=<value> Overwrite toplevel parameter
--quiet-exit Don't print the command on failure
--relative-includes Resolve includes relative to current file
--no-relative-cfuncs Disallow 'this->' in generated functions
--report-unoptflat Extra diagnostics for UNOPTFLAT
@ -1157,6 +1167,10 @@ inlining. This will also turn off inlining as if all modules had a
Overwrites the given parameter(s) of the toplevel module. See -G for a
detailed description.
=item --quiet-exit
When exiting due to an error, do not display the "Command Failed" message.
=item --relative-includes
When a file references an include file, resolve the filename relative to

View File

@ -1014,6 +1014,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( !strcmp (sw, "-gdbbt")) {
// Used only in perl shell
}
else if ( !strcmp (sw, "-quiet-exit")) {
// Used only in perl shell
}
else if ( !strcmp (sw, "-mod-prefix") && (i+1)<argc ) {
shift; m_modPrefix = argv[i];
}

View File

@ -0,0 +1,25 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2019 by Todd Strader. 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_file_does_not_exist.v");
# Tests for the error message and then the absence of the
# "Command Failed" line
compile(
v_flags2 => ["--quiet-exit"],
fails => 1,
expect =>
'%Error: Exiting due to \d+ error\(s\)
((?!Command Failed).)*$',
);
ok(1);
1;