forked from github/verilator
Internals: Fix misc internal coverage holes. No functional change intended.
This commit is contained in:
parent
8d61cd9029
commit
3243651c63
@ -3,3 +3,4 @@ exclude_paths:
|
|||||||
- '.github/**'
|
- '.github/**'
|
||||||
- 'ci/build_verilator.sh'
|
- 'ci/build_verilator.sh'
|
||||||
- 'include/vltstd/**'
|
- 'include/vltstd/**'
|
||||||
|
- 'nodist/fastcov.py'
|
||||||
|
@ -18,6 +18,7 @@ use vars qw($Debug);
|
|||||||
|
|
||||||
our $Opt_Stop = 1;
|
our $Opt_Stop = 1;
|
||||||
our $Opt_Fastcov = 1;
|
our $Opt_Fastcov = 1;
|
||||||
|
our $Exclude_Branch_Regexp;
|
||||||
our $Exclude_Line_Regexp;
|
our $Exclude_Line_Regexp;
|
||||||
our $Remove_Gcda_Regexp;
|
our $Remove_Gcda_Regexp;
|
||||||
|
|
||||||
@ -312,6 +313,7 @@ sub test {
|
|||||||
sub clone_sources {
|
sub clone_sources {
|
||||||
my $cc_dir = shift;
|
my $cc_dir = shift;
|
||||||
my $excluded_lines = 0;
|
my $excluded_lines = 0;
|
||||||
|
my $excluded_br_lines = 0;
|
||||||
foreach my $glob (@Source_Globs) {
|
foreach my $glob (@Source_Globs) {
|
||||||
foreach my $infile (glob $glob) {
|
foreach my $infile (glob $glob) {
|
||||||
$infile !~ m!^/!
|
$infile !~ m!^/!
|
||||||
@ -334,10 +336,15 @@ sub clone_sources {
|
|||||||
elsif ($line =~ /LCOV_EXCL_STOP/) {
|
elsif ($line =~ /LCOV_EXCL_STOP/) {
|
||||||
$line .= " LCOV_EXCL_BR_STOP";
|
$line .= " LCOV_EXCL_BR_STOP";
|
||||||
}
|
}
|
||||||
elsif ($line !~ m!// LCOV_EXCL_LINE!
|
elsif ($line =~ /$Exclude_Line_Regexp/) {
|
||||||
&& $line =~ /$Exclude_Line_Regexp/) {
|
|
||||||
$line .= " //code_coverage: // LCOV_EXCL_LINE LCOV_EXCL_BR_LINE";
|
$line .= " //code_coverage: // LCOV_EXCL_LINE LCOV_EXCL_BR_LINE";
|
||||||
$excluded_lines++;
|
$excluded_lines++;
|
||||||
|
$excluded_br_lines++;
|
||||||
|
#print "$infile:$lineno: $line";
|
||||||
|
}
|
||||||
|
elsif ($line =~ /$Exclude_Branch_Regexp/) {
|
||||||
|
$line .= " //code_coverage: // LCOV_EXCL_BR_LINE";
|
||||||
|
$excluded_br_lines++;
|
||||||
#print "$infile:$lineno: $line";
|
#print "$infile:$lineno: $line";
|
||||||
}
|
}
|
||||||
$ofh->print("$line\n");
|
$ofh->print("$line\n");
|
||||||
@ -345,6 +352,7 @@ sub clone_sources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "Number of source lines automatically LCOV_EXCL_LINE'ed: $excluded_lines\n";
|
print "Number of source lines automatically LCOV_EXCL_LINE'ed: $excluded_lines\n";
|
||||||
|
print "Number of source lines automatically LCOV_EXCL_BR_LINE'ed: $excluded_br_lines\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cleanup_abs_paths_info {
|
sub cleanup_abs_paths_info {
|
||||||
@ -388,6 +396,9 @@ sub cleanup_abs_paths_json {
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# .dat file callbacks
|
# .dat file callbacks
|
||||||
|
|
||||||
|
sub exclude_branch_regexp {
|
||||||
|
$Exclude_Branch_Regexp = shift;
|
||||||
|
}
|
||||||
sub exclude_line_regexp {
|
sub exclude_line_regexp {
|
||||||
$Exclude_Line_Regexp = shift;
|
$Exclude_Line_Regexp = shift;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ remove_source("*examples/*");
|
|||||||
# Would just be removed with remove_source in later step
|
# Would just be removed with remove_source in later step
|
||||||
remove_gcda_regexp(qr!test_regress/.*/(Vt_|Vtop_).*\.gcda!);
|
remove_gcda_regexp(qr!test_regress/.*/(Vt_|Vtop_).*\.gcda!);
|
||||||
|
|
||||||
|
# Exclude line entirely, also excludes from function and branch coverage
|
||||||
exclude_line_regexp(qr/(\bv3fatalSrc\b
|
exclude_line_regexp(qr/(\bv3fatalSrc\b
|
||||||
|\bfatalSrc\b
|
|\bfatalSrc\b
|
||||||
|\bVL_UNCOVERABLE\b
|
|\bVL_UNCOVERABLE\b
|
||||||
@ -51,4 +52,7 @@ exclude_line_regexp(qr/(\bv3fatalSrc\b
|
|||||||
|\bV3ERROR_NA
|
|\bV3ERROR_NA
|
||||||
|\bUINFO\b)/x);
|
|\bUINFO\b)/x);
|
||||||
|
|
||||||
|
# Exclude for branch coverage only
|
||||||
|
exclude_branch_regexp(qr/(\bdebug\(\))/x);
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -280,13 +280,13 @@ private:
|
|||||||
// IF(msb-1, 01, 00))
|
// IF(msb-1, 01, 00))
|
||||||
AstNode* cexprp = nodep->exprp()->unlinkFrBack();
|
AstNode* cexprp = nodep->exprp()->unlinkFrBack();
|
||||||
|
|
||||||
if (debug() >= 9) {
|
if (debug() >= 9) { // LCOV_EXCL_START
|
||||||
for (uint32_t i = 0; i < (1UL << m_caseWidth); ++i) {
|
for (uint32_t i = 0; i < (1UL << m_caseWidth); ++i) {
|
||||||
if (AstNode* itemp = m_valueItem[i]) {
|
if (AstNode* itemp = m_valueItem[i]) {
|
||||||
UINFO(9, "Value " << std::hex << i << " " << itemp << endl);
|
UINFO(9, "Value " << std::hex << i << " " << itemp << endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // LCOV_EXCL_STOP
|
||||||
|
|
||||||
// Handle any assertions
|
// Handle any assertions
|
||||||
replaceCaseParallel(nodep, m_caseNoOverlapsAllCovered);
|
replaceCaseParallel(nodep, m_caseNoOverlapsAllCovered);
|
||||||
|
@ -390,14 +390,14 @@ string FileLine::warnOther() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string FileLine::source() const {
|
string FileLine::source() const {
|
||||||
if (VL_UNCOVERABLE(!m_contentp)) {
|
if (VL_UNCOVERABLE(!m_contentp)) { // LCOV_EXCL_START
|
||||||
if (debug() || v3Global.opt.debugCheck()) {
|
if (debug() || v3Global.opt.debugCheck()) {
|
||||||
// The newline here is to work around the " <line#> | "
|
// The newline here is to work around the " <line#> | "
|
||||||
return "\n%Error: internal tracking of file contents failed";
|
return "\n%Error: internal tracking of file contents failed";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
} // LCOV_EXCL_STOP
|
||||||
return m_contentp->getLine(m_contentLineno);
|
return m_contentp->getLine(m_contentLineno);
|
||||||
}
|
}
|
||||||
string FileLine::prettySource() const {
|
string FileLine::prettySource() const {
|
||||||
|
@ -329,9 +329,9 @@ void V3Options::fileNfsFlush(const string& filename) {
|
|||||||
// NFS caches stat() calls so to get up-to-date information must
|
// NFS caches stat() calls so to get up-to-date information must
|
||||||
// do a open or opendir on the filename.
|
// do a open or opendir on the filename.
|
||||||
// Faster to just try both rather than check if a file is a dir.
|
// Faster to just try both rather than check if a file is a dir.
|
||||||
if (DIR* dirp = opendir(filename.c_str())) {
|
if (DIR* dirp = opendir(filename.c_str())) { // LCOV_EXCL_BR_LINE
|
||||||
closedir(dirp); // LCOV_EXCL_LINE
|
closedir(dirp); // LCOV_EXCL_LINE
|
||||||
} else if (int fd = ::open(filename.c_str(), O_RDONLY)) {
|
} else if (int fd = ::open(filename.c_str(), O_RDONLY)) { // LCOV_EXCL_BR_LINE
|
||||||
if (fd > 0) ::close(fd);
|
if (fd > 0) ::close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -667,13 +667,13 @@ string V3Options::protectKeyDefaulted() {
|
|||||||
return m_protectKey;
|
return m_protectKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Options::throwSigsegv() {
|
void V3Options::throwSigsegv() { // LCOV_EXCL_START
|
||||||
#if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__))
|
#if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__))
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{ char* zp = NULL; *zp = 0; } // Intentional core dump, ignore warnings here
|
{ char* zp = NULL; *zp = 0; } // Intentional core dump, ignore warnings here
|
||||||
// clang-format on
|
// clang-format on
|
||||||
#endif
|
#endif
|
||||||
}
|
} // LCOV_EXCL_STOP
|
||||||
|
|
||||||
VTimescale V3Options::timeComputePrec(const VTimescale& flag) const {
|
VTimescale V3Options::timeComputePrec(const VTimescale& flag) const {
|
||||||
if (!timeOverridePrec().isNone()) {
|
if (!timeOverridePrec().isNone()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user