SConscript (8946:fb6c89334b86) SConscript (9003:37b7913d2d35)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 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

--- 223 unchanged lines hidden (view full) ---

232
233 self.cc_source = Source(cc_file, swig=True, parent=self)
234 self.py_source = PySource(package, py_file, parent=self)
235
236class UnitTest(object):
237 '''Create a UnitTest'''
238
239 all = []
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 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

--- 223 unchanged lines hidden (view full) ---

232
233 self.cc_source = Source(cc_file, swig=True, parent=self)
234 self.py_source = PySource(package, py_file, parent=self)
235
236class UnitTest(object):
237 '''Create a UnitTest'''
238
239 all = []
240 def __init__(self, target, *sources):
240 def __init__(self, target, *sources, **kwargs):
241 '''Specify the target name and any sources. Sources that are
242 not SourceFiles are evalued with Source(). All files are
243 guarded with a guard of the same name as the UnitTest
244 target.'''
245
246 srcs = []
247 for src in sources:
248 if not isinstance(src, SourceFile):
249 src = Source(src, skip_lib=True)
250 src.guards[target] = True
251 srcs.append(src)
252
253 self.sources = srcs
254 self.target = target
241 '''Specify the target name and any sources. Sources that are
242 not SourceFiles are evalued with Source(). All files are
243 guarded with a guard of the same name as the UnitTest
244 target.'''
245
246 srcs = []
247 for src in sources:
248 if not isinstance(src, SourceFile):
249 src = Source(src, skip_lib=True)
250 src.guards[target] = True
251 srcs.append(src)
252
253 self.sources = srcs
254 self.target = target
255 self.main = kwargs.get('main', False)
255 UnitTest.all.append(self)
256
257# Children should have access
258Export('Source')
259Export('PySource')
260Export('SimObject')
261Export('SwigSource')
262Export('UnitTest')

--- 638 unchanged lines hidden (view full) ---

901
902 # Now link a stub with main() and the static library.
903 main_objs = [ make_obj(s, True) for s in Source.get(main=True) ]
904
905 for test in UnitTest.all:
906 flags = { test.target : True }
907 test_sources = Source.get(**flags)
908 test_objs = [ make_obj(s, static=True) for s in test_sources ]
256 UnitTest.all.append(self)
257
258# Children should have access
259Export('Source')
260Export('PySource')
261Export('SimObject')
262Export('SwigSource')
263Export('UnitTest')

--- 638 unchanged lines hidden (view full) ---

902
903 # Now link a stub with main() and the static library.
904 main_objs = [ make_obj(s, True) for s in Source.get(main=True) ]
905
906 for test in UnitTest.all:
907 flags = { test.target : True }
908 test_sources = Source.get(**flags)
909 test_objs = [ make_obj(s, static=True) for s in test_sources ]
910 if test.main:
911 test_objs += main_objs
909 testname = "unittest/%s.%s" % (test.target, label)
910 new_env.Program(testname, test_objs + static_objs)
911
912 progname = exename
913 if strip:
914 progname += '.unstripped'
915
916 targets = new_env.Program(progname, main_objs + static_objs)

--- 93 unchanged lines hidden ---
912 testname = "unittest/%s.%s" % (test.target, label)
913 new_env.Program(testname, test_objs + static_objs)
914
915 progname = exename
916 if strip:
917 progname += '.unstripped'
918
919 targets = new_env.Program(progname, main_objs + static_objs)

--- 93 unchanged lines hidden ---