Tests: file_grep prints failing expected value when possible.

This commit is contained in:
Wilson Snyder 2012-05-11 18:24:49 -04:00
parent b429319bc0
commit 3087501b6c
9 changed files with 15 additions and 10 deletions

View File

@ -1363,7 +1363,9 @@ sub file_grep_not {
my $self = (ref $_[0]? shift : $Self);
my $filename = shift;
my $regexp = shift;
my $expvalue = shift;
return if $self->errors || $self->skips || $self->unsupporteds;
!defined $expvalue or $self->error("file_grep_not: Unexpected 3rd argument: $expvalue");
my $contents = $self->file_contents($filename);
return if ($contents eq "_Already_Errored_");
@ -1376,12 +1378,15 @@ sub file_grep {
my $self = (ref $_[0]? shift : $Self);
my $filename = shift;
my $regexp = shift;
my $expvalue = shift;
return if $self->errors || $self->skips || $self->unsupporteds;
my $contents = $self->file_contents($filename);
return if ($contents eq "_Already_Errored_");
if ($contents !~ /$regexp/) {
$self->error("File_grep: $filename: Regexp not found: $regexp\n");
} elsif ($expvalue && $expvalue ne $1) {
$self->error("File_grep: $filename: Got='$1' Expected='$expvalue' in regexp: $regexp\n");
}
}

View File

@ -12,7 +12,7 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Split always\s+6/i);
file_grep ($Self->{stats}, qr/Optimizations, Split always\s+(\d+)/i, 6);
}
execute (

View File

@ -12,7 +12,7 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Split always\s+0/i);
file_grep ($Self->{stats}, qr/Optimizations, Split always\s+(\d+)/i, 0);
}
execute (

View File

@ -12,8 +12,8 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Tables created\s+10/i);
file_grep ($Self->{stats}, qr/Optimizations, Combined CFuncs\s+10/i);
file_grep ($Self->{stats}, qr/Optimizations, Tables created\s+(\d+)/i, 10);
file_grep ($Self->{stats}, qr/Optimizations, Combined CFuncs\s+(\d+)/i, 10);
}
execute (

View File

@ -17,7 +17,7 @@ execute (
if ($Self->{vlt}) {
#Optimization is disabled
#file_grep ($Self->{stats}, qr/Optimizations, Gaters inserted\s+3/i);
#file_grep ($Self->{stats}, qr/Optimizations, Gaters inserted\s+(\d+)/i, 3);
}
ok(1);

View File

@ -18,7 +18,7 @@ execute (
# Read the input .v file and do any CHECK_COVER requests
inline_checks();
file_grep ($Self->{stats}, qr/Coverage, Toggle points joined\s+24/i)
file_grep ($Self->{stats}, qr/Coverage, Toggle points joined\s+(\d+)/i, 23)
if $Self->{vlt};
ok(1);

View File

@ -14,7 +14,7 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Combined CFuncs\s+16/i);
file_grep ($Self->{stats}, qr/Optimizations, Combined CFuncs\s+(\d+)/i, 16);
}
execute (

View File

@ -12,7 +12,7 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Delayed shared-sets\s+14/i);
file_grep ($Self->{stats}, qr/Optimizations, Delayed shared-sets\s+(\d+)/i, 14);
}
execute (

View File

@ -12,8 +12,8 @@ compile (
);
if ($Self->{vlt}) {
file_grep ($Self->{stats}, qr/Optimizations, Lifetime assign deletions\s+4/i);
file_grep ($Self->{stats}, qr/Optimizations, Lifetime constant prop\s+2/i);
file_grep ($Self->{stats}, qr/Optimizations, Lifetime assign deletions\s+(\d+)/i, 4);
file_grep ($Self->{stats}, qr/Optimizations, Lifetime constant prop\s+(\d+)/i, 2);
}
execute (