summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-10-31 13:22:07 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-01 11:19:59 (GMT)
commitb353fac98e08d8f225781b95e55b80aa67171262 (patch)
tree6c16fb1af8c98ecfefe48eae4cbcce6dd600d975 /SConstruct
parent27751e9b1a176e1169e1aa1cfc16180c559e061f (diff)
downloadswift-b353fac98e08d8f225781b95e55b80aa67171262.zip
swift-b353fac98e08d8f225781b95e55b80aa67171262.tar.bz2
Added SCons test framework.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct14
1 files changed, 11 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct
index 1a737ed..6ee509a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -6,6 +6,7 @@ sys.path.append(Dir("BuildTools/SCons").abspath)
################################################################################
vars = Variables("config.py")
+vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
vars.Add(BoolVariable("optimize", "Compile with optimizations turned on", "no"))
vars.Add(BoolVariable("debug", "Compile with debug information", "yes" if os.name != "nt" else "no"))
vars.Add(BoolVariable("warnings", "Compile with warnings turned on",
@@ -34,6 +35,7 @@ Help(vars.GenerateHelpText(env))
env.Alias("dist", ["."])
# Default custom tools
+env.Tool("Test", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("WriteVal", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("BuildVersion", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "darwin" :
@@ -82,9 +84,6 @@ if env.get("coverage", 0) :
env.Append(CCFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
env.Append(LINKFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
-if env.get("valgrind", 0) :
- env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
-
if env["PLATFORM"] == "win32" :
env.Append(LIBS = ["dnsapi", "ws2_32", "wsock32"])
env.Append(CCFLAGS = "/EHsc")
@@ -94,6 +93,15 @@ if env["PLATFORM"] == "win32" :
if env["PLATFORM"] == "darwin" :
env.Append(FRAMEWORKS = "AppKit")
+# Testing
+env["TEST_TYPE"] = env["test"]
+env.Alias("check", ".")
+if "check" in ARGUMENTS or "check" in COMMAND_LINE_TARGETS :
+ env["TEST_TYPE"] = "unit"
+env["TEST"] = (env["TEST_TYPE"] != "none") or env.GetOption("clean")
+if env.get("valgrind", 0) :
+ env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
+
# Packaging
if ARGUMENTS.get("SWIFT_INSTALLDIR", "") :
env["SWIFT_INSTALLDIR"] = Dir(ARGUMENTS["SWIFT_INSTALLDIR"]).abspath