Update test failure output: don't include the entire build log, just lines which

mention errors (or if no such lines can be found, output the last 10 lines from
the log).
This commit is contained in:
Peter Scheibel 2015-10-15 12:23:56 -07:00
parent b9bf0b942c
commit c985ad7644

View File

@ -25,6 +25,7 @@
from external import argparse from external import argparse
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import itertools import itertools
import re
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.filesystem import * from llnl.util.filesystem import *
@ -104,11 +105,15 @@ def create_test_output(topSpec, newInstalls, output):
buildLogPath = join_path(package.stage.source_path, 'spack-build.out') buildLogPath = join_path(package.stage.source_path, 'spack-build.out')
with open(buildLogPath, 'rb') as F: with open(buildLogPath, 'rb') as F:
buildLog = F.read() #TODO: this may not return all output lines = F.readlines()
#TODO: add the whole build log? it could be several thousand errMessages = list(line for line in lines if
# lines. It may be better to look for errors. re.search('error:', line, re.IGNORECASE))
output.add_test(bId, package.installed, buildLogPath + '\n' + errOutput = errMessages if errMessages else lines[-10:]
spec.to_yaml() + buildLog) errOutput = '\n'.join(itertools.chain(
[spec.to_yaml(), "Errors:"], errOutput,
["Build Log:", buildLogPath]))
output.add_test(bId, package.installed, errOutput)
def test_install(parser, args): def test_install(parser, args):