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 --- 219 unchanged lines hidden (view full) --- 228 229 self.module = modname 230 cc_file = joinpath(self.dirname, modname + '_wrap.cc') 231 py_file = joinpath(self.dirname, modname + '.py') 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): 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 UnitTest.all.append(self) 256 |
257# Children should have access 258Export('Source') 259Export('PySource') 260Export('SimObject') 261Export('SwigSource') 262Export('UnitTest') 263 264######################################################################## --- 414 unchanged lines hidden (view full) --- 679''') 680 code.write(str(target[0])) 681 682# Build all swig modules 683for swig in SwigSource.all: 684 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode, 685 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 686 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG"))) |
687 cc_file = str(swig.tnode) 688 init_file = '%s/init_%s.cc' % (dirname(cc_file), basename(cc_file)) |
689 env.Command(init_file, Value(swig.module), 690 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW"))) |
691 Source(init_file, **swig.guards) |
692 693# 694# Handle debug flags 695# 696def makeDebugFlagCC(target, source, env): 697 assert(len(target) == 1 and len(source) == 1) 698 699 val = eval(source[0].get_contents()) --- 211 unchanged lines hidden (view full) --- 911 shared_date = make_obj(date_source, static=False, extra_deps=shared_objs) 912 shared_objs.append(shared_date) 913 914 # First make a library of everything but main() so other programs can 915 # link against m5. 916 static_lib = new_env.StaticLibrary(libname, static_objs) 917 shared_lib = new_env.SharedLibrary(libname, shared_objs) 918 |
919 # Now link a stub with main() and the static library. 920 main_objs = [ make_obj(s, True) for s in Source.get(main=True) ] 921 |
922 for test in UnitTest.all: 923 flags = { test.target : True } 924 test_sources = Source.get(**flags) 925 test_objs = [ make_obj(s, static=True) for s in test_sources ] 926 testname = "unittest/%s.%s" % (test.target, label) 927 new_env.Program(testname, main_objs + test_objs + static_objs) 928 |
929 progname = exename 930 if strip: 931 progname += '.unstripped' 932 933 targets = new_env.Program(progname, main_objs + static_objs) 934 935 if strip: 936 if sys.platform == 'sunos5': --- 54 unchanged lines hidden --- |