summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@googlemail.com>2016-10-24 20:07:08 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2016-10-24 11:07:08 -0700
commit8af9881e9b9b03c62f2a3d05daf9622139587169 (patch)
treef54aaa4d79cc275c078693af8a482fe26f839b54 /lib
parent9d3d49221442e102b59c3b273aecd8c95d6d0edf (diff)
downloadspack-8af9881e9b9b03c62f2a3d05daf9622139587169.tar.gz
spack-8af9881e9b9b03c62f2a3d05daf9622139587169.tar.bz2
spack-8af9881e9b9b03c62f2a3d05daf9622139587169.tar.xz
spack-8af9881e9b9b03c62f2a3d05daf9622139587169.zip
spack test : exits after ctrl+c fixes #2029 (#2082)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/__init__.py38
-rw-r--r--lib/spack/spack/test/tally_plugin.py4
2 files changed, 27 insertions, 15 deletions
diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py
index 0a946ff2ff..f6847d2929 100644
--- a/lib/spack/spack/test/__init__.py
+++ b/lib/spack/spack/test/__init__.py
@@ -107,25 +107,33 @@ def run(names, outputDir, verbose=False):
sys.exit(1)
tally = Tally()
- for test in names:
- module = 'spack.test.' + test
- print(module)
- tty.msg("Running test: %s" % test)
+ modules = ['spack.test.' + test for test in names]
+ runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name]
- runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name]
-
- if outputDir:
- xmlOutputFname = "unittests-{0}.xml".format(test)
- xmlOutputPath = join_path(outputDir, xmlOutputFname)
- runOpts += ["--with-xunit",
- "--xunit-file={0}".format(xmlOutputPath)]
- argv = [""] + runOpts + [module]
- nose.run(argv=argv, addplugins=[tally])
+ if outputDir:
+ xmlOutputFname = "unittests-{0}.xml".format(test)
+ xmlOutputPath = join_path(outputDir, xmlOutputFname)
+ runOpts += ["--with-xunit",
+ "--xunit-file={0}".format(xmlOutputPath)]
+ argv = [""] + runOpts + modules
+ nose.run(argv=argv, addplugins=[tally])
succeeded = not tally.failCount and not tally.errorCount
- tty.msg("Tests Complete.", "%5d tests run" % tally.numberOfTestsRun,
- "%5d failures" % tally.failCount, "%5d errors" % tally.errorCount)
+ tty.msg(
+ "Tests Complete.",
+ "%5d tests run" % tally.numberOfTestsRun,
+ "%5d failures" % tally.failCount,
+ "%5d errors" % tally.errorCount
+ )
+
+ if tally.fail_list:
+ items = [x for x in tally.fail_list]
+ tty.msg('List of failing tests:', *items)
+
+ if tally.error_list:
+ items = [x for x in tally.error_list]
+ tty.msg('List of tests with errors:', *items)
if succeeded:
tty.info("OK", format='g')
diff --git a/lib/spack/spack/test/tally_plugin.py b/lib/spack/spack/test/tally_plugin.py
index 808694d186..d848f2cb9f 100644
--- a/lib/spack/spack/test/tally_plugin.py
+++ b/lib/spack/spack/test/tally_plugin.py
@@ -35,6 +35,8 @@ class Tally(Plugin):
self.successCount = 0
self.failCount = 0
self.errorCount = 0
+ self.error_list = []
+ self.fail_list = []
@property
def numberOfTestsRun(self):
@@ -52,9 +54,11 @@ class Tally(Plugin):
def addError(self, test, err):
self.errorCount += 1
+ self.error_list.append(test)
def addFailure(self, test, err):
self.failCount += 1
+ self.fail_list.append(test)
def finalize(self, result):
pass