X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FCompileCheck.py;h=95358a112897d3f0ed85c33fad1931e5bc8a9a5f;hb=bd9f9d3fd6fbcff0112a7bf48ab9284da9576b11;hp=171578f5934fa5089e7fb59f54569a004dd7ac46;hpb=259da4c692259311c6ec99566b57f5ed1e68e93e;p=senf.git diff --git a/senfscons/CompileCheck.py b/senfscons/CompileCheck.py index 171578f..95358a1 100644 --- a/senfscons/CompileCheck.py +++ b/senfscons/CompileCheck.py @@ -1,4 +1,5 @@ import os, os.path, sys +import tempfile from SCons.Script import * import SCons.Scanner.C @@ -14,25 +15,44 @@ def scanTests(f): elif line.startswith('}') and name and start: tests[name] = (start, linenr) return tests - + def CompileCheck(target, source, env): tests = scanTests(file(source[0].abspath)) - errf = os.popen(env.subst('$CXXCOM -DCOMPILE_CHECK 2>&1', source=source, target=target)) + cenv = env.Clone() + cenv.Append( CPPDEFINES = { 'COMPILE_CHECK': '' } ) + out = tempfile.TemporaryFile() + cenv['SPAWN'] = lambda sh, escape, cmd, args, env, pspawn=cenv['PSPAWN'], out=out: \ + pspawn(sh, escape, cmd, args, env, out, out) + Action('$CXXCOM').execute(target, source, cenv) passedTests = {} - for error in errf: + delay_name = None + out.seek(0) + for error in out.read().splitlines(): elts = error.split(':',2) if len(elts) != 3 : continue filename, line, message = elts if not os.path.exists(filename) : continue try: line = int(line) except ValueError : continue + message = message.strip() + + if delay_name and not message.startswith('instantiated from '): + print "Passed test '%s': %s" % (delay_name, message) + delay_name = None + continue + filename = os.path.abspath(filename) if filename != source[0].abspath : continue for name,lines in tests.iteritems(): if line >= lines[0] and line <= lines[1]: passedTests[name] = 1 - print "Passed test '%s': %s" % (name, message.strip()) + if message.startswith('instantiated from '): + delay_name = name + else: + print "Passed test '%s': %s" % (name, message) + if delay_name: + print "Passed test '%s': " % delay_name failedTests = set(tests.iterkeys()) - set(passedTests.iterkeys()) if failedTests: for test in failedTests: @@ -51,7 +71,7 @@ def generate(env): builder = env.Builder( action = CompileCheck, - suffix = '.tsto', + suffix = '.checked', src_suffix = '.cc', source_scanner = SCons.Scanner.C.CScanner(), single_source=1