--
-- tests/actions/vstudio/vc200x/test_compiler_block.lua
-- Validate generation the VCCLCompiler element in Visual Studio 200x C/C++ projects.
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vs200x_compiler_block")
local vc200x = p.vstudio.vc200x
--
-- Setup/teardown
--
local wks, prj
function suite.setup()
p.action.set("vs2008")
wks, prj = test.createWorkspace()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
vc200x.VCCLCompilerTool(cfg)
end
--
-- Verify the basic structure of the compiler block with no flags or settings.
--
function suite.looksGood_onDefaultSettings()
prepare()
test.capture [[
]]
end
--
-- If include directories are specified, the should be added.
--
function suite.additionalIncludeDirs_onIncludeDirs()
includedirs { "include/lua", "include/zlib" }
prepare()
test.capture [[
]]
end
--
-- Verify the handling of the Symbols in conjunction with the Optimize flag.
-- The release runtime library must be used.
--
function suite.looksGood_onSymbolsAndOptimizeFlags()
symbols "On"
optimize "On"
prepare()
test.capture [[
]]
end
--
-- Verify the handling of the C7 debug information format.
--
function suite.looksGood_onC7DebugFormat()
symbols "On"
debugformat "C7"
prepare()
test.capture [[
]]
end
---
-- Test precompiled header handling; the header should be treated as
-- a plain string value, with no path manipulation applied, since it
-- needs to match the value of the #include statement used in the
-- project code.
---
function suite.compilerBlock_OnPCH()
location "build"
pchheader "include/common.h"
pchsource "source/common.cpp"
prepare()
test.capture [[
]]
end
--
-- Floating point flag tests
--
function suite.compilerBlock_OnFpFast()
floatingpoint "Fast"
prepare()
test.capture [[
]]
end
function suite.compilerBlock_OnFpStrict()
floatingpoint "Strict"
prepare()
test.capture [[
]]
end
--
-- Check that the "minimal rebuild" flag is applied correctly.
--
function suite.minimalRebuildFlagsSet_onMinimalRebuildAndSymbols()
flags { "NoMinimalRebuild" }
symbols "On"
prepare()
test.capture [[
]]
end
--
-- Check that the "no buffer security check" flag is applied correctly.
--
function suite.noBufferSecurityFlagSet_onBufferSecurityCheck()
flags { "NoBufferSecurityCheck" }
prepare()
test.capture [[
]]
end
--
-- Check that the CompileAs value is set correctly for C language projects.
--
function suite.compileAsSet_onC()
language "C"
prepare()
test.capture [[
]]
end
--
-- Verify the correct runtime library is used when symbols are enabled.
--
function suite.runtimeLibraryIsDebug_onSymbolsNoOptimize()
symbols "On"
prepare()
test.capture [[
]]
end
--
-- Verify the correct warnings settings are used when extra warnings are enabled.
--
function suite.runtimeLibraryIsDebug_onExtraWarnings()
warnings "Extra"
prepare()
test.capture [[
]]
end
--
-- Verify the correct warnings settings are used when FatalWarnings are enabled.
--
function suite.runtimeLibraryIsDebug_onFatalWarnings()
flags { "FatalWarnings" }
prepare()
test.capture [[
]]
end
--
-- Verify the correct warnings settings are used when no warnings are enabled.
--
function suite.runtimeLibraryIsDebug_onNoWarnings_whichDisablesAllOtherWarningsFlags()
flags { "FatalWarnings" }
warnings "Off"
prepare()
test.capture [[
]]
end
--
-- Verify the correct Detect64BitPortabilityProblems settings are used when _ACTION < "VS2008".
--
function suite._64BitPortabilityOn_onVS2005()
p.action.set("vs2005")
prepare()
test.capture [[
]]
end
function suite._64BitPortabilityOff_onVS2005_andCLR()
p.action.set("vs2005")
clr "On"
prepare()
test.capture [[
]]
end
--
-- Verify the correct warnings settings are used when no warnings are enabled.
--
function suite.runtimeLibraryIsDebug_onVS2005_NoWarnings()
p.action.set("vs2005")
warnings "Off"
prepare()
test.capture [[
]]
end
--
-- Check handling of forced includes.
--
function suite.forcedIncludeFiles()
forceincludes { "stdafx.h", "include/sys.h" }
prepare()
test.capture [[