Skip to content

Commit

Permalink
Update testharness to archive failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrper committed May 24, 2018
1 parent b8acaa3 commit 7ab620a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ endif

# Thread count for make test.
THREADS=1
TESTHARNESS_OPTIONS=""

EXCLUDE_TAGS =
ifneq (@HAVE_ZOLTAN@,yes)
Expand Down Expand Up @@ -437,10 +438,10 @@ distclean: clean
test: serialtest

serialtest: fltools bin/$(FLUIDITY)
@cd tests; ../bin/testharness -x test_results.xml -l short $(EXCLUDE_TAGS) -n $(THREADS)
@cd tests; ../bin/testharness -x test_results.xml -l short $(EXCLUDE_TAGS) -n $(THREADS) $(TESTHARNESS_OPTIONS)

mediumtest: fltools bin/$(FLUIDITY) manual spudtools
@cd tests; ../bin/testharness -x test_results_medium.xml -l medium $(EXCLUDE_TAGS) -n $(THREADS)
@cd tests; ../bin/testharness -x test_results_medium.xml -l medium $(EXCLUDE_TAGS) -n $(THREADS) $(TESTHARNESS_OPTIONS)

.PHONY: spudtools

Expand Down
20 changes: 19 additions & 1 deletion tools/testharness.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, length="any", parallel="any", exclude_tags=None,
self.cwd=os.getcwd()
self.xml_outfile=xml_outfile
self.exit_fails=exit_fails

fluidity_command = self.decide_fluidity_command()

if file == "":
Expand Down Expand Up @@ -387,6 +387,19 @@ def list(self):
for (subdir, test) in self.tests:
print os.path.join(subdir, test.filename)

def archive_failures(self, filename):
""" Archive tests with warnings or failures as a gzip compressed tarfile"""
if self.failcount+self.warncount == 0:
print("No failures.")
return
import tarfile
print os.path.join(self.cwd, filename)
with open(os.path.join(self.cwd ,filename), "w") as fobj:
with tarfile.open(mode="w:gz", fileobj=fobj) as out:
for (subdir, test) in self.tests:
if test.pass_status.count('F')+test.pass_status.count('W')>0:
print("Adding %s"%subdir)
out.add(subdir)

if __name__ == "__main__":
import optparse
Expand All @@ -408,6 +421,7 @@ def list(self):
parser.add_option("--just-list", action="store_true", dest="justlist")
parser.add_option("--genpbs", action="store_true", dest="genpbs")
parser.add_option("-x","--xml-output", dest="xml_outfile", default="", help="filename for xml output")
parser.add_option("-a","--archive-failures", dest="archive_failures", default="", help="Archive test directories with failures to gzipped tar file.")
parser.add_option("--exit-failure-count", action="store_true", dest="exit_fails", help="Return failure count on exit")
(options, args) = parser.parse_args()

Expand Down Expand Up @@ -474,3 +488,7 @@ def list(self):
print "-" * 80

testharness.run()

if options.archive_failures:
print("Archiving to %s"%options.archive_failures)
testharness.archive_failures(options.archive_failures)

0 comments on commit 7ab620a

Please sign in to comment.