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'}
end
function T.link_suite.tear_down()
function T.link_suite.teardown()
_ACTION = nil
firstProject = nil
linksToFirstProject = nil

View File

@ -26,6 +26,7 @@ local function get_buffer()
io.capture()
premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj)
local buffer = io.endcapture()
return buffer
@ -297,10 +298,12 @@ local function vs10_managedFlag_setOnProject()
return sln,prj
end
local function get_managed_buffer(sln,prj)
io.capture()
premake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
prj = premake.solution.getproject(sln, 1)
premake.vs2010_vcxproj(prj)
local buffer = io.endcapture()
return buffer
@ -308,6 +311,7 @@ end
function vs10_managedFlag.setup()
end
function vs10_managedFlag.managedSetOnProject_CLRSupport_setToTrue()
local sln, prj = vs10_managedFlag_setOnProject()
local buffer = get_managed_buffer(sln,prj)
@ -320,10 +324,6 @@ end
function vs10_managedFlag.globals_bufferContainsKeywordManagedCProj()
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)
test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<Keyword>ManagedCProj</Keyword>.*</PropertyGroup>')
end
@ -331,7 +331,7 @@ end
function vs10_managedFlag.globals_bufferDoesNotContainKeywordWin32Proj()
local sln, prj = vs10_managedFlag_setOnProject()
prj.flags = {["Managed"]=1}
--prj.flags = {["Managed"]=1}
local buffer = get_managed_buffer(sln,prj)
test.string_does_not_contain(buffer,'<PropertyGroup Label="Globals">.*<Keyword>Win32Proj</Keyword>.*</PropertyGroup>')
end
@ -339,7 +339,7 @@ end
function vs10_managedFlag.globals_FrameworkVersion_setToV4()
local sln, prj = vs10_managedFlag_setOnProject()
prj.flags = {["Managed"]=1}
--prj.flags = {["Managed"]=1}
local buffer = get_managed_buffer(sln,prj)
test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>.*</PropertyGroup>')
end

View File

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

View File

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

View File

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

View File

@ -228,30 +228,32 @@
local numpassed = 0
local numfailed = 0
local start_time = os.clock()
for suitename, suitetests in pairs(T) 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
ok, err = test_run(suitetests, testfunc)
end
if ok then
ok, err = test_run(suitetests, testfunc)
end
local tok, terr = test_teardown(suitetests, testfunc)
ok = ok and tok
err = err or tok
local tok, terr = test_teardown(suitetests, testfunc)
ok = ok and tok
err = err or tok
if (not ok) then
test.print(string.format("%s.%s: %s", suitename, testname, err))
numfailed = numfailed + 1
else
numpassed = numpassed + 1
if (not ok) then
test.print(string.format("%s.%s: %s", suitename, testname, err))
numfailed = numfailed + 1
else
numpassed = numpassed + 1
end
end
end
end
io.write('running time : ', os.clock() - start_time,'\n')
print = test.print
return numpassed, numfailed
end