added 'test' target
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4125 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
63276d8689
commit
a515a31e32
2 changed files with 72 additions and 0 deletions
14
SConstruct
14
SConstruct
|
@ -421,3 +421,17 @@ for i in misc:
|
|||
continue
|
||||
|
||||
defenv.SConscript(dirs = 'Contrib/%s' % i)
|
||||
|
||||
######################################################################
|
||||
####### Tests ###
|
||||
######################################################################
|
||||
|
||||
build_dir = '$BUILD_PREFIX/tests'
|
||||
exports = {'env' : defenv.Copy()}
|
||||
|
||||
defenv.SConscript(
|
||||
dirs = 'Source/Tests',
|
||||
duplicate = 0,
|
||||
exports = exports,
|
||||
build_dir = build_dir
|
||||
)
|
||||
|
|
58
Source/Tests/SConscript
Normal file
58
Source/Tests/SConscript
Normal file
|
@ -0,0 +1,58 @@
|
|||
target = 'test'
|
||||
|
||||
tests = Split("""
|
||||
endian.cpp
|
||||
mmap.cpp
|
||||
specmatch.cpp
|
||||
textrunner.cpp
|
||||
""")
|
||||
|
||||
required = Split("""
|
||||
dirreader.cpp
|
||||
growbuf.cpp
|
||||
mmap.cpp
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
cppunit
|
||||
""")
|
||||
|
||||
Import('env')
|
||||
|
||||
# compile using msvcrt (that's how cppunit.lib is built)
|
||||
if 'msvc' in env['TOOLS'] or 'mstoolkit' in env['TOOLS']:
|
||||
env.Append(CCFLAGS = ['/MD'])
|
||||
|
||||
# uses exceptions
|
||||
env.Append(CCFLAGS = ['$EXCEPTION_FLAG'])
|
||||
|
||||
# test for CppUnit
|
||||
conf = env.Configure()
|
||||
|
||||
if not conf.CheckLibWithHeader(libs, 'cppunit/extensions/HelperMacros.h', 'C++'):
|
||||
|
||||
if 'test' in BUILD_TARGETS:
|
||||
|
||||
print '*** error: CppUnit must be installed for testing!'
|
||||
Exit(1)
|
||||
|
||||
conf.Finish()
|
||||
|
||||
# compile files from parent directory
|
||||
required_obj = []
|
||||
|
||||
for i in required:
|
||||
b = 'required/%s' % i[:-4]
|
||||
s = '#Source/%s' % i
|
||||
o = env.Object(b, s)
|
||||
|
||||
required_obj.append(o)
|
||||
|
||||
# build test program
|
||||
tests = env.Program(target, tests + required_obj, LIBS = libs)
|
||||
|
||||
# alias running the test to 'test'
|
||||
test = env.Alias('test', [tests], tests[0].abspath)
|
||||
|
||||
# always test when asked to
|
||||
AlwaysBuild(test)
|
Loading…
Add table
Add a link
Reference in a new issue