From 4c7c2d74c772829d737c324641856dd8937ed560 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 24 Jun 2005 10:51:45 +0000 Subject: [PATCH] renamed target to `test-code` and made conf test alias the target to an error git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4133 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/Tests/SConscript | 47 +++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/Source/Tests/SConscript b/Source/Tests/SConscript index d3482c4a..e9ad4969 100644 --- a/Source/Tests/SConscript +++ b/Source/Tests/SConscript @@ -28,31 +28,36 @@ 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) - +cppunit = conf.CheckLibWithHeader(libs, 'cppunit/extensions/HelperMacros.h', 'C++') conf.Finish() -# compile files from parent directory -required_obj = [] +if cppunit: -for i in required: - b = 'required/%s' % i[:-4] - s = '#Source/%s' % i - o = env.Object(b, s) + # compile files from parent directory + required_obj = [] - required_obj.append(o) + for i in required: + b = 'required/%s' % i[:-4] + s = '#Source/%s' % i + o = env.Object(b, s) -# build test program -tests = env.Program(target, tests + required_obj, LIBS = libs) + required_obj.append(o) -# alias running the test to 'test' -test = env.Alias('test', [tests], tests[0].abspath) + # build test program + tests = env.Program(target, tests + required_obj, LIBS = libs) -# always test when asked to -AlwaysBuild(test) + # alias running the test to 'test' + test = env.Alias('test-code', [tests], tests[0].abspath) + + # always test when asked to + AlwaysBuild(test) + +else: + + # no CppUnit + def err(target, source, env): + print '*** error: CppUnit must be installed for testing!' + return 1 + + cmd = env.Command(target, [tests], Action(err, '')) + env.Alias('test-code', cmd)