2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
-- tests/premake4.lua
|
|
|
|
-- Automated test suite for Premake 4.x
|
2013-02-01 19:54:14 +00:00
|
|
|
-- Copyright (c) 2008-2013 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")
|
2012-11-04 14:21:58 +00:00
|
|
|
|
2012-10-19 22:53:03 +00:00
|
|
|
dofile("base/test_configset.lua")
|
|
|
|
dofile("base/test_context.lua")
|
|
|
|
dofile("base/test_criteria.lua")
|
2012-11-04 14:21:58 +00:00
|
|
|
dofile("base/test_detoken.lua")
|
2011-12-04 19:47:59 +00:00
|
|
|
dofile("base/test_include.lua")
|
2010-01-13 23:29:21 +00:00
|
|
|
dofile("base/test_os.lua")
|
2012-12-04 16:45:26 +00:00
|
|
|
dofile("base/test_override.lua")
|
2009-09-29 19:27:33 +00:00
|
|
|
dofile("base/test_path.lua")
|
2012-09-27 21:07:32 +00:00
|
|
|
dofile("base/test_premake_command.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")
|
2012-12-29 18:26:41 +00:00
|
|
|
dofile("base/test_uuid.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-04-23 22:18:31 +00:00
|
|
|
dofile("solution/test_objdirs.lua")
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-01-18 21:26:05 +00:00
|
|
|
-- Project object tests
|
2012-11-17 20:49:06 +00:00
|
|
|
dofile("project/test_config_maps.lua")
|
2011-12-21 00:03:45 +00:00
|
|
|
dofile("project/test_eachconfig.lua")
|
2012-10-24 19:40:25 +00:00
|
|
|
dofile("project/test_filename.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")
|
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_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")
|
2013-02-15 23:57:34 +00:00
|
|
|
dofile("api/test_containers.lua")
|
2012-04-22 18:12:33 +00:00
|
|
|
dofile("api/test_list_kind.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
|
|
|
|
2013-02-01 19:54:14 +00:00
|
|
|
-- Control system tests
|
|
|
|
dofile("test_premake.lua")
|
|
|
|
dofile("base/test_validation.lua")
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
-- Toolset tests
|
2012-09-27 16:18:03 +00:00
|
|
|
dofile("tools/test_dotnet.lua")
|
2012-02-17 00:51:14 +00:00
|
|
|
dofile("tools/test_gcc.lua")
|
2012-08-18 20:33:37 +00:00
|
|
|
dofile("tools/test_msc.lua")
|
2012-02-17 00:51:14 +00:00
|
|
|
dofile("tools/test_snc.lua")
|
|
|
|
|
2011-02-16 20:16:07 +00:00
|
|
|
-- Visual Studio 2005-2010 C# projects
|
2012-09-27 14:15:27 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_assembly_refs.lua")
|
2012-11-28 16:14:47 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_build_events.lua")
|
2012-10-02 16:57:10 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_compiler_props.lua")
|
|
|
|
dofile("actions/vstudio/cs2005/test_debug_props.lua")
|
2012-01-09 20:35:28 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_files.lua")
|
2013-02-25 15:47:22 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_icon.lua")
|
2012-10-02 16:57:10 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_output_props.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
dofile("actions/vstudio/cs2005/projectelement.lua")
|
2012-11-26 19:05:33 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_platform_groups.lua")
|
2012-07-10 20:44:44 +00:00
|
|
|
dofile("actions/vstudio/cs2005/test_project_refs.lua")
|
2011-02-16 20:16:07 +00:00
|
|
|
dofile("actions/vstudio/cs2005/projectsettings.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")
|
2012-12-18 16:09:50 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_nested_projects.lua")
|
2012-01-12 21:59:15 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_projects.lua")
|
2012-11-17 20:49:06 +00:00
|
|
|
dofile("actions/vstudio/sln2005/test_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
|
2013-03-04 16:45:27 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_assembly_refs.lua")
|
2012-01-04 22:16:06 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_configuration.lua")
|
2013-03-27 15:12:37 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_compiler_block.lua")
|
2012-02-11 13:18:19 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_debug_settings.lua")
|
2012-11-30 19:05:19 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_excluded_configs.lua")
|
2012-02-11 13:18:19 +00:00
|
|
|
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")
|
2013-04-03 18:09:39 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_nmake_settings.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-06-12 22:16:14 +00:00
|
|
|
dofile("actions/vstudio/vc200x/test_project_refs.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
|
2013-03-04 16:45:27 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_assembly_refs.lua")
|
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-11-30 19:05:19 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_excluded_configs.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")
|
2013-04-03 15:53:00 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_item_def_group.lua")
|
2012-01-27 21:29:41 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_link.lua")
|
2013-04-03 15:53:00 +00:00
|
|
|
dofile("actions/vstudio/vc2010/test_nmake_props.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
|
|
|
|
2013-04-25 13:59:55 +00:00
|
|
|
-- Visual Studio 2012
|
|
|
|
dofile("actions/vs2012/test_sln_header.lua")
|
2012-06-08 19:07:49 +00:00
|
|
|
|
2010-10-04 10:43:19 +00:00
|
|
|
-- Makefile tests
|
2012-06-12 19:57:45 +00:00
|
|
|
dofile("actions/make/test_make_escaping.lua")
|
2012-07-24 20:54:11 +00:00
|
|
|
dofile("actions/make/test_make_tovar.lua")
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
-- Makefile solutions
|
2012-07-24 20:54:11 +00:00
|
|
|
dofile("actions/make/solution/test_config_maps.lua")
|
2012-05-18 00:41:28 +00:00
|
|
|
dofile("actions/make/solution/test_default_config.lua")
|
|
|
|
dofile("actions/make/solution/test_help_rule.lua")
|
2012-07-24 20:54:11 +00:00
|
|
|
dofile("actions/make/solution/test_project_rule.lua")
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
-- Makefile C/C++ projects
|
2013-03-20 15:25:39 +00:00
|
|
|
dofile("actions/make/cpp/test_clang.lua")
|
2012-06-19 19:58:16 +00:00
|
|
|
dofile("actions/make/cpp/test_file_rules.lua")
|
2012-09-13 20:36:53 +00:00
|
|
|
dofile("actions/make/cpp/test_flags.lua")
|
2012-06-12 19:57:45 +00:00
|
|
|
dofile("actions/make/cpp/test_make_pch.lua")
|
2012-06-13 19:21:22 +00:00
|
|
|
dofile("actions/make/cpp/test_make_linking.lua")
|
2012-06-15 22:42:10 +00:00
|
|
|
dofile("actions/make/cpp/test_objects.lua")
|
2012-06-14 19:55:46 +00:00
|
|
|
dofile("actions/make/cpp/test_ps3.lua")
|
2012-06-22 21:15:17 +00:00
|
|
|
dofile("actions/make/cpp/test_target_rules.lua")
|
2012-06-13 22:29:51 +00:00
|
|
|
dofile("actions/make/cpp/test_wiidev.lua")
|
2011-09-15 20:45:48 +00:00
|
|
|
|
2013-02-25 15:47:22 +00:00
|
|
|
-- Makefile C# projects
|
|
|
|
dofile("actions/make/cs/test_flags.lua")
|
|
|
|
|
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"
|
|
|
|
}
|
2013-01-12 16:52:59 +00:00
|
|
|
|
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
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
msg = string.format("%d tests passed, %d failed", passed, failed)
|
|
|
|
if (failed > 0) then
|
2012-10-19 22:53:03 +00:00
|
|
|
-- should probably return an error code here somehow
|
|
|
|
print(msg)
|
2008-10-31 18:38:05 +00:00
|
|
|
else
|
|
|
|
print(msg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|