Tests: Call driver's run instead of private _run.

This commit is contained in:
Wilson Snyder 2017-09-23 08:50:39 -04:00
parent 3f14e649b5
commit 16234bb713
11 changed files with 75 additions and 71 deletions

View File

@ -908,6 +908,10 @@ sub sc {
#----------------------------------------------------------------------
sub run {
my $self = (ref $_[0]? shift : $Self);
$self->_run(@_);
}
sub _run {
my $self = (ref $_[0]? shift : $Self);
my %param = (tee=>1,

View File

@ -28,10 +28,10 @@ if ($Self->{nc}) {
$fh->printf("report_html -both -instance * > $Self->{obj_dir}/${name}__nccover.html\n");
$fh->close;
}
$Self->_run (logfile=>"$Self->{obj_dir}/${name}__nccover.log",
tee=>0,
cmd=>[($ENV{VERILATOR_ICCR}||'iccr'),
"-test ${name} ${cf}"]);
$Self->run(logfile=>"$Self->{obj_dir}/${name}__nccover.log",
tee=>0,
cmd=>[($ENV{VERILATOR_ICCR}||'iccr'),
"-test ${name} ${cf}"]);
}
file_grep ($Self->{run_log_filename}, qr/COVER: Cyc==4/);

View File

@ -32,11 +32,11 @@ $gmon_path = $_ foreach (glob "$Self->{obj_dir}/gmon.out.*");
$gmon_path or $Self->error("Profiler did not create a gmon.out");
(my $gmon_base = $gmon_path) =~ s!.*[/\\]!!;
$Self->_run(cmd=>["cd $Self->{obj_dir} && gprof $Self->{VM_PREFIX} $gmon_base > gprof.out"],
check_finished=>0);
$Self->run(cmd=>["cd $Self->{obj_dir} && gprof $Self->{VM_PREFIX} $gmon_base > gprof.out"],
check_finished=>0);
$Self->_run(cmd=>["cd $Self->{obj_dir} && $ENV{VERILATOR_ROOT}/bin/verilator_profcfunc gprof.out > cfuncs.out"],
check_finished=>0);
$Self->run(cmd=>["cd $Self->{obj_dir} && $ENV{VERILATOR_ROOT}/bin/verilator_profcfunc gprof.out > cfuncs.out"],
check_finished=>0);
file_grep ("$Self->{obj_dir}/cfuncs.out", qr/Overall summary by/);

View File

@ -10,20 +10,20 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
top_filename("t/t_cover_line.v");
compile (
verilator_flags2 => ['--cc --coverage-line'],
);
verilator_flags2 => ['--cc --coverage-line'],
);
execute (
check_finished=>1,
);
check_finished=>1,
);
# Read the input .v file and do any CHECK_COVER requests
inline_checks();
$Self->_run(cmd=>["../bin/verilator_coverage",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat",
],
$Self->run(cmd=>["../bin/verilator_coverage",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat",
],
);
ok(files_identical("$Self->{obj_dir}/annotated/t_cover_line.v", "t/t_cover_line.out"));

View File

@ -18,12 +18,12 @@ if (!-r "$root/.git") {
my $cwd = getcwd();
my $destdir = "$cwd/".$Self->{obj_dir};
# Start clean
$Self->_run(cmd=>["rm -rf $destdir && mkdir -p $destdir"],
check_finished=>0);
$Self->run(cmd=>["rm -rf $destdir && mkdir -p $destdir"],
check_finished=>0);
# Install into temp area
print "Install...\n";
$Self->_run (cmd=>["cd $root && make DESTDIR=$destdir install-all"],
check_finished=>0);
$Self->run(cmd=>["cd $root && make DESTDIR=$destdir install-all"],
check_finished=>0);
# Check we can run a test
# Unfortunately the prefix was hardcoded in the exec at a different place,
@ -32,8 +32,8 @@ if (!-r "$root/.git") {
# Uninstall
print "Uninstall...\n";
$Self->_run (cmd=>["cd $root && make DESTDIR=$destdir uninstall"],
check_finished=>0);
$Self->run(cmd=>["cd $root && make DESTDIR=$destdir uninstall"],
check_finished=>0);
# Check empty
my @files;

View File

@ -21,19 +21,19 @@ mkdir $child_dir;
verilator_flags => ["-cc", "-Mdir", "${child_dir}", "--debug-check"],
);
$Self->_run(logfile=>"${child_dir}/vlt_compile.log",
cmd=>\@cmdargs);
$Self->run(logfile=>"${child_dir}/vlt_compile.log",
cmd=>\@cmdargs);
$Self->_run(logfile=>"${child_dir}/vlt_gcc.log",
cmd=>["cd ${child_dir} && ",
"make", "-f".getcwd()."/Makefile_obj",
"CPPFLAGS_DRIVER=-D".uc($self->{name}),
($opt_verbose ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1":""),
"MAKE_MAIN=0",
"VM_PREFIX=$self->{VM_PREFIX}_child",
"V$self->{name}_child__ALL.a", # bypass default rule, make archive
($param{make_flags}||""),
]);
$Self->run(logfile=>"${child_dir}/vlt_gcc.log",
cmd=>["cd ${child_dir} && ",
"make", "-f".getcwd()."/Makefile_obj",
"CPPFLAGS_DRIVER=-D".uc($self->{name}),
($opt_verbose ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1":""),
"MAKE_MAIN=0",
"VM_PREFIX=$self->{VM_PREFIX}_child",
"V$self->{name}_child__ALL.a", # bypass default rule, make archive
($param{make_flags}||""),
]);
}
# Compile the parent (might be with other than verilator)

View File

@ -9,15 +9,15 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
$Self->{vlt} or $Self->skip("Verilator only test");
$Self->_run (cmd=>["cd $Self->{obj_dir}"
." && c++ -c ../../t/t_flag_ldflags_a.cpp"
." && ar r t_flag_ldflags_a.a t_flag_ldflags_a.o"
." && ranlib t_flag_ldflags_a.a "],
check_finished=>0);
$Self->_run (cmd=>["cd $Self->{obj_dir}"
." && c++ -fPIC -c ../../t/t_flag_ldflags_so.cpp"
." && c++ -shared -o t_flag_ldflags_so.so -lc t_flag_ldflags_so.o"],
check_finished=>0);
$Self->run(cmd=>["cd $Self->{obj_dir}"
." && c++ -c ../../t/t_flag_ldflags_a.cpp"
." && ar r t_flag_ldflags_a.a t_flag_ldflags_a.o"
." && ranlib t_flag_ldflags_a.a "],
check_finished=>0);
$Self->run(cmd=>["cd $Self->{obj_dir}"
." && c++ -fPIC -c ../../t/t_flag_ldflags_so.cpp"
." && c++ -shared -o t_flag_ldflags_so.so -lc t_flag_ldflags_so.o"],
check_finished=>0);
compile (
# Pass multiple -D's so we check quoting works properly

View File

@ -15,12 +15,12 @@ foreach my $prog (
"../bin/verilator_difftree",
"../bin/verilator_profcfunc",
) {
$Self->_run(fails=>1,
cmd=>["perl",$prog,
"--help"],
logfile=>"$Self->{obj_dir}/t_help.log",
tee=>0,
);
$Self->run(fails=>1,
cmd=>["perl",$prog,
"--help"],
logfile=>"$Self->{obj_dir}/t_help.log",
tee=>0,
);
file_grep ("$Self->{obj_dir}/t_help.log", qr/DISTRIBUTION/i);
}

View File

@ -9,13 +9,13 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
$Self->{vlt} or $Self->skip("Verilator only test");
$Self->_run(cmd=>["../bin/verilator_coverage",
"--write", "$Self->{obj_dir}/coverage.dat",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",
"t/t_vlcov_data_c.dat",
"t/t_vlcov_data_d.dat",
],
$Self->run(cmd=>["../bin/verilator_coverage",
"--write", "$Self->{obj_dir}/coverage.dat",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",
"t/t_vlcov_data_c.dat",
"t/t_vlcov_data_d.dat",
],
);
ok(files_identical("$Self->{obj_dir}/coverage.dat", "t/$Self->{name}.out"));
1;

View File

@ -9,15 +9,15 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
$Self->{vlt} or $Self->skip("Verilator only test");
$Self->_run(cmd=>["../bin/verilator_coverage",
"--rank",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",
"t/t_vlcov_data_c.dat",
"t/t_vlcov_data_d.dat",
],
logfile=>"$Self->{obj_dir}/vlcov.log",
tee => 0,
$Self->run(cmd=>["../bin/verilator_coverage",
"--rank",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",
"t/t_vlcov_data_c.dat",
"t/t_vlcov_data_d.dat",
],
logfile=>"$Self->{obj_dir}/vlcov.log",
tee => 0,
);
ok(files_identical("$Self->{obj_dir}/vlcov.log", "t/$Self->{name}.out"));
1;

View File

@ -14,12 +14,12 @@ foreach my $basename ("t_vlcov_data_a.dat",
"t_vlcov_data_c.dat",
"t_vlcov_data_d.dat",
) {
$Self->_run(cmd=>["../bin/verilator_coverage",
"t/${basename}",
"--write", "$Self->{obj_dir}/${basename}"
],
tee=>0,
);
$Self->run(cmd=>["../bin/verilator_coverage",
"t/${basename}",
"--write", "$Self->{obj_dir}/${basename}"
],
tee=>0,
);
ok(files_identical("$Self->{obj_dir}/${basename}", "t/${basename}"));
}
1;