2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
-- tests/premake4.lua
|
|
|
|
-- Automated test suite for Premake 4.x
|
2012-02-02 00:05:13 +00:00
|
|
|
-- Copyright (c) 2008-2012 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" }
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2009-09-15 21:08:40 +00:00
|
|
|
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
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2009-09-15 21:08:40 +00:00
|
|
|
local prj = project ("MyProject" .. n)
|
|
|
|
language "C++"
|
|
|
|
kind "ConsoleApp"
|
|
|
|
return prj
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- The test suites
|
|
|
|
--
|
|
|
|
|
2011-12-04 19:47:59 +00:00
|
|
|
-- Base API tests
|
2008-10-31 18:38:05 +00:00
|
|
|
dofile("test_dofile.lua")
|
|
|
|
dofile("test_string.lua")
|
|
|
|
dofile("test_premake.lua")
|
2009-04-09 20:02:49 +00:00
|
|
|
dofile("test_platforms.lua")
|
2008-12-18 17:53:57 +00:00
|
|
|
dofile("test_keywords.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")
|
2010-02-17 22:11:25 +00:00
|
|
|
dofile("base/test_api.lua")
|
2009-07-16 14:29:08 +00:00
|
|
|
dofile("base/test_action.lua")
|
2010-09-05 20:10:28 +00:00
|
|
|
dofile("base/test_config.lua")
|
2011-12-04 19:47:59 +00:00
|
|
|
dofile("base/test_include.lua")
|
2011-04-27 22:43:15 +00:00
|
|
|
dofile("base/test_location.lua")
|
2010-01-13 23:29:21 +00:00
|
|
|
dofile("base/test_os.lua")
|
2009-09-29 19:27:33 +00:00
|
|
|
dofile("base/test_path.lua")
|
2010-02-17 22:11:25 +00:00
|
|
|
dofile("base/test_table.lua")
|
2009-08-18 19:09:17 +00:00
|
|
|
dofile("base/test_tree.lua")
|
2011-03-17 04:17:36 +00:00
|
|
|
dofile("base/test_config_bug.lua")
|
2011-03-23 21:05:19 +00:00
|
|
|
|
2012-02-19 17:31:20 +00:00
|
|
|
-- Solution object tests
|
|
|
|
dofile("solution/test_eachconfig.lua")
|
|
|
|
|
2012-01-18 21:26:05 +00:00
|
|
|
-- Project object tests
|
2011-06-09 19:15:39 +00:00
|
|
|
dofile("test_project.lua")
|
2011-12-21 00:03:45 +00:00
|
|
|
dofile("project/test_eachconfig.lua")
|
2012-01-20 00:14:18 +00:00
|
|
|
dofile("project/test_filtering.lua")
|
2012-01-22 17:19:43 +00:00
|
|
|
dofile("project/test_getconfig.lua")
|
2012-02-19 17:31:20 +00:00
|
|
|
dofile("project/test_hasconfig.lua")
|
2012-04-13 00:31:10 +00:00
|
|
|
dofile("project/test_mapconfig.lua")
|
2011-06-09 19:15:39 +00:00
|
|
|
dofile("project/test_vpaths.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2012-01-18 21:26:05 +00:00
|
|
|
-- Configuration object tests
|
2012-02-13 22:32:23 +00:00
|
|
|
dofile("config/test_fileconfig.lua")
|
2012-01-18 21:26:05 +00:00
|
|
|
dofile("config/test_linkinfo.lua")
|
|
|
|
dofile("config/test_links.lua")
|
|
|
|
dofile("config/test_objdir.lua")
|
|
|
|
dofile("config/test_targetinfo.lua")
|
|
|
|
|
2012-04-04 20:21:22 +00:00
|
|
|
-- API tests
|
2012-04-06 00:02:53 +00:00
|
|
|
dofile("api/test_array_kind.lua")
|
2012-04-04 20:21:22 +00:00
|
|
|
dofile("api/test_callback.lua")
|
2012-04-17 18:33:47 +00:00
|
|
|
dofile("api/test_path_kind.lua")
|
2012-04-04 20:21:22 +00:00
|
|
|
dofile("api/test_register.lua")
|
2012-04-16 23:31:08 +00:00
|
|
|
dofile("api/test_string_kind.lua")
|
2012-04-04 20:21:22 +00:00
|
|
|
|
2011-06-02 19:26:15 +00:00
|
|
|
-- Baking tests
|
|
|
|
dofile("base/test_baking.lua")
|
2012-04-16 22:54:01 +00:00
|
|
|
dofile("oven/test_basics.lua")
|
2012-04-10 21:21:37 +00:00
|
|
|
dofile("oven/test_keyvalues.lua")
|
2012-04-16 22:54:01 +00:00
|
|
|
dofile("oven/test_lists.lua")
|
|
|
|
dofile("oven/test_objects.lua")
|
|
|
|
dofile("oven/test_removes.lua")
|
2012-04-18 19:15:56 +00:00
|
|
|
dofile("oven/test_tokens.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
-- Toolset tests
|
|
|
|
dofile("tools/test_gcc.lua")
|
|
|
|
dofile("tools/test_snc.lua")
|
|
|
|
|
2010-02-26 22:10:57 +00:00
|
|
|
-- Clean tests
|
2009-07-14 14:28:26 +00:00
|
|
|
dofile("actions/test_clean.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2010-02-26 22:10:57 +00:00
|
|
|
-- Visual Studio tests
|
|
|
|
dofile("test_vs2002_sln.lua")
|
|
|
|
dofile("test_vs2003_sln.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
|
|
|
|
-- Visual Studio 2002-2003 C# projects
|
2012-01-09 20:35:28 +00:00
|
|
|
dofile("actions/vstudio/cs2002/test_files.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
|
|
|
|
-- Visual Studio 2005-2010 C# projects
|
2012-01-09 20:35:28 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_files.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
dofile("actions/vstudio/cs2005/projectelement.lua")
|
|
|
|
dofile("actions/vstudio/cs2005/projectsettings.lua")
|
|
|
|
dofile("actions/vstudio/cs2005/propertygroup.lua")
|
|
|
|
|
|
|
|
-- Visual Studio 2005-2010 solutions
|
2012-01-12 21:59:15 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_dependencies.lua")
|
|
|
|
dofile("actions/vstudio/sln2005/test_header.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
dofile("actions/vstudio/sln2005/platforms.lua")
|
|
|
|
dofile("actions/vstudio/sln2005/projectplatforms.lua")
|
2012-01-12 21:59:15 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_projects.lua")
|
2012-01-04 21:15:36 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_project_platforms.lua")
|
2012-01-03 22:08:22 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_solution_platforms.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
|
2011-04-25 19:55:17 +00:00
|
|
|
-- Visual Studio 2002-2008 C/C++ projects
|
2011-11-19 21:50:50 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_compiler_block.lua")
|
2012-01-04 22:16:06 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_configuration.lua")
|
2012-02-11 13:18:19 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_debug_settings.lua")
|
|
|
|
dofile("actions/vstudio/vc200x/test_external_compiler.lua")
|
2012-02-11 16:29:45 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_external_linker.lua")
|
2011-12-06 20:14:43 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_files.lua")
|
2011-11-19 21:50:50 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_linker_block.lua")
|
2012-01-18 00:04:46 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_manifest_block.lua")
|
2011-12-13 21:10:22 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_mfc.lua")
|
2012-01-04 22:16:06 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_platforms.lua")
|
2012-01-13 22:19:46 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_project.lua")
|
2012-02-22 21:20:21 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_resource_compiler.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2011-04-25 19:55:17 +00:00
|
|
|
-- Visual Studio 2010 C/C++ projects
|
2011-11-19 21:50:50 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_compile_settings.lua")
|
2012-01-27 01:40:39 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_config_props.lua")
|
2012-02-02 00:05:13 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_debug_settings.lua")
|
2012-01-27 01:40:39 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_globals.lua")
|
2011-07-01 19:05:16 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_header.lua")
|
|
|
|
dofile("actions/vstudio/vc2010/test_files.lua")
|
2012-02-02 00:05:13 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_filter_ids.lua")
|
2011-07-01 19:05:16 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_filters.lua")
|
2012-01-27 21:29:41 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_link.lua")
|
2012-01-27 01:40:39 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_output_props.lua")
|
|
|
|
dofile("actions/vstudio/vc2010/test_project_configs.lua")
|
2012-02-01 00:54:33 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_project_refs.lua")
|
2012-01-27 01:40:39 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_prop_sheet.lua")
|
2012-01-27 18:37:24 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_resource_compile.lua")
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2010-10-04 10:43:19 +00:00
|
|
|
-- Makefile tests
|
|
|
|
dofile("actions/make/test_make_escaping.lua")
|
2010-10-19 11:14:46 +00:00
|
|
|
dofile("actions/make/test_make_pch.lua")
|
2011-03-26 00:21:44 +00:00
|
|
|
dofile("actions/make/test_make_linking.lua")
|
2011-09-15 20:45:48 +00:00
|
|
|
-- dofile("actions/make/test_makesettings.lua")
|
|
|
|
dofile("actions/make/test_wiidev.lua")
|
|
|
|
|
2011-05-12 20:00:07 +00:00
|
|
|
-- Xcode3 tests
|
2011-12-20 19:59:26 +00:00
|
|
|
dofile("actions/xcode/test_file_references.lua")
|
2009-11-03 21:35:24 +00:00
|
|
|
dofile("actions/xcode/test_xcode_common.lua")
|
|
|
|
dofile("actions/xcode/test_xcode_project.lua")
|
2009-11-25 19:40:23 +00:00
|
|
|
dofile("actions/xcode/test_xcode_dependencies.lua")
|
2009-12-22 16:07:55 +00:00
|
|
|
|
2011-05-12 20:00:07 +00:00
|
|
|
-- Xcode4 tests
|
2011-10-20 20:36:24 +00:00
|
|
|
dofile("actions/xcode/test_xcode4_project.lua")
|
2011-03-11 16:43:19 +00:00
|
|
|
dofile("actions/xcode/test_xcode4_workspace.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2011-05-12 20:00:07 +00:00
|
|
|
-- CodeLite tests
|
|
|
|
dofile("actions/codelite/codelite_files.lua")
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2011-05-12 20:14:43 +00:00
|
|
|
-- CodeBlocks tests
|
|
|
|
dofile("actions/codeblocks/codeblocks_files.lua")
|
2011-08-19 12:58:12 +00:00
|
|
|
dofile("actions/codeblocks/test_filters.lua")
|
2011-08-23 20:48:16 +00:00
|
|
|
dofile("actions/codeblocks/environment_variables.lua")
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
-- Register a test action
|
|
|
|
--
|
|
|
|
|
2012-04-18 21:12:56 +00:00
|
|
|
newoption {
|
|
|
|
trigger = "test",
|
|
|
|
description = "A suite or test to run"
|
|
|
|
}
|
|
|
|
|
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",
|
2011-11-08 21:43:49 +00:00
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
execute = function ()
|
2012-04-18 21:12:56 +00:00
|
|
|
if _OPTIONS["test"] then
|
|
|
|
local t = string.explode(_OPTIONS["test"] or "", ".", true)
|
|
|
|
passed, failed = test.runall(t[1], t[2])
|
|
|
|
else
|
|
|
|
passed, failed = test.runall()
|
|
|
|
end
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
msg = string.format("%d tests passed, %d failed", passed, failed)
|
|
|
|
if (failed > 0) then
|
|
|
|
error(msg, 0)
|
|
|
|
else
|
|
|
|
print(msg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|