diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2015-10-13 10:41:47 -0700 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2015-10-13 10:41:47 -0700 |
commit | 1ce6d8b627fac204fc4a4500ea28b4733dd172dd (patch) | |
tree | e075898cdcad95a5ea11dd2bfcd2b3e53345a9ee | |
parent | 9f56d9c807d9d3efc7cde0591bd53d3db404dacc (diff) | |
download | spack-1ce6d8b627fac204fc4a4500ea28b4733dd172dd.tar.gz spack-1ce6d8b627fac204fc4a4500ea28b4733dd172dd.tar.bz2 spack-1ce6d8b627fac204fc4a4500ea28b4733dd172dd.tar.xz spack-1ce6d8b627fac204fc4a4500ea28b4733dd172dd.zip |
Add spec YAML format to test output.
-rw-r--r-- | lib/spack/spack/cmd/testinstall.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/spack/spack/cmd/testinstall.py b/lib/spack/spack/cmd/testinstall.py index 04e594c0b8..3a9e1e14e1 100644 --- a/lib/spack/spack/cmd/testinstall.py +++ b/lib/spack/spack/cmd/testinstall.py @@ -75,19 +75,19 @@ class JunitResultFormat(object): self.root = ET.Element('testsuite') self.tests = [] - def addTest(self, buildId, passed=True, buildLog=None): - self.tests.append((buildId, passed, buildLog)) + def addTest(self, buildId, passed=True, buildInfo=None): + self.tests.append((buildId, passed, buildInfo)) def writeTo(self, stream): self.root.set('tests', '{0}'.format(len(self.tests))) - for buildId, passed, buildLog in self.tests: + for buildId, passed, buildInfo in self.tests: testcase = ET.SubElement(self.root, 'testcase') testcase.set('classname', buildId.name) testcase.set('name', buildId.stringId()) if not passed: failure = ET.SubElement(testcase, 'failure') failure.set('type', "Build Error") - failure.text = buildLog + failure.text = buildInfo ET.ElementTree(self.root).write(stream) @@ -133,15 +133,18 @@ def testinstall(parser, args): bId = BuildId(spec.name, spec.version, spec.dag_hash()) if package.installed: - installLog = spack.install_layout.build_log_path(spec) + buildLogPath = spack.install_layout.build_log_path(spec) else: #TODO: search recursively under stage.path instead of only within # stage.source_path - installLog = join_path(package.stage.source_path, 'spack-build.out') + buildLogPath = join_path(package.stage.source_path, 'spack-build.out') - with open(installLog, 'rb') as F: + with open(buildLogPath, 'rb') as F: buildLog = F.read() #TODO: this may not return all output - jrf.addTest(bId, package.installed, buildLog) + #TODO: add the whole build log? it could be several thousand + # lines. It may be better to look for errors. + jrf.addTest(bId, package.installed, buildLogPath + '\n' + + spec.to_yaml() + buildLog) with open(args.output, 'wb') as F: jrf.writeTo(F) |