Tests: Have files_identical fail on error
This commit is contained in:
parent
64f11251b6
commit
689e4cf1d3
|
|
@ -1543,18 +1543,21 @@ sub verilator_version {
|
|||
# File utilities
|
||||
|
||||
sub files_identical {
|
||||
my $self = (ref $_[0]? shift : $Self);
|
||||
my $fn1 = shift;
|
||||
my $fn2 = shift;
|
||||
my $f1 = IO::File->new("<$fn1"); if (!$f1) { warn "%Error: $! $fn1\n"; return 0; }
|
||||
my $f2 = IO::File->new("<$fn2"); if (!$f2) { warn "%Error: $! $fn2\n"; return 0; }
|
||||
my $f1 = IO::File->new("<$fn1");
|
||||
my $f2 = IO::File->new("<$fn2");
|
||||
if (!$f1) { $self->error("Files_identical file does not exist $fn1\n"); return 0; }
|
||||
if (!$f2) { $self->error("Files_identical file does not exist $fn2\n"); return 0; }
|
||||
my @l1 = $f1->getlines();
|
||||
my @l2 = $f2->getlines();
|
||||
my $nl = $#l1; $nl = $#l2 if ($#l2 > $nl);
|
||||
for (my $l=0; $l<=$nl; $l++) {
|
||||
if (($l1[$l]||"") ne ($l2[$l]||"")) {
|
||||
warn ("%Warning: Line ".($l+1)." mismatches; $fn1 != $fn2\n"
|
||||
."F1: ".($l1[$l]||"*EOF*\n")
|
||||
."F2: ".($l2[$l]||"*EOF*\n"));
|
||||
$self->error("Line ".($l+1)." mismatches; $fn1 != $fn2");
|
||||
warn("F1: ".($l1[$l]||"*EOF*\n")
|
||||
."F2: ".($l2[$l]||"*EOF*\n"));
|
||||
if ($ENV{HARNESS_UPDATE_GOLDEN}) { # Update golden files with current
|
||||
warn "%Warning: HARNESS_UPDATE_GOLDEN set: cp $fn1 $fn2\n";
|
||||
eval "use File::Copy;";
|
||||
|
|
@ -1572,8 +1575,8 @@ sub vcd_identical {
|
|||
my $self = (ref $_[0]? shift : $Self);
|
||||
my $fn1 = shift;
|
||||
my $fn2 = shift;
|
||||
if (!-r $fn1) { $self->error("File does not exist $fn1\n"); return 0; }
|
||||
if (!-r $fn2) { $self->error("File does not exist $fn2\n"); return 0; }
|
||||
if (!-r $fn1) { $self->error("Vcd_identical file does not exist $fn1\n"); return 0; }
|
||||
if (!-r $fn2) { $self->error("Vcd_identical file does not exist $fn2\n"); return 0; }
|
||||
{
|
||||
# vcddiff to check transitions, if installed
|
||||
my $cmd = qq{vcddiff --help};
|
||||
|
|
|
|||
|
|
@ -17,5 +17,7 @@ execute(
|
|||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename}));
|
||||
files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ execute(
|
|||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename}));
|
||||
files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ run(cmd => ["../bin/verilator_coverage",
|
|||
"$Self->{obj_dir}/coverage.dat",
|
||||
]);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/annotated/t_cover_line.v", "t/t_cover_line.out"));
|
||||
files_identical("$Self->{obj_dir}/annotated/t_cover_line.v", "t/t_cover_line.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ compile(
|
|||
verilator_make_gcc => 0,
|
||||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||
|
||||
files_identical($stdout_filename, $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(preproc_check($Self->{top_filename}, $stdout_filename)
|
||||
&& files_identical($stdout_filename, $Self->{golden_filename}));
|
||||
preproc_check($Self->{top_filename}, $stdout_filename);
|
||||
files_identical($stdout_filename, $Self->{golden_filename});
|
||||
ok(1);
|
||||
|
||||
sub preproc_check {
|
||||
my $filename1 = shift;
|
||||
|
|
@ -53,7 +54,6 @@ sub preproc_check {
|
|||
$fh->close;
|
||||
}
|
||||
if ($Line_Checks[0]) { error("$filename2: Missing a Line_Preproc_Check\n"); }
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||
files_identical($stdout_filename, $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, "t/$Self->{name}.out"));
|
||||
files_identical($stdout_filename, "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||
files_identical($stdout_filename, $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, "t/$Self->{name}.out"));
|
||||
files_identical($stdout_filename, "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, "t/$Self->{name}.out"));
|
||||
files_identical($stdout_filename, "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ compile(
|
|||
stdout_filename => $stdout_filename,
|
||||
);
|
||||
|
||||
ok(files_identical($stdout_filename, "t/$Self->{name}.out"));
|
||||
files_identical($stdout_filename, "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
-V{t0,1}- Verilated::debug is on. Message prefix indicates {<thread>,<sequence_number>}.
|
||||
-V{t0,2}+ Vt_verilated_debug::_ctor_var_reset
|
||||
-V{t0,3}+ Vt_verilated_debug::_eval_initial
|
||||
-V{t0,4}+ Vt_verilated_debug::_eval_settle
|
||||
-V{t0,5}+ Vt_verilated_debug::_eval
|
||||
-V{t0,6}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,7}+++++TOP Evaluate Vt_verilated_debug::eval
|
||||
-V{t0,8}+ Clock loop
|
||||
-V{t0,9}+ Vt_verilated_debug::_eval
|
||||
-V{t0,10}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,11}+++++TOP Evaluate Vt_verilated_debug::eval
|
||||
-V{t0,12}+ Clock loop
|
||||
-V{t0,13}+ Vt_verilated_debug::_eval
|
||||
-V{t0,14}+ Vt_verilated_debug::_sequent__TOP__1
|
||||
-V{t0,3}+++++TOP Evaluate Vt_verilated_debug::eval
|
||||
-V{t0,4}+ Vt_verilated_debug::_eval_debug_assertions
|
||||
-V{t0,5}+ Vt_verilated_debug::_eval_initial
|
||||
-V{t0,6}+ Vt_verilated_debug::_eval_settle
|
||||
-V{t0,7}+ Vt_verilated_debug::_eval
|
||||
-V{t0,8}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,9}+ Clock loop
|
||||
-V{t0,10}+ Vt_verilated_debug::_eval
|
||||
-V{t0,11}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,12}+++++TOP Evaluate Vt_verilated_debug::eval
|
||||
-V{t0,13}+ Vt_verilated_debug::_eval_debug_assertions
|
||||
-V{t0,14}+ Clock loop
|
||||
-V{t0,15}+ Vt_verilated_debug::_eval
|
||||
-V{t0,16}+ Vt_verilated_debug::_sequent__TOP__1
|
||||
*-* All Finished *-*
|
||||
- t/t_verilated_debug.v:16: Verilog $finish
|
||||
-V{t0,15}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,16}+ Vt_verilated_debug::final
|
||||
-V{t0,17}+ Vt_verilated_debug::_change_request
|
||||
-V{t0,18}+ Vt_verilated_debug::final
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ execute(
|
|||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/vlt_sim.log", "t/$Self->{name}.out"));
|
||||
if (!$Self->{vltmt}) { # vltmt output may vary between thread exec order
|
||||
files_identical("$Self->{obj_dir}/vlt_sim.log", "t/$Self->{name}.out");
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -27,5 +27,7 @@ run(cmd => ["sort",
|
|||
"> $Self->{obj_dir}/coverage-sort.dat",
|
||||
]);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/coverage-sort.dat", "t/$Self->{name}.out"));
|
||||
files_identical("$Self->{obj_dir}/coverage-sort.dat", "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -20,5 +20,7 @@ run(cmd => ["../bin/verilator_coverage",
|
|||
tee => 0,
|
||||
);
|
||||
|
||||
ok(files_identical("$Self->{obj_dir}/vlcov.log", "t/$Self->{name}.out"));
|
||||
files_identical("$Self->{obj_dir}/vlcov.log", "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ foreach my $basename ("t_vlcov_data_a.dat",
|
|||
],
|
||||
tee => 0,
|
||||
);
|
||||
ok(files_identical("$Self->{obj_dir}/${basename}", "t/${basename}"));
|
||||
files_identical("$Self->{obj_dir}/${basename}", "t/${basename}");
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ compile(
|
|||
verilator_make_gcc => 0,
|
||||
);
|
||||
|
||||
ok(files_identical("$out_filename", "t/$Self->{name}.out"));
|
||||
files_identical("$out_filename", "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@ compile(
|
|||
verilator_make_gcc => 0,
|
||||
);
|
||||
|
||||
ok(files_identical("$out_filename", "t/$Self->{name}.out"));
|
||||
files_identical("$out_filename", "t/$Self->{name}.out");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue