From a515a31e3228979c5384ec395cb00b2f4f7d1282 Mon Sep 17 00:00:00 2001 From: kichik Date: Wed, 22 Jun 2005 21:37:51 +0000 Subject: [PATCH] added 'test' target git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4125 212acab6-be3b-0410-9dea-997c60f758d6 --- SConstruct | 14 ++++++++++ Source/Tests/SConscript | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 Source/Tests/SConscript diff --git a/SConstruct b/SConstruct index 110e684d..565b2cf8 100644 --- a/SConstruct +++ b/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 +) diff --git a/Source/Tests/SConscript b/Source/Tests/SConscript new file mode 100644 index 00000000..d3482c4a --- /dev/null +++ b/Source/Tests/SConscript @@ -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)