Skip to content

Commit 51dce26

Browse files
author
H. Peter Anvin (Intel)
committed
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>
1 parent a398a41 commit 51dce26

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed

Makefile.in

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ RUNPERL = $(PERL) $(PERLFLAGS)
6060
EMPTY = : >
6161
SIDE = @: Generated by side effect
6262

63-
PYTHON3 = python3
63+
PYTHON3 = @PYTHON3@
6464

6565
INSTALL = @INSTALL@
6666
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -108,7 +108,7 @@ PHONY =
108108

109109
.PHONY: all doc misc install clean distclean cleaner spotless test
110110
.PHONY: install_doc everything install_everything strip perlreq warnings
111-
.PHONY: dist tags TAGS nothing manpages nsis editors
111+
.PHONY: dist tags TAGS nothing manpages nsis editors travis
112112

113113
.c.$(O):
114114
$(CC) -c $(ALL_CFLAGS) -o $@ $<
@@ -569,8 +569,16 @@ golden: $(PROGS)
569569
cd $(srcdir)/test && \
570570
$(RUNPERL) performtest.pl --golden --nasm=../nasm$(X) *.asm
571571

572-
travis: $(PROGS)
573-
$(PYTHON3) travis/nasm-t.py run
572+
#
573+
# Travis tests
574+
#
575+
travis_version = travis/test/_version.stdout
576+
577+
$(travis_version): version
578+
printf 'NASM version %s compiled on ?\n' `cat version` > $@
579+
580+
travis: $(PROGS) $(travis_version)
581+
$(PYTHON3) travis/nasm-t.py run > travis.log
574582

575583
#
576584
# Rules to run autogen if necessary

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ AC_CHECK_PROGS([NROFF], nroff, false)
9595
AC_CHECK_PROGS([ASCIIDOC], asciidoc, false)
9696
AC_CHECK_PROGS([XMLTO], xmlto, false)
9797
AC_CHECK_PROGS([XZ], xz, false)
98+
AC_CHECK_PROGS([PYTHON3], [python3 python], false)
9899

99100
dnl Check for progs needed for manpage generation
100101
MANPAGES=manpages

travis/nasm-t.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ def test_run(desc):
405405
return False
406406

407407
for t in desc['target']:
408+
f = None
409+
if 'filter' in t:
410+
f = t['filter']
411+
f_pat = re.compile(f['match'], re.M)
412+
f_sub = f['subst']
413+
408414
if 'output' in t:
409415
output = desc['_base-dir'] + os.sep + t['output']
410416
match = desc['_base-dir'] + os.sep + t['match']
@@ -420,7 +426,10 @@ def test_run(desc):
420426
match_data = read_stdfile(match)
421427
if match_data == None:
422428
return test_fail(test, "Can't read " + match)
423-
if cmp_std(match, match_data, 'stdout', stdout) == False:
429+
out_data = stdout
430+
if f:
431+
out_data = f_pat.sub(f_sub, out_data, 0)
432+
if cmp_std(match, match_data, 'stdout', out_data) == False:
424433
return test_fail(desc['_test-name'], "Stdout mismatch")
425434
else:
426435
stdout = ""
@@ -430,7 +439,10 @@ def test_run(desc):
430439
match_data = read_stdfile(match)
431440
if match_data == None:
432441
return test_fail(test, "Can't read " + match)
433-
if cmp_std(match, match_data, 'stderr', stderr) == False:
442+
out_data = stderr
443+
if f:
444+
out_data = f_pat.sub(f_sub, out_data, 0)
445+
if cmp_std(match, match_data, 'stderr', out_data) == False:
434446
return test_fail(desc['_test-name'], "Stderr mismatch")
435447
else:
436448
stderr = ""

travis/test/_version.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
2-
"description": "Check the NASM version",
3-
"target": [
4-
{ "option": "-v", "stdout": "_version.stdout" }
5-
],
6-
"error": "over"
2+
"description": "Check the NASM version",
3+
"target": [
4+
{ "option": "-v", "stdout": "_version.stdout",
5+
"filter": {
6+
"match": "(compiled on )\\S.*$",
7+
"subst": "\\1?"
8+
}
9+
}
10+
],
11+
"error": "over"
712
}

travis/test/_version.stdout

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)