'''Create a UnitTest'''
all = []
- def __init__(self, target, *sources):
+ def __init__(self, target, *sources, **kwargs):
'''Specify the target name and any sources. Sources that are
not SourceFiles are evalued with Source(). All files are
guarded with a guard of the same name as the UnitTest
self.sources = srcs
self.target = target
+ self.main = kwargs.get('main', False)
UnitTest.all.append(self)
# Children should have access
flags = { test.target : True }
test_sources = Source.get(**flags)
test_objs = [ make_obj(s, static=True) for s in test_sources ]
+ if test.main:
+ test_objs += main_objs
testname = "unittest/%s.%s" % (test.target, label)
new_env.Program(testname, test_objs + static_objs)
stattest_py = PySource('m5', 'stattestmain.py', skip_lib=True)
stattest_swig = SwigSource('m5.internal', 'stattest.i', skip_lib=True)
-UnitTest('stattest', 'stattest.cc', stattest_py, stattest_swig)
+UnitTest('stattest', 'stattest.cc', stattest_py, stattest_swig, main=True)
UnitTest('symtest', 'symtest.cc')
UnitTest('tokentest', 'tokentest.cc')