corrected teardown function name in testing_make_linking.lua

stopped 'runall' from running 'setup' and 'teardown' as tests which also stops the inflated test count that I noticed.
Added writing of runtime to io for test suites.
Added prj = premake.solution.getproject(sln, 1) to vs10 tests and removed the managed flag hack.
This commit is contained in:
Liam Devine 2011-04-30 22:29:54 +01:00
parent 6c7b1939d8
commit 700cd82280
6 changed files with 28 additions and 23 deletions

View File

@ -55,7 +55,7 @@
configurations{'Debug'} configurations{'Debug'}
end end
function T.link_suite.tear_down() function T.link_suite.teardown()
_ACTION = nil _ACTION = nil
firstProject = nil firstProject = nil
linksToFirstProject = nil linksToFirstProject = nil

View File

@ -26,6 +26,7 @@ local function get_buffer()
io.capture() io.capture()
premake.buildconfigs() premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln) sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj) premake.vs2010_vcxproj(prj)
local buffer = io.endcapture() local buffer = io.endcapture()
return buffer return buffer
@ -297,10 +298,12 @@ local function vs10_managedFlag_setOnProject()
return sln,prj return sln,prj
end end
local function get_managed_buffer(sln,prj) local function get_managed_buffer(sln,prj)
io.capture() io.capture()
premake.buildconfigs() premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln) sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj) premake.vs2010_vcxproj(prj)
local buffer = io.endcapture() local buffer = io.endcapture()
return buffer return buffer
@ -308,6 +311,7 @@ end
function vs10_managedFlag.setup() function vs10_managedFlag.setup()
end end
function vs10_managedFlag.managedSetOnProject_CLRSupport_setToTrue() function vs10_managedFlag.managedSetOnProject_CLRSupport_setToTrue()
local sln, prj = vs10_managedFlag_setOnProject() local sln, prj = vs10_managedFlag_setOnProject()
local buffer = get_managed_buffer(sln,prj) local buffer = get_managed_buffer(sln,prj)
@ -320,10 +324,6 @@ end
function vs10_managedFlag.globals_bufferContainsKeywordManagedCProj() function vs10_managedFlag.globals_bufferContainsKeywordManagedCProj()
local sln, prj = vs10_managedFlag_setOnProject() local sln, prj = vs10_managedFlag_setOnProject()
--HACK ALERT
--For some reason the flags are not set on a proj when testing (yet they are recorded in prj.blocks)
--whilst in normal run mode, flags are set on the project ?
prj.flags = {["Managed"]=1}
local buffer = get_managed_buffer(sln,prj) local buffer = get_managed_buffer(sln,prj)
test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<Keyword>ManagedCProj</Keyword>.*</PropertyGroup>') test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<Keyword>ManagedCProj</Keyword>.*</PropertyGroup>')
end end
@ -331,7 +331,7 @@ end
function vs10_managedFlag.globals_bufferDoesNotContainKeywordWin32Proj() function vs10_managedFlag.globals_bufferDoesNotContainKeywordWin32Proj()
local sln, prj = vs10_managedFlag_setOnProject() local sln, prj = vs10_managedFlag_setOnProject()
prj.flags = {["Managed"]=1} --prj.flags = {["Managed"]=1}
local buffer = get_managed_buffer(sln,prj) local buffer = get_managed_buffer(sln,prj)
test.string_does_not_contain(buffer,'<PropertyGroup Label="Globals">.*<Keyword>Win32Proj</Keyword>.*</PropertyGroup>') test.string_does_not_contain(buffer,'<PropertyGroup Label="Globals">.*<Keyword>Win32Proj</Keyword>.*</PropertyGroup>')
end end
@ -339,7 +339,7 @@ end
function vs10_managedFlag.globals_FrameworkVersion_setToV4() function vs10_managedFlag.globals_FrameworkVersion_setToV4()
local sln, prj = vs10_managedFlag_setOnProject() local sln, prj = vs10_managedFlag_setOnProject()
prj.flags = {["Managed"]=1} --prj.flags = {["Managed"]=1}
local buffer = get_managed_buffer(sln,prj) local buffer = get_managed_buffer(sln,prj)
test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>.*</PropertyGroup>') test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>.*</PropertyGroup>')
end end

View File

@ -18,6 +18,7 @@
local function get_buffer() local function get_buffer()
premake.buildconfigs() premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln) sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj) premake.vs2010_vcxproj(prj)
buffer = io.endcapture() buffer = io.endcapture()
return buffer return buffer

View File

@ -16,6 +16,7 @@
local function get_buffer() local function get_buffer()
premake.buildconfigs() premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln) sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj) premake.vs2010_vcxproj(prj)
buffer = io.endcapture() buffer = io.endcapture()
return buffer return buffer

View File

@ -49,6 +49,7 @@
local function get_buffer() local function get_buffer()
premake.buildconfigs() premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln) sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj) premake.vs2010_vcxproj(prj)
local buffer = io.endcapture() local buffer = io.endcapture()
return buffer return buffer

View File

@ -228,10 +228,11 @@
local numpassed = 0 local numpassed = 0
local numfailed = 0 local numfailed = 0
local start_time = os.clock()
for suitename, suitetests in pairs(T) do for suitename, suitetests in pairs(T) do
for testname, testfunc in pairs(suitetests) do for testname, testfunc in pairs(suitetests) do
if suitetests.setup ~= testfunc and suitetests.teardown ~= testfunc then
local ok, err = test_setup(suitetests, testfunc) local ok, err = test_setup(suitetests, testfunc)
if ok then if ok then
@ -248,10 +249,11 @@
else else
numpassed = numpassed + 1 numpassed = numpassed + 1
end end
end
end end
end end
io.write('running time : ', os.clock() - start_time,'\n')
print = test.print print = test.print
return numpassed, numfailed return numpassed, numfailed
end end