diff --git a/test_regress/driver.pl b/test_regress/driver.pl index eadd21b69..6367b69bd 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -2079,6 +2079,7 @@ sub files_identical { && !/^-node:/ && !/^dot [^\n]+\n/ && !/^In file: .*\/sc_.*:\d+/ + && !/^libgcov.*/ } @l1; @l1 = map { s/(Internal Error: [^\n]+\.cpp):[0-9]+:/$1:#:/; @@ -2318,6 +2319,21 @@ sub write_wholefile { my $fh = IO::File->new(">$filename") or die "%Error: $! writing $filename,"; print $fh $contents; $fh->close; + delete $_File_Contents_Cache{$filename}; +} + +sub file_sed { + my $self = (ref $_[0]? shift : $Self); + my $infilename = shift; + my $outfilename = shift; + my $editcb = shift; + my $contents = $self->file_contents($infilename); + { + $_ = $contents; + $editcb->($contents); + $contents = $_; + } + $self->write_wholefile($outfilename, $contents); } ####################################################################### diff --git a/test_regress/t/t_savable_format2_bad.pl b/test_regress/t/t_savable_format2_bad.pl index c87d9cc87..8a6e75248 100755 --- a/test_regress/t/t_savable_format2_bad.pl +++ b/test_regress/t/t_savable_format2_bad.pl @@ -25,7 +25,9 @@ execute( -r "$Self->{obj_dir}/saved.vltsv" or error("Saved.vltsv not created\n"); # Break the header -run(cmd => ["sed -i.bak 's/verilatorsave01/verilatorsavBAD/' $Self->{obj_dir}/saved.vltsv"]); +file_sed("$Self->{obj_dir}/saved.vltsv", + "$Self->{obj_dir}/saved.vltsv", + sub { s/verilatorsave01/verilatorsavBAD/g; }); execute( all_run_flags => ['+save_restore=1'], diff --git a/test_regress/t/t_savable_format3_bad.pl b/test_regress/t/t_savable_format3_bad.pl index a0cc865de..ce78e55f1 100755 --- a/test_regress/t/t_savable_format3_bad.pl +++ b/test_regress/t/t_savable_format3_bad.pl @@ -25,7 +25,9 @@ execute( -r "$Self->{obj_dir}/saved.vltsv" or error("Saved.vltsv not created\n"); # Break the header -run(cmd => ["sed -i.bak 's/vltsaved/vltNOTed/' $Self->{obj_dir}/saved.vltsv"]); +file_sed("$Self->{obj_dir}/saved.vltsv", + "$Self->{obj_dir}/saved.vltsv", + sub { s/vltsaved/vltNOTed/g; }); execute( all_run_flags => ['+save_restore=1'], diff --git a/test_regress/t/t_waiveroutput.pl b/test_regress/t/t_waiveroutput.pl index 08f77ed08..9559ffed7 100755 --- a/test_regress/t/t_waiveroutput.pl +++ b/test_regress/t/t_waiveroutput.pl @@ -20,7 +20,8 @@ compile( files_identical("$out_filename", $Self->{golden_filename}); -run(cmd=>["sed 's/\\/\\/ lint_off/lint_off/g' $out_filename > $waiver_filename"]); +file_sed($out_filename, $waiver_filename, + sub { s/\/\/ lint_off/lint_off/g; }); compile( v_flags2 => [$waiver_filename],