3
# Thomas Nagy, 2005 (ita)
4
# Yinon Ehrlich, 2008, 2009
19
# allow importing from wafadmin dir.
20
wafadmin = os.path.join(os.path.abspath(os.path.pardir), DIRS.WAFADMIN)
21
waftools = os.path.join(wafadmin, DIRS.TOOLS)
22
sys.path = [wafadmin, waftools] + sys.path
28
writelines = sys.stderr.write
31
Utils.pprint('CYAN', msg)
33
def testname(file, tests_dir='test'):
34
test_file=os.path.join(tests_dir, file)
35
return open(test_file, 'r')
39
verbose = Options.options.verbose
43
tests_modules = '''configure_test build_dir cxx_test gcc_test ar_test
44
wscript_errors_test scripting build options task_gen'''.split()
51
curdir = os.path.dirname(__file__)
52
sys.path.append(curdir)
54
for test in tests_modules:
55
mod = imp.load_source(test, os.path.join(curdir, test + '.py'))
56
writelines("******** %s ********\n" % mod.__name__)
58
# run_tests return a TestResult instance
59
result = mod.run_tests(verbose)
60
total += result.testsRun
62
# accumulate results for future stat etc.
63
if not result.wasSuccessful():
64
not_passed += (result.failures + result.errors)
66
# TODO: all_results is not used now, may be used for further investigation...
67
all_results.append(result)
69
writelines('\n' + '='*80 + '\n')
71
# for t in not_passed:
72
# writelines( "%s: %s\n" % (t[0]._testMethodName, t[1]) )
73
writelines( "\n%d (out of %d) tests didn't passed !" % (len(not_passed), total) )
75
writelines( "\nall tests (%d) passed successfully !\n" % total )
78
writelines('\nall tests took %.2f seconds.\n' % elapsed)
79
writelines('='*80 + '\n')
82
return len(not_passed)
85
if __name__ == "__main__":
87
os.chdir(os.path.pardir)