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:
kichik 2005-06-22 21:37:51 +00:00
parent 63276d8689
commit a515a31e32
2 changed files with 72 additions and 0 deletions

58
Source/Tests/SConscript Normal file
View 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)