mirror of
https://github.com/verilator/verilator.git
synced 2025-04-29 20:16:53 +00:00
Tests: Add golden_filename.
This commit is contained in:
parent
d396c55e34
commit
6cd2bd2972
@ -433,7 +433,8 @@ sub new {
|
|||||||
$self->{run_log_filename} ||= "$self->{obj_dir}/vlt_sim.log";
|
$self->{run_log_filename} ||= "$self->{obj_dir}/vlt_sim.log";
|
||||||
$self->{coverage_filename} ||= "$self->{obj_dir}/coverage.dat";
|
$self->{coverage_filename} ||= "$self->{obj_dir}/coverage.dat";
|
||||||
$self->{main_filename} ||= "$self->{obj_dir}/$self->{VM_PREFIX}__main.cpp";
|
$self->{main_filename} ||= "$self->{obj_dir}/$self->{VM_PREFIX}__main.cpp";
|
||||||
($self->{top_filename} = $self->{pl_filename}) =~ s/\.pl$//;
|
($self->{top_filename} ||= $self->{pl_filename}) =~ s/\.pl$//;
|
||||||
|
($self->{golden_filename} ||= $self->{pl_filename}) =~ s/\.pl$/.out/;
|
||||||
if (-e ($self->{top_filename}.".vhd")) { # If VHDL file exists
|
if (-e ($self->{top_filename}.".vhd")) { # If VHDL file exists
|
||||||
$self->{vhdl} = 1;
|
$self->{vhdl} = 1;
|
||||||
$self->{top_filename} .= ".vhd";
|
$self->{top_filename} .= ".vhd";
|
||||||
|
@ -9,8 +9,6 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
|
|
||||||
scenarios(simulator => 1);
|
scenarios(simulator => 1);
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
verilator_flags2 => ["--stats --O3 -x-assign fast"],
|
verilator_flags2 => ["--stats --O3 -x-assign fast"],
|
||||||
);
|
);
|
||||||
@ -19,5 +17,5 @@ execute(
|
|||||||
check_finished => 1,
|
check_finished => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_out}));
|
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename}));
|
||||||
1;
|
1;
|
||||||
|
@ -9,8 +9,6 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
|
|
||||||
scenarios(simulator => 1);
|
scenarios(simulator => 1);
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
verilator_flags2 => ["--stats --O3 -x-assign fast"],
|
verilator_flags2 => ["--stats --O3 -x-assign fast"],
|
||||||
);
|
);
|
||||||
@ -19,6 +17,6 @@ execute(
|
|||||||
check_finished => 1,
|
check_finished => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_out}));
|
ok(files_identical("$Self->{obj_dir}/$Self->{name}_logger.log", $Self->{golden_filename}));
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -9,7 +9,6 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
|
|
||||||
scenarios(vlt => 1);
|
scenarios(vlt => 1);
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
@ -17,6 +16,6 @@ compile(
|
|||||||
verilator_make_gcc => 0,
|
verilator_make_gcc => 0,
|
||||||
stdout_filename => $stdout_filename,
|
stdout_filename => $stdout_filename,
|
||||||
);
|
);
|
||||||
ok(files_identical($stdout_filename, $Self->{golden_out}));
|
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -9,7 +9,6 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
|
|
||||||
scenarios(vlt => 1);
|
scenarios(vlt => 1);
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
@ -19,7 +18,7 @@ compile(
|
|||||||
);
|
);
|
||||||
|
|
||||||
ok(preproc_check($Self->{top_filename}, $stdout_filename)
|
ok(preproc_check($Self->{top_filename}, $stdout_filename)
|
||||||
&& files_identical($stdout_filename, $Self->{golden_out}));
|
&& files_identical($stdout_filename, $Self->{golden_filename}));
|
||||||
|
|
||||||
sub preproc_check {
|
sub preproc_check {
|
||||||
my $filename1 = shift;
|
my $filename1 = shift;
|
||||||
|
@ -11,7 +11,6 @@ scenarios(vlt => 1);
|
|||||||
|
|
||||||
top_filename("t/t_preproc.v");
|
top_filename("t/t_preproc.v");
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
@ -20,6 +19,6 @@ compile(
|
|||||||
stdout_filename => $stdout_filename,
|
stdout_filename => $stdout_filename,
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(files_identical($stdout_filename, $Self->{golden_out}));
|
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -11,7 +11,6 @@ scenarios(vlt => 1);
|
|||||||
|
|
||||||
top_filename("t/t_preproc.v");
|
top_filename("t/t_preproc.v");
|
||||||
|
|
||||||
$Self->{golden_out} ||= "t/$Self->{name}.out";
|
|
||||||
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
my $stdout_filename = "$Self->{obj_dir}/$Self->{name}__test.vpp";
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
@ -20,6 +19,6 @@ compile(
|
|||||||
stdout_filename => $stdout_filename,
|
stdout_filename => $stdout_filename,
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(files_identical($stdout_filename, $Self->{golden_out}));
|
ok(files_identical($stdout_filename, $Self->{golden_filename}));
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -7,15 +7,14 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
|
||||||
scenarios(simulator => 1);
|
scenarios(vlt => 1);
|
||||||
|
|
||||||
top_filename("$Self->{obj_dir}/$Self->{name}.v");
|
top_filename("$Self->{obj_dir}/$Self->{name}.v");
|
||||||
|
$Self->{golden_filename} = "$Self->{obj_dir}/$Self->{name}.out";
|
||||||
|
|
||||||
# Rather then having to maintain a new .v and .out, simply add returns
|
# Rather then having to maintain a new .v and .out, simply add returns
|
||||||
# to all lines of the existing t_preproc test.
|
# to all lines of the existing t_preproc test.
|
||||||
|
|
||||||
$Self->{golden_out} = "$Self->{obj_dir}/$Self->{name}.out";
|
|
||||||
|
|
||||||
{
|
{
|
||||||
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.v");
|
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.v");
|
||||||
$wholefile =~ s/\n/\r\n/og;
|
$wholefile =~ s/\n/\r\n/og;
|
||||||
@ -24,7 +23,7 @@ $Self->{golden_out} = "$Self->{obj_dir}/$Self->{name}.out";
|
|||||||
{
|
{
|
||||||
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.out");
|
my $wholefile = file_contents("$Self->{t_dir}/t_preproc.out");
|
||||||
$wholefile =~ s!t/t_preproc.v!$Self->{obj_dir}/t_preproc_dos.v!og; # Fix `line's
|
$wholefile =~ s!t/t_preproc.v!$Self->{obj_dir}/t_preproc_dos.v!og; # Fix `line's
|
||||||
write_wholefile($Self->{golden_out}, $wholefile);
|
write_wholefile($Self->{golden_filename}, $wholefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
do 't/t_preproc.pl';
|
do 't/t_preproc.pl';
|
||||||
|
Loading…
Reference in New Issue
Block a user