diff --git a/.travis.yml b/.travis.yml index 372eebe05..dd59d6f58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/ci/test.sh b/ci/test.sh index 6b72bc5cb..c39769723 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -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 diff --git a/test_regress/Makefile b/test_regress/Makefile index 82fff4a4d..e105ee9af 100644 --- a/test_regress/Makefile +++ b/test_regress/Makefile @@ -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) ###################################################################### diff --git a/test_regress/driver.pl b/test_regress/driver.pl index 1cb2c5536..1d967ba8c 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -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/I + +Split tests based on a hash of the test names into I and run only +tests in set number I (0..I-1). + =item --help Displays this message and program version and exits.