Test driver: Move one_test, no functional change.

This commit is contained in:
Wilson Snyder 2019-06-29 13:37:01 -04:00
parent 8d63f83177
commit dddcfeb482

View File

@ -150,61 +150,6 @@ foreach my $testpl (@opt_tests) {
$Fork->wait_all(); # Wait for all children to finish
sub one_test {
my @params = @_;
my %params = (@params);
$LeftCnt++;
$Fork->schedule
(
test_pl_filename => $params{pl_filename},
run_on_start => sub {
# Running in context of child, so can't pass data to parent directly
print("="x70,"\n");
my $test = VTest->new(@params);
$test->oprint("="x50,"\n");
unlink $test->{status_filename};
$test->_prep;
$test->_read;
# Don't put anything other than _exit after _read,
# as may call _exit via another path
$test->_exit;
},
run_on_finish => sub {
# RUnning in context of parent
my $test = VTest->new(@params);
$test->_read_status;
if ($test->ok) {
$OkCnt++;
} elsif ($test->scenario_off && !$test->errors) {
} elsif ($test->skips && !$test->errors) {
$SkipCnt++;
} elsif ($test->unsupporteds && !$test->errors) {
$UnsupCnt++;
} else {
$test->oprint("FAILED: ","*"x60,"\n");
my $j = ($opt_jobs>1?" -j":"");
my $makecmd = $ENV{VERILATOR_MAKE} || "make$j &&";
push @fails, ("\t#".$test->soprint("%Error: $test->{errors}\n")
."\t\t$makecmd test_regress/"
.$test->{pl_filename}
." ".join(' ', _args_scenario())
." --".$test->{scenario}."\n");
$FailCnt++;
report(\@fails, $Log_Filename);
my $other = "";
foreach my $proc ($Fork->running) {
$other .= " ".$proc->{test_pl_filename};
}
$test->oprint("Simultaneous running tests:",$other,"\n") if $other;
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
}
$LeftCnt--;
my $LeftMsg = $::Have_Forker ? $LeftCnt : "NO-FORKER";
print STDERR "==SUMMARY: Left $LeftMsg Passed $OkCnt Unsup $UnsupCnt Skipped $SkipCnt Failed $FailCnt\n";
},
)->ready();
}
report(\@fails, undef);
report(\@fails, $Log_Filename);
@ -269,6 +214,61 @@ sub calc_jobs {
return $ok + 1;
}
sub one_test {
my @params = @_;
my %params = (@params);
$LeftCnt++;
$Fork->schedule
(
test_pl_filename => $params{pl_filename},
run_on_start => sub {
# Running in context of child, so can't pass data to parent directly
print("="x70,"\n");
my $test = VTest->new(@params);
$test->oprint("="x50,"\n");
unlink $test->{status_filename};
$test->_prep;
$test->_read;
# Don't put anything other than _exit after _read,
# as may call _exit via another path
$test->_exit;
},
run_on_finish => sub {
# RUnning in context of parent
my $test = VTest->new(@params);
$test->_read_status;
if ($test->ok) {
$OkCnt++;
} elsif ($test->scenario_off && !$test->errors) {
} elsif ($test->skips && !$test->errors) {
$SkipCnt++;
} elsif ($test->unsupporteds && !$test->errors) {
$UnsupCnt++;
} else {
$test->oprint("FAILED: ","*"x60,"\n");
my $j = ($opt_jobs>1?" -j":"");
my $makecmd = $ENV{VERILATOR_MAKE} || "make$j &&";
push @fails, ("\t#".$test->soprint("%Error: $test->{errors}\n")
."\t\t$makecmd test_regress/"
.$test->{pl_filename}
." ".join(' ', _args_scenario())
." --".$test->{scenario}."\n");
$FailCnt++;
report(\@fails, $Log_Filename);
my $other = "";
foreach my $proc ($Fork->running) {
$other .= " ".$proc->{test_pl_filename};
}
$test->oprint("Simultaneous running tests:",$other,"\n") if $other;
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
}
$LeftCnt--;
my $LeftMsg = $::Have_Forker ? $LeftCnt : "NO-FORKER";
print STDERR "==SUMMARY: Left $LeftMsg Passed $OkCnt Unsup $UnsupCnt Skipped $SkipCnt Failed $FailCnt\n";
},
)->ready();
}
sub report {
my $fails = shift;
my $filename = shift;