travis: run from a Makefile to parallelize testing

The travis tool itself runs all tests it is given in series. Use make
to parallelize running the tests, leaving a log in each subdirectory
in addition to the global log.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2026-06-30 22:48:38 -07:00
parent 7f69cf689c
commit 73abe9374b
5 changed files with 105 additions and 8 deletions

1
.gitignore vendored
View file

@ -100,6 +100,7 @@ TAGS
/test/testresults
/test/ffmpegtest
/test/x264test
/travis.mk
/version.h
/version.mac
/version.mak

View file

@ -574,15 +574,14 @@ golden: $(PROGS)
#
# Travis tests
#
travis_version = travis/_version/_version.stdout
travis: $(PROGS)
$(MAKE) -f travis.mk all
$(travis_version): version
printf 'NASM version %s compiled on ?\n' `cat version` > $@
clean-travis travis-clean:
$(MAKE) -f travis.mk clean
travis: $(PROGS) $(travis_version)
-$(PYTHON3) tools/travis/nasm-t.py run --stop=n > travis.log
@if $(GREP) FAIL travis.log; then exit 1; else \
echo '=== All tests PASS ==='; fi
update-travis travis-update:
$(MAKE) -f travis.mk update
#
# Rules to run autogen if necessary

View file

@ -371,5 +371,5 @@ dnl
PA_CHECK_BAD_STDC_INLINE
PA_C_TYPEOF
AC_CONFIG_FILES([Makefile doc/Makefile misc/Makefile test/Makefile])
AC_CONFIG_FILES([Makefile doc/Makefile misc/Makefile test/Makefile travis.mk])
AC_OUTPUT

24
tools/travis/findtests.pl Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/perl
use strict;
use integer;
use File::Find;
use File::Spec;
my($srcdir,$objdir,$subdir) = @ARGV;
my $base = File::Spec->catdir($srcdir, $subdir);
sub print_dir {
return if (! -d $_);
my($vol,$dirs) = File::Spec->splitpath($_, 1);
my @dirs = File::Spec->splitdir($dirs);
# $objdir really should be part of catfile, but that breaks our
# current "golden reference" files -- fix that at some point.
my $json = File::Spec->catfile(@dirs, $dirs[-1].'.json');
if ( -f $json ) {
print File::Spec->catfile($objdir, File::Spec->abs2rel($json, $srcdir)), "\n";
}
}
find({no_chdir => 1, wanted => \&print_dir}, $base);

73
travis.mk.in Normal file
View file

@ -0,0 +1,73 @@
# -*- makefile -*-
# SPDX-License-Identifier: BSD-2-Clause
#
# Makefile wrapper to parallelize running travis
#
# Run from the main Makefile with "make travis"
# This Makefile, unlike the main one, assumes GNU make or equivalent
#
srcdir = @srcdir@
objdir = @builddir@
VPATH = @srcdir@
PYTHON3 = @PYTHON3@
GREP = grep
tools = $(srcdir)/tools
PERL = perl
PERLFLAGS = -I$(srcdir)/perllib
RUNPERL = $(PERL) $(PERLFLAGS)
NASM = $(objdir)/nasm$(X)
PERL = perl
RUNPERL = $(PERL)
PYTHON3 = @PYTHON3@
GREP = grep
travistools = $(tools)/travis
TRAVIS = $(travistools)/nasm-t.py
testdir = travis
tests := $(shell $(RUNPERL) $(travistools)/findtests.pl $(srcdir) $(objdir) $(testdir))
logs = $(tests:.json=.log)
all: travis.log
@ ! $(GREP) FAIL travis.log && echo '=== All tests PASS ==='
.PRECIOUS: travis.log
travis.log: $(logs)
@cat $(logs) > travis.log
.PRECIOUS: %.log
%.log: $(NASM) %.json
@echo 'Running: $(@D)'
@$(PYTHON3) $(TRAVIS) -d $(srcdir)/$(@D) \
--nasm $(NASM) run --stop=n > $@
.PHONY: update
update: $(tests:.json=.update)
.PHONY: %.update
%.update:
@echo 'Updating: $(@D)'
@$(PYTHON3) $(TRAVIS) -d $(srcdir)/$(@D) --nasm $(NASM) update
#
# Generated files needed for some specific tests
# (If this ends up being a longer list, consider making subdirectory-
# specific Makefiles).
#
GENFILES = $(testdir)/_version/_version.stdout
$(testdir)/_version/_version.stdout: version
printf 'NASM version %s compiled on ?\n' `cat version` > $@
$(testdir)/_version/_version.log: $(testdir)/_version/_version.stdout
# XXX: need to clean up build artifacts, too
clean:
rm -f travis.log $(logs)