SConscript (8889:2e38fd9937a9) | SConscript (8947:217fbc57df05) |
---|---|
1# -*- mode:python -*- 2 3# Copyright (c) 2004-2006 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33import sys, time 34import glob 35from SCons.Script.SConscript import SConsEnvironment 36 37Import('env') 38 39env['DIFFOUT'] = File('diff-out') 40 | 1# -*- mode:python -*- 2 3# Copyright (c) 2004-2006 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33import sys, time 34import glob 35from SCons.Script.SConscript import SConsEnvironment 36 37Import('env') 38 39env['DIFFOUT'] = File('diff-out') 40 |
41# get the termcap from the environment 42termcap = env['TERMCAP'] 43 |
|
41# Dict that accumulates lists of tests by category (quick, medium, long) 42env.Tests = {} 43 44def contents(node): 45 return file(str(node)).read() 46 47# functions to parse return value from scons Execute()... not the same 48# as wait() etc., so python built-in os funcs don't work. --- 117 unchanged lines hidden (view full) --- 166 167def run_test_string(target, source, env): 168 return env.subst("Running test in ${TARGETS[0].dir}.", 169 target=target, source=source) 170 171testAction = env.Action(run_test, run_test_string) 172 173def print_test(target, source, env): | 44# Dict that accumulates lists of tests by category (quick, medium, long) 45env.Tests = {} 46 47def contents(node): 48 return file(str(node)).read() 49 50# functions to parse return value from scons Execute()... not the same 51# as wait() etc., so python built-in os funcs don't work. --- 117 unchanged lines hidden (view full) --- 169 170def run_test_string(target, source, env): 171 return env.subst("Running test in ${TARGETS[0].dir}.", 172 target=target, source=source) 173 174testAction = env.Action(run_test, run_test_string) 175 176def print_test(target, source, env): |
174 print '***** ' + contents(source[0]) | 177 # print the status with colours to make it easier to see what 178 # passed and what failed 179 line = contents(source[0]) 180 181 # split the line to words and get the last one 182 words = line.split() 183 status = words[-1] 184 185 # if the test failed make it red, if it passed make it green, and 186 # skip the punctuation 187 if status == "FAILED!": 188 status = termcap.Red + status[:-1] + termcap.Normal + status[-1] 189 elif status == "passed.": 190 status = termcap.Green + status[:-1] + termcap.Normal + status[-1] 191 192 # put it back in the list and join with space 193 words[-1] = status 194 line = " ".join(words) 195 196 print '***** ' + line |
175 return 0 176 177printAction = env.Action(print_test, strfunction = None) 178 179# Static vars for update_test: 180# - long-winded message about ignored sources 181ignore_msg = ''' 182Note: The following file(s) will not be copied. New non-standard --- 129 unchanged lines hidden --- | 197 return 0 198 199printAction = env.Action(print_test, strfunction = None) 200 201# Static vars for update_test: 202# - long-winded message about ignored sources 203ignore_msg = ''' 204Note: The following file(s) will not be copied. New non-standard --- 129 unchanged lines hidden --- |