diff options
author | Jason Perkins <starkos@industriousone.com> | 2010-09-06 00:10:28 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2010-09-06 00:10:28 +0400 |
commit | a01e21d1007cce1b57a6b885e4e8acfcbef09ca7 (patch) | |
tree | fb0ed4cd5c12f1b253d85a6e71bf87b32c3a9def /tests/base | |
parent | 87ce78b0310ca2b0b160b54dcf7e170a2b0f5140 (diff) |
Bug 3007101: Generating PDB in Release builds is not supported
Diffstat (limited to 'tests/base')
-rw-r--r-- | tests/base/test_baking.lua | 186 | ||||
-rw-r--r-- | tests/base/test_config.lua | 58 |
2 files changed, 244 insertions, 0 deletions
diff --git a/tests/base/test_baking.lua b/tests/base/test_baking.lua new file mode 100644 index 0000000..d270cf4 --- /dev/null +++ b/tests/base/test_baking.lua @@ -0,0 +1,186 @@ +-- +-- tests/test_baking.lua +-- Automated test suite for the configuration baking functions. +-- Copyright (c) 2009, 2010 Jason Perkins and the Premake project +-- + + T.baking = { } + local suite = T.baking + +-- +-- Setup code +-- + + local prj, cfg + function suite.setup() + _ACTION = "gmake" + + solution "MySolution" + configurations { "Debug", "Release" } + platforms { "x32", "ps3" } + + defines "SOLUTION" + + configuration "Debug" + defines "SOLUTION_DEBUG" + + prj = project "MyProject" + language "C" + kind "SharedLib" + targetdir "../bin" + defines "PROJECT" + + configuration "Debug" + defines "DEBUG" + + configuration "Release" + defines "RELEASE" + + configuration "native" + defines "NATIVE" + + configuration "x32" + defines "X86_32" + + configuration "x64" + defines "X86_64" + end + + local function prepare() + premake.buildconfigs() + prj = premake.getconfig(prj) + cfg = premake.getconfig(prj, "Debug") + end + + +-- +-- Tests +-- + + function suite.SolutionFields() + prepare() + test.isequal("Debug:Release", table.concat(cfg.configurations,":")) + end + + + function suite.ProjectFields() + prepare() + test.isequal("C", cfg.language) + end + + + function suite.ProjectWideSettings() + prepare() + test.isequal("SOLUTION:PROJECT:NATIVE", table.concat(prj.defines,":")) + end + + + function suite.BuildCfgSettings() + prepare() + test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:NATIVE", table.concat(cfg.defines,":")) + end + + + function suite.PlatformSettings() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:X86_32", table.concat(cfg.defines,":")) + end + + + function suite.SetsConfigName() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.isequal("Debug", cfg.name) + end + + + function suite.SetsPlatformName() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.isequal("x32", cfg.platform) + end + + + function suite.SetsPlatformNativeName() + test.isequal("Native", cfg.platform) + end + + + function suite.SetsShortName() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.isequal("debug32", cfg.shortname) + end + + + function suite.SetsNativeShortName() + prepare() + test.isequal("debug", cfg.shortname) + end + + + function suite.SetsLongName() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.isequal("Debug|x32", cfg.longname) + end + + + function suite.SetsNativeLongName() + prepare() + test.isequal("Debug", cfg.longname) + end + + + function suite.SetsProject() + prepare() + local cfg = premake.getconfig(prj, "Debug", "x32") + test.istrue(prj.project == cfg.project) + end + + + +-- +-- Target system testing +-- + + function suite.SetsTargetSystem_OnNative() + prepare() + test.isequal(os.get(), cfg.system) + end + + function suite.SetTargetSystem_OnCrossCompiler() + prepare() + local cfg = premake.getconfig(prj, "Debug", "PS3") + test.isequal("PS3", cfg.system) + end + + + +-- +-- Configuration-specific kinds +-- + + function suite.SetsConfigSpecificKind() + configuration "Debug" + kind "ConsoleApp" + prepare() + test.isequal("ConsoleApp", cfg.kind) + end + + +-- +-- Platform kind translation +-- + + function suite.SetsTargetKind_OnSupportedKind() + prepare() + test.isequal("SharedLib", cfg.kind) + end + + function suite.SetsTargetKind_OnUnsupportedKind() + prepare() + local cfg = premake.getconfig(prj, "Debug", "PS3") + test.isequal("StaticLib", cfg.kind) + end diff --git a/tests/base/test_config.lua b/tests/base/test_config.lua new file mode 100644 index 0000000..7bd0786 --- /dev/null +++ b/tests/base/test_config.lua @@ -0,0 +1,58 @@ +-- +-- tests/test_config.lua +-- Automated test suite for the configuration handling functions. +-- Copyright (c) 2010 Jason Perkins and the Premake project +-- + + T.config = { } + local suite = T.config + + +-- +-- Setup/Teardown +-- + + function suite.setup() + sln = test.createsolution() + end + + local cfg + local function prepare() + io.capture() + premake.buildconfigs() + cfg = premake.solution.getproject(sln, 1) + end + + +-- +-- Debug/Release build testing +-- + + function suite.IsDebug_ReturnsFalse_OnOptimizeFlag() + flags { "Optimize" } + prepare() + return test.isfalse(premake.config.isdebugbuild(cfg)) + end + + function suite.IsDebug_ReturnsFalse_OnOptimizeSizeFlag() + flags { "OptimizeSize" } + prepare() + return test.isfalse(premake.config.isdebugbuild(cfg)) + end + + function suite.IsDebug_ReturnsFalse_OnOptimizeSpeedFlag() + flags { "OptimizeSpeed" } + prepare() + return test.isfalse(premake.config.isdebugbuild(cfg)) + end + + function suite.IsDebug_ReturnsFalse_OnNoSymbolsFlag() + prepare() + return test.isfalse(premake.config.isdebugbuild(cfg)) + end + + function suite.IsDebug_ReturnsTrue_OnSymbolsFlag() + flags { "Symbols" } + prepare() + return test.istrue(premake.config.isdebugbuild(cfg)) + end |