2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
-- tests/premake4.lua
|
|
|
|
-- Automated test suite for Premake 4.x
|
2009-07-13 19:10:27 +00:00
|
|
|
-- Copyright (c) 2008-2009 Jason Perkins and the Premake project
|
2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
dofile("testfx.lua")
|
2009-09-15 21:08:40 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Some helper functions
|
|
|
|
--
|
|
|
|
|
|
|
|
test.createsolution = function()
|
|
|
|
local sln = solution "MySolution"
|
|
|
|
configurations { "Debug", "Release" }
|
|
|
|
|
|
|
|
local prj = project "MyProject"
|
|
|
|
language "C++"
|
|
|
|
kind "ConsoleApp"
|
|
|
|
|
|
|
|
return sln, prj
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
test.createproject = function(sln)
|
|
|
|
local n = #sln.projects + 1
|
|
|
|
if n == 1 then n = "" end
|
|
|
|
|
|
|
|
local prj = project ("MyProject" .. n)
|
|
|
|
language "C++"
|
|
|
|
kind "ConsoleApp"
|
|
|
|
return prj
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- The test suites
|
|
|
|
--
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
dofile("test_dofile.lua")
|
2008-11-13 00:54:41 +00:00
|
|
|
dofile("test_os.lua")
|
2008-10-31 18:38:05 +00:00
|
|
|
dofile("test_string.lua")
|
|
|
|
dofile("test_table.lua")
|
|
|
|
dofile("test_premake.lua")
|
|
|
|
dofile("test_project.lua")
|
2009-04-09 20:02:49 +00:00
|
|
|
dofile("test_configs.lua")
|
|
|
|
dofile("test_platforms.lua")
|
2008-12-15 15:00:35 +00:00
|
|
|
dofile("test_api.lua")
|
2008-12-05 21:18:47 +00:00
|
|
|
dofile("test_targets.lua")
|
2008-12-18 17:53:57 +00:00
|
|
|
dofile("test_keywords.lua")
|
2009-05-12 21:44:45 +00:00
|
|
|
dofile("test_gcc.lua")
|
2009-03-25 23:04:32 +00:00
|
|
|
dofile("test_vs2002_sln.lua")
|
|
|
|
dofile("test_vs2003_sln.lua")
|
|
|
|
dofile("test_vs2005_sln.lua")
|
|
|
|
dofile("test_vs2008_sln.lua")
|
|
|
|
dofile("test_vs200x_vcproj.lua")
|
2009-04-23 18:26:31 +00:00
|
|
|
dofile("test_gmake_cpp.lua")
|
2009-07-13 19:10:27 +00:00
|
|
|
dofile("test_gmake_cs.lua")
|
2009-07-16 14:29:08 +00:00
|
|
|
dofile("base/test_action.lua")
|
2009-09-29 19:27:33 +00:00
|
|
|
dofile("base/test_path.lua")
|
2009-08-18 19:09:17 +00:00
|
|
|
dofile("base/test_tree.lua")
|
2009-07-14 14:28:26 +00:00
|
|
|
dofile("actions/test_clean.lua")
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2009-11-03 21:35:24 +00:00
|
|
|
-- Xcode tests
|
|
|
|
dofile("actions/xcode/test_xcode_common.lua")
|
|
|
|
dofile("actions/xcode/test_xcode_project.lua")
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Register a test action
|
|
|
|
--
|
|
|
|
|
2009-08-11 00:11:48 +00:00
|
|
|
newaction {
|
|
|
|
trigger = "test",
|
2008-10-31 18:38:05 +00:00
|
|
|
description = "Run the automated test suite",
|
|
|
|
|
|
|
|
execute = function ()
|
|
|
|
passed, failed = test.runall()
|
|
|
|
msg = string.format("%d tests passed, %d failed", passed, failed)
|
|
|
|
if (failed > 0) then
|
|
|
|
error(msg, 0)
|
|
|
|
else
|
|
|
|
print(msg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|