Tests: Add driver --hashset for Travis.

This commit is contained in:
Wilson Snyder 2020-03-07 21:38:44 -05:00
parent e2dec043a0
commit 328fef8190
4 changed files with 43 additions and 3 deletions

View File

@ -59,9 +59,14 @@ jobs:
script: ci/test.sh vlt
- if: type != cron
stage: test
name: Vltmt test
name: Vltmt set 0 test
compiler: gcc
script: ci/test.sh vltmt
script: ci/test.sh vltmt0
- if: type != cron
stage: test
name: Vltmt set 1 test
compiler: gcc
script: ci/test.sh vltmt1
# Cron builds try different OS/compiler combinations
- if: type = cron
stage: "Build Verilator"

View File

@ -19,6 +19,12 @@ case $1 in
vltmt)
make -C test_regress SCENARIOS=--vltmt
;;
vltmt0)
make -C test_regress SCENARIOS=--vltmt HASHSET=--hashset=0/2
;;
vltmt1)
make -C test_regress SCENARIOS=--vltmt HASHSET=--hashset=1/2
;;
*)
echo "Usage: test.sh (dist|vlt|vltmt)"
exit -1

View File

@ -43,10 +43,11 @@ endif
######################################################################
SCENARIOS ?= --vlt --vltmt --dist
DRIVER_HASHSET ?=
.PHONY: test
test:
$(PERL) driver.pl $(DRIVER_FLAGS) $(SCENARIOS)
$(PERL) driver.pl $(DRIVER_FLAGS) $(SCENARIOS) $(DRIVER_HASHSET)
######################################################################

View File

@ -66,6 +66,7 @@ my $opt_gdb;
my $opt_rr;
my $opt_gdbbt;
my $opt_gdbsim;
my $opt_hashset;
my $opt_jobs = 1;
my $opt_optimize;
my $opt_quiet;
@ -90,6 +91,7 @@ if (! GetOptions(
"gdbbt!" => \$opt_gdbbt,
"gdbsim!" => \$opt_gdbsim,
"golden!" => sub { $ENV{HARNESS_UPDATE_GOLDEN} = 1; },
"hashset=s" => \$opt_hashset,
"help" => \&usage,
"j=i" => \$opt_jobs,
"optimize:s" => \$opt_optimize,
@ -141,6 +143,8 @@ if ($#opt_tests<0) { # Run everything
push @opt_tests, sort(glob("${dir}/t_*.pl"));
}
}
@opt_tests = _calc_hashset(@opt_tests) if $opt_hashset;
if ($#opt_tests>=2 && $opt_jobs>=2) {
# Without this tests such as t_debug_sigsegv_bt_bad.pl will occasionally
# block on input and cause a SIGSTOP, then a "fg" was needed to resume testing.
@ -261,6 +265,25 @@ sub calc_jobs {
return $ok + 1;
}
sub _calc_hashset {
my @in = @_;
return @in if !$opt_hashset;
$opt_hashset =~ m!^(\d+)/(\d+)$!
or die "%Error: Need number/number format for --hashset: $opt_hashset\n";
my ($set, $nsets) = ($1, $2);
my @new;
foreach my $t (@opt_tests) {
my $checksum = do {
local $/;
unpack("%32W*", $t);
};
if ($set == ($checksum % $nsets)) {
push @new, $t;
}
}
return @new;
}
#######################################################################
#######################################################################
#######################################################################
@ -2503,6 +2526,11 @@ Run Verilator generated executable under the debugger.
Update golden files, equivalent to setting HARNESS_UPDATE_GOLDEN=1.
=item --hashset I<set>/I<numsets>
Split tests based on a hash of the test names into I<numsets> and run only
tests in set number I<set> (0..I<numsets>-1).
=item --help
Displays this message and program version and exits.