Tests: Add setenv method.

This commit is contained in:
Wilson Snyder 2020-05-23 22:24:26 -04:00
parent a7432bdea7
commit c9e59e767a
5 changed files with 16 additions and 6 deletions

View File

@ -374,10 +374,12 @@ sub one_test {
$test->oprint("FAILED: $test->{errors}\n");
my $j = ($opt_jobs>1?" -j":"");
my $makecmd = $ENV{VERILATOR_MAKE} || "make$j &&";
my $upperdir = (Cwd::getcwd() =~ /test_regress/
? 'test_regress/' : '');
push @{$self->{fail_msgs}},
("\t#".$test->soprint("%Error: $test->{errors}\n")
."\t\t$makecmd test_regress/"
.$test->{pl_filename}
."\t\t$makecmd "
.$upperdir.$test->{pl_filename}
." ".join(' ', _manual_args())
." --".$test->{scenario}."\n");
push @{$self->{fail_tests}}, $test;
@ -1298,6 +1300,14 @@ sub execute {
}
}
sub setenv {
my $self = (ref $_[0]? shift : $Self);
my $var = shift;
my $val = shift;
print "\texport $var='$val'\n";
$ENV{$var} = $val;
}
sub inline_checks {
my $self = (ref $_[0]? shift : $Self);
return 1 if $self->errors || $self->skips || $self->unsupporteds;

View File

@ -20,7 +20,7 @@ file_grep($Self->{stats}, qr/Optimizations, Tables created\s+(\d+)/i, 10);
file_grep($Self->{stats}, qr/Optimizations, Combined CFuncs\s+(\d+)/i, 10);
unlink $_ foreach (glob "$Self->{obj_dir}/gmon.out.*");
$ENV{GMON_OUT_PREFIX} = "$Self->{obj_dir}/gmon.out";
setenv('GMON_OUT_PREFIX', "$Self->{obj_dir}/gmon.out");
execute(
check_finished => 1,

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
$ENV{FOOBARTEST} = "gotit";
setenv('FOOBARTEST', "gotit");
run(
cmd => ["../bin/verilator --getenv FOOBARTEST"],

View File

@ -22,7 +22,7 @@ scenarios(vlt => 1);
sleep(2); # Or else it might take < 1 second to compile and see no diff.
$ENV{VERILATOR_DEBUG_SKIP_IDENTICAL} = 1;
setenv('VERILATOR_DEBUG_SKIP_IDENTICAL', 1);
compile();
my @newstats = stat($outfile);

View File

@ -24,7 +24,7 @@ run(cmd => ["../bin/verilator_coverage",
# really care about ordering. So avoid false failures by sorting.
# Set LC_ALL as suggested in the sort manpage to avoid sort order
# changes from the locale.
$ENV{LC_ALL} = "C";
setenv('LC_ALL', "C");
run(cmd => ["sort",
"$Self->{obj_dir}/coverage.dat",
"> $Self->{obj_dir}/coverage-sort.dat",