Merge pull request #1670 from nickclark2016/issues/1670

This commit is contained in:
starkos 2021-08-10 06:43:08 -04:00
commit 19d1abe46b
3 changed files with 151 additions and 4 deletions

View File

@ -12,6 +12,7 @@ return {
"cs2005/test_compiler_props.lua",
"cs2005/test_no_warn.lua",
"cs2005/test_debug_props.lua",
"cs2005/test_debug_props_2019.lua",
"cs2005/test_files.lua",
"cs2005/test_icon.lua",
"cs2005/test_netcore.lua",

View File

@ -0,0 +1,130 @@
--
-- tests/actions/vstudio/cs2005/test_debug_props_2019.lua
-- Test debugging and optimization flags block of a Visual Studio 2019+ C# project.
-- Copyright (c) 2012-2021 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_cs2005_debug_props_2019")
local cs2005 = p.vstudio.cs2005
local dn2005 = p.vstudio.dotnetbase
local project = p.project
--
-- Setup and teardown
--
local wks, prj
function suite.setup()
p.action.set("vs2019")
wks, prj = test.createWorkspace()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
dn2005.debugProps(cfg)
end
--
-- Check the handling of the Symbols flag.
--
function suite.debugSymbols_onNoSymbolsFlag()
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_onSymbolsFlag()
symbols "On"
prepare()
test.capture [[
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_fullSymbolsFlag()
symbols "Full"
prepare()
test.capture [[
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_offSymbolsFlag()
symbols "Off"
prepare()
test.capture [[
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<Optimize>false</Optimize>
]]
end
---
--- Check handling of debug parameters.
---
function suite.debugCommandParameters()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
dn2005.debugCommandParameters(cfg)
test.capture [[
<Commandlineparameters>foobar</Commandlineparameters>
]]
end
function suite.debugStartArguments()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
cs2005.localDebuggerCommandArguments(cfg)
test.capture [[
<StartArguments>foobar</StartArguments>
]]
end
--
-- Check handling of optimization flags.
--
function suite.optimize_onOptimizeFlag()
optimize "On"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end
function suite.optimize_onOptimizeSizeFlag()
optimize "Size"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end
function suite.optimize_onOptimizeSpeedFlag()
optimize "Speed"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end

View File

@ -278,11 +278,27 @@
--
function dotnetbase.debugProps(cfg)
if cfg.symbols == p.ON then
_p(2,'<DebugSymbols>true</DebugSymbols>')
_p(2,'<DebugType>full</DebugType>')
if _ACTION >= "vs2019" then
if cfg.symbols == "Full" then
_p(2,'<DebugType>full</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
elseif cfg.symbols == p.OFF then
_p(2,'<DebugType>none</DebugType>')
_p(2,'<DebugSymbols>false</DebugSymbols>')
elseif cfg.symbols == p.ON or cfg.symbols == "FastLink" then
_p(2,'<DebugType>pdbonly</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
else
_p(2,'<DebugType>portable</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
end
else
_p(2,'<DebugType>pdbonly</DebugType>')
if cfg.symbols == p.ON then
_p(2,'<DebugSymbols>true</DebugSymbols>')
_p(2,'<DebugType>full</DebugType>')
else
_p(2,'<DebugType>pdbonly</DebugType>')
end
end
_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), "true", "false"))
end