From dddcfeb48264a0f7ff7439f228d0e69e96980fd8 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 29 Jun 2019 13:37:01 -0400 Subject: [PATCH] Test driver: Move one_test, no functional change. --- test_regress/driver.pl | 110 ++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/test_regress/driver.pl b/test_regress/driver.pl index 6e437e570..3f5ac3e4b 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -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;