travis improvements: look for python3, log output, option to filter

Use autoconf to find either python3 or python.

Add option to travis to filter the contents of stdout or stderr.

Generate the _version.stdout travis matching file from the version
file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2025-10-08 12:56:00 -07:00
parent a398a41f0a
commit 51dce26137
5 changed files with 37 additions and 12 deletions

View file

@ -60,7 +60,7 @@ RUNPERL = $(PERL) $(PERLFLAGS)
EMPTY = : >
SIDE = @: Generated by side effect
PYTHON3 = python3
PYTHON3 = @PYTHON3@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -108,7 +108,7 @@ PHONY =
.PHONY: all doc misc install clean distclean cleaner spotless test
.PHONY: install_doc everything install_everything strip perlreq warnings
.PHONY: dist tags TAGS nothing manpages nsis editors
.PHONY: dist tags TAGS nothing manpages nsis editors travis
.c.$(O):
$(CC) -c $(ALL_CFLAGS) -o $@ $<
@ -569,8 +569,16 @@ golden: $(PROGS)
cd $(srcdir)/test && \
$(RUNPERL) performtest.pl --golden --nasm=../nasm$(X) *.asm
travis: $(PROGS)
$(PYTHON3) travis/nasm-t.py run
#
# Travis tests
#
travis_version = travis/test/_version.stdout
$(travis_version): version
printf 'NASM version %s compiled on ?\n' `cat version` > $@
travis: $(PROGS) $(travis_version)
$(PYTHON3) travis/nasm-t.py run > travis.log
#
# Rules to run autogen if necessary

View file

@ -95,6 +95,7 @@ AC_CHECK_PROGS([NROFF], nroff, false)
AC_CHECK_PROGS([ASCIIDOC], asciidoc, false)
AC_CHECK_PROGS([XMLTO], xmlto, false)
AC_CHECK_PROGS([XZ], xz, false)
AC_CHECK_PROGS([PYTHON3], [python3 python], false)
dnl Check for progs needed for manpage generation
MANPAGES=manpages

View file

@ -405,6 +405,12 @@ def test_run(desc):
return False
for t in desc['target']:
f = None
if 'filter' in t:
f = t['filter']
f_pat = re.compile(f['match'], re.M)
f_sub = f['subst']
if 'output' in t:
output = desc['_base-dir'] + os.sep + t['output']
match = desc['_base-dir'] + os.sep + t['match']
@ -420,7 +426,10 @@ def test_run(desc):
match_data = read_stdfile(match)
if match_data == None:
return test_fail(test, "Can't read " + match)
if cmp_std(match, match_data, 'stdout', stdout) == False:
out_data = stdout
if f:
out_data = f_pat.sub(f_sub, out_data, 0)
if cmp_std(match, match_data, 'stdout', out_data) == False:
return test_fail(desc['_test-name'], "Stdout mismatch")
else:
stdout = ""
@ -430,7 +439,10 @@ def test_run(desc):
match_data = read_stdfile(match)
if match_data == None:
return test_fail(test, "Can't read " + match)
if cmp_std(match, match_data, 'stderr', stderr) == False:
out_data = stderr
if f:
out_data = f_pat.sub(f_sub, out_data, 0)
if cmp_std(match, match_data, 'stderr', out_data) == False:
return test_fail(desc['_test-name'], "Stderr mismatch")
else:
stderr = ""

View file

@ -1,7 +1,12 @@
{
"description": "Check the NASM version",
"target": [
{ "option": "-v", "stdout": "_version.stdout" }
],
"error": "over"
"description": "Check the NASM version",
"target": [
{ "option": "-v", "stdout": "_version.stdout",
"filter": {
"match": "(compiled on )\\S.*$",
"subst": "\\1?"
}
}
],
"error": "over"
}

View file

@ -1 +0,0 @@
NASM version 2.16rc0 compiled on Jul 3 2020