Tests: Fix CCache test not properly skipped (#3643)

If the skip condition happens, the rest still runs and it fails. Don't do that.
This commit is contained in:
Jake Merdich 2022-09-27 09:11:49 -04:00 committed by GitHub
parent 4931e48016
commit 1b18eee5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 27 deletions

View File

@ -44,6 +44,7 @@ HyungKi Jeong
Iru Cai
Ivan Vnučec
Iztok Jeras
Jake Merdich
James Hanlon
James Hutchinson
James Pallister

View File

@ -13,36 +13,37 @@ scenarios(vlt => 1);
if (!$Self->cfg_with_ccache) {
skip("Requires configuring with ccache");
}
else {
top_filename("t_a1_first_cc.v");
top_filename("t_a1_first_cc.v");
# This test requires rebuilding the object files to check the ccache log
foreach my $filename (glob("$Self->{obj_dir}/*.o")) {
print "rm $filename\n" if $Self->{verbose};
unlink $filename;
}
# This test requires rebuilding the object files to check the ccache log
foreach my $filename (glob("$Self->{obj_dir}/*.o")) {
print "rm $filename\n" if $Self->{verbose};
unlink $filename;
compile(
verilator_flags2 => ['--trace'],
make_flags => "ccache-report"
);
my $report = "$Self->{obj_dir}/$Self->{VM_PREFIX}__ccache_report.txt";
# We do not actually want to make this test depend on whether the file was
# cached or not, so trim the report to ignore actual caching behaviour
run(cmd => ["sed", "-i", "-e", "'s/ : .*/ : IGNORED/; /|/s/.*/IGNORED/;'", $report]);
files_identical($report, "t/$Self->{name}__ccache_report_initial.out");
# Now rebuild again (should be all up to date)
run(
logfile => "$Self->{obj_dir}/rebuild.log",
cmd => ["make", "-C", $Self->{obj_dir},
"-f", "$Self->{VM_PREFIX}.mk",
$Self->{VM_PREFIX}, "ccache-report"]
);
files_identical($report, "t/$Self->{name}__ccache_report_rebuild.out");
}
compile(
verilator_flags2 => ['--trace'],
make_flags => "ccache-report"
);
my $report = "$Self->{obj_dir}/$Self->{VM_PREFIX}__ccache_report.txt";
# We do not actually want to make this test depend on whether the file was
# cached or not, so trim the report to ignore actual caching behaviour
run(cmd => ["sed", "-i", "-e", "'s/ : .*/ : IGNORED/; /|/s/.*/IGNORED/;'", $report]);
files_identical($report, "t/$Self->{name}__ccache_report_initial.out");
# Now rebuild again (should be all up to date)
run(
logfile => "$Self->{obj_dir}/rebuild.log",
cmd => ["make", "-C", $Self->{obj_dir},
"-f", "$Self->{VM_PREFIX}.mk",
$Self->{VM_PREFIX}, "ccache-report"]
);
files_identical($report, "t/$Self->{name}__ccache_report_rebuild.out");
ok(1);
1;