Merge automated test framework updates
This commit is contained in:
commit
8f4a17f046
@ -1,5 +1,6 @@
|
|||||||
PREMAKE
|
PREMAKE
|
||||||
A build configuration tool
|
A build configuration tool
|
||||||
|
Core module
|
||||||
|
|
||||||
Copyright (C) 2002-2014 by Jason Perkins
|
Copyright (C) 2002-2014 by Jason Perkins
|
||||||
Distributed under the terms of the BSD License, see LICENSE.txt
|
Distributed under the terms of the BSD License, see LICENSE.txt
|
||||||
@ -7,9 +8,7 @@ A build configuration tool
|
|||||||
The Lua language and runtime library is (C) TeCGraf, PUC-Rio.
|
The Lua language and runtime library is (C) TeCGraf, PUC-Rio.
|
||||||
See their website at http://www.lua.org/
|
See their website at http://www.lua.org/
|
||||||
|
|
||||||
|
|
||||||
See the file BUILD.txt for instructions on building Premake.
|
See the file BUILD.txt for instructions on building Premake.
|
||||||
|
|
||||||
|
|
||||||
For questions, comments, or more information, visit the project
|
For questions, comments, or more information, visit the project
|
||||||
website at http://industriousone.com/premake
|
website at https://bitbucket.org/premake/premake-main
|
||||||
|
44
premake5.lua
44
premake5.lua
@ -1,19 +1,56 @@
|
|||||||
|
---
|
||||||
|
-- Premake 5.x core configuration script
|
||||||
--
|
--
|
||||||
-- Premake 5.x build configuration script
|
-- You can generate from here if you only want to build Premake's core
|
||||||
-- Use this script to configure the project with Premake5.
|
-- component, but you probably want to be one level up in order to get
|
||||||
|
-- the extra modules too.
|
||||||
--
|
--
|
||||||
|
-- If you've been working from premake-dev, you will need to pull a new
|
||||||
|
-- working copy using premake-main to get the extras.
|
||||||
|
---
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Remember my location; I will need it to locate sub-scripts later.
|
||||||
|
--
|
||||||
|
|
||||||
|
local corePath = _SCRIPT_DIR
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Disable deprecation warnings for myself, so that older development
|
-- Disable deprecation warnings for myself, so that older development
|
||||||
-- versions will still be able to regenerate the scripts.
|
-- versions of Premake can be used to bootstrap new builds.
|
||||||
--
|
--
|
||||||
|
|
||||||
premake.api.deprecations "off"
|
premake.api.deprecations "off"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Register supporting actions and options.
|
||||||
|
--
|
||||||
|
|
||||||
|
newaction {
|
||||||
|
trigger = "test",
|
||||||
|
description = "Run the automated test suite",
|
||||||
|
execute = function ()
|
||||||
|
include (path.join(corePath, "scripts/test.lua"))
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "test",
|
||||||
|
description = "When testing, run only the specified suite or test"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Define the project. Put the release configuration first so it will be the
|
-- Define the project. Put the release configuration first so it will be the
|
||||||
-- default when folks build using the makefile. That way they don't have to
|
-- default when folks build using the makefile. That way they don't have to
|
||||||
-- worry about the /scripts argument and all that.
|
-- worry about the /scripts argument and all that.
|
||||||
|
--
|
||||||
|
-- TODO: defaultConfiguration "Release"
|
||||||
--
|
--
|
||||||
|
|
||||||
solution "Premake5"
|
solution "Premake5"
|
||||||
@ -88,6 +125,7 @@
|
|||||||
links { "m" }
|
links { "m" }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- A more thorough cleanup.
|
-- A more thorough cleanup.
|
||||||
--
|
--
|
||||||
|
53
scripts/test.lua
Normal file
53
scripts/test.lua
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
-- Premake automated test runner.
|
||||||
|
---
|
||||||
|
|
||||||
|
include "../tests/testfx.lua"
|
||||||
|
|
||||||
|
|
||||||
|
local focus = {}
|
||||||
|
if _OPTIONS["test"] then
|
||||||
|
focus = string.explode(_OPTIONS["test"] or "", ".", true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Find and load all of the test file manifests
|
||||||
|
--
|
||||||
|
|
||||||
|
local mask = path.join(_MAIN_SCRIPT_DIR, "**/tests/_manifest.lua")
|
||||||
|
local manifests = os.matchfiles(mask)
|
||||||
|
|
||||||
|
-- Hmm, "**" should probably also match against "."?
|
||||||
|
local top = path.join(_MAIN_SCRIPT_DIR, "tests/_manifest.lua")
|
||||||
|
if os.isfile(top) then
|
||||||
|
table.insert(manifests, 1, top)
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, #manifests do
|
||||||
|
local manifest = manifests[i]
|
||||||
|
_TESTS_DIR = path.getdirectory(manifest)
|
||||||
|
local files = dofile(manifest)
|
||||||
|
for f = 1, #files do
|
||||||
|
dofile(path.join(_TESTS_DIR, files[f]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run them and show the results
|
||||||
|
--
|
||||||
|
|
||||||
|
local startTime = os.clock()
|
||||||
|
|
||||||
|
passed, failed = test.runall(focus[1], focus[2])
|
||||||
|
|
||||||
|
io.write('running time : ', os.clock() - startTime,'\n')
|
||||||
|
|
||||||
|
msg = string.format("%d tests passed, %d failed", passed, failed)
|
||||||
|
if (failed > 0) then
|
||||||
|
print(msg)
|
||||||
|
os.exit(5)
|
||||||
|
else
|
||||||
|
print(msg)
|
||||||
|
end
|
@ -49,6 +49,8 @@ static int chunk_wrapper(lua_State* L)
|
|||||||
|
|
||||||
ptr = strrchr(script, '/');
|
ptr = strrchr(script, '/');
|
||||||
if (ptr) *ptr = '\0';
|
if (ptr) *ptr = '\0';
|
||||||
|
lua_pushstring(L, script);
|
||||||
|
lua_setglobal(L, "_SCRIPT_DIR");
|
||||||
do_chdir(script);
|
do_chdir(script);
|
||||||
if (ptr) *ptr = '/';
|
if (ptr) *ptr = '/';
|
||||||
|
|
||||||
|
161
tests/_manifest.lua
Normal file
161
tests/_manifest.lua
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
return {
|
||||||
|
-- Base API tests
|
||||||
|
"test_dofile.lua",
|
||||||
|
"test_string.lua",
|
||||||
|
"base/test_configset.lua",
|
||||||
|
"base/test_context.lua",
|
||||||
|
"base/test_criteria.lua",
|
||||||
|
"base/test_detoken.lua",
|
||||||
|
"base/test_include.lua",
|
||||||
|
"base/test_option.lua",
|
||||||
|
"base/test_os.lua",
|
||||||
|
"base/test_override.lua",
|
||||||
|
"base/test_path.lua",
|
||||||
|
"base/test_premake_command.lua",
|
||||||
|
"base/test_table.lua",
|
||||||
|
"base/test_tree.lua",
|
||||||
|
"base/test_uuid.lua",
|
||||||
|
|
||||||
|
-- Solution object tests
|
||||||
|
"solution/test_eachconfig.lua",
|
||||||
|
"solution/test_location.lua",
|
||||||
|
"solution/test_objdirs.lua",
|
||||||
|
|
||||||
|
-- Project object tests
|
||||||
|
"project/test_config_maps.lua",
|
||||||
|
"project/test_eachconfig.lua",
|
||||||
|
"project/test_getconfig.lua",
|
||||||
|
"project/test_location.lua",
|
||||||
|
"project/test_vpaths.lua",
|
||||||
|
|
||||||
|
-- Configuration object tests
|
||||||
|
"config/test_linkinfo.lua",
|
||||||
|
"config/test_links.lua",
|
||||||
|
"config/test_targetinfo.lua",
|
||||||
|
|
||||||
|
-- Baking tests
|
||||||
|
"oven/test_filtering.lua",
|
||||||
|
"oven/test_objdirs.lua",
|
||||||
|
|
||||||
|
-- API tests
|
||||||
|
"api/test_containers.lua",
|
||||||
|
"api/test_directory_kind.lua",
|
||||||
|
"api/test_list_kind.lua",
|
||||||
|
"api/test_path_kind.lua",
|
||||||
|
"api/test_register.lua",
|
||||||
|
"api/test_string_kind.lua",
|
||||||
|
"api/test_table_kind.lua",
|
||||||
|
|
||||||
|
-- Control system tests
|
||||||
|
"test_premake.lua",
|
||||||
|
"base/test_validation.lua",
|
||||||
|
|
||||||
|
-- -- Toolset tests
|
||||||
|
"tools/test_dotnet.lua",
|
||||||
|
"tools/test_gcc.lua",
|
||||||
|
"tools/test_msc.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2005-2010 C# projects
|
||||||
|
"actions/vstudio/cs2005/test_assembly_refs.lua",
|
||||||
|
"actions/vstudio/cs2005/test_build_events.lua",
|
||||||
|
"actions/vstudio/cs2005/test_compiler_props.lua",
|
||||||
|
"actions/vstudio/cs2005/test_debug_props.lua",
|
||||||
|
"actions/vstudio/cs2005/test_files.lua",
|
||||||
|
"actions/vstudio/cs2005/test_icon.lua",
|
||||||
|
"actions/vstudio/cs2005/test_output_props.lua",
|
||||||
|
"actions/vstudio/cs2005/projectelement.lua",
|
||||||
|
"actions/vstudio/cs2005/test_platform_groups.lua",
|
||||||
|
"actions/vstudio/cs2005/test_project_refs.lua",
|
||||||
|
"actions/vstudio/cs2005/projectsettings.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2005-2010 solutions
|
||||||
|
"actions/vstudio/sln2005/test_dependencies.lua",
|
||||||
|
"actions/vstudio/sln2005/test_header.lua",
|
||||||
|
"actions/vstudio/sln2005/test_nested_projects.lua",
|
||||||
|
"actions/vstudio/sln2005/test_projects.lua",
|
||||||
|
"actions/vstudio/sln2005/test_platforms.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2002-2008 C/C++ projects
|
||||||
|
"actions/vstudio/vc200x/test_assembly_refs.lua",
|
||||||
|
"actions/vstudio/vc200x/test_build_steps.lua",
|
||||||
|
"actions/vstudio/vc200x/test_configuration.lua",
|
||||||
|
"actions/vstudio/vc200x/test_compiler_block.lua",
|
||||||
|
"actions/vstudio/vc200x/test_debug_settings.lua",
|
||||||
|
"actions/vstudio/vc200x/test_excluded_configs.lua",
|
||||||
|
"actions/vstudio/vc200x/test_files.lua",
|
||||||
|
"actions/vstudio/vc200x/test_linker_block.lua",
|
||||||
|
"actions/vstudio/vc200x/test_manifest_block.lua",
|
||||||
|
"actions/vstudio/vc200x/test_nmake_settings.lua",
|
||||||
|
"actions/vstudio/vc200x/test_platforms.lua",
|
||||||
|
"actions/vstudio/vc200x/test_project.lua",
|
||||||
|
"actions/vstudio/vc200x/test_project_refs.lua",
|
||||||
|
"actions/vstudio/vc200x/test_resource_compiler.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2010 C/C++ projects
|
||||||
|
"actions/vstudio/vc2010/test_assembly_refs.lua",
|
||||||
|
"actions/vstudio/vc2010/test_build_events.lua",
|
||||||
|
"actions/vstudio/vc2010/test_compile_settings.lua",
|
||||||
|
"actions/vstudio/vc2010/test_config_props.lua",
|
||||||
|
"actions/vstudio/vc2010/test_debug_settings.lua",
|
||||||
|
"actions/vstudio/vc2010/test_excluded_configs.lua",
|
||||||
|
"actions/vstudio/vc2010/test_extension_settings.lua",
|
||||||
|
"actions/vstudio/vc2010/test_extension_targets.lua",
|
||||||
|
"actions/vstudio/vc2010/test_globals.lua",
|
||||||
|
"actions/vstudio/vc2010/test_header.lua",
|
||||||
|
"actions/vstudio/vc2010/test_files.lua",
|
||||||
|
"actions/vstudio/vc2010/test_filter_ids.lua",
|
||||||
|
"actions/vstudio/vc2010/test_filters.lua",
|
||||||
|
"actions/vstudio/vc2010/test_item_def_group.lua",
|
||||||
|
"actions/vstudio/vc2010/test_link.lua",
|
||||||
|
"actions/vstudio/vc2010/test_manifest.lua",
|
||||||
|
"actions/vstudio/vc2010/test_nmake_props.lua",
|
||||||
|
"actions/vstudio/vc2010/test_output_props.lua",
|
||||||
|
"actions/vstudio/vc2010/test_project_configs.lua",
|
||||||
|
"actions/vstudio/vc2010/test_project_refs.lua",
|
||||||
|
"actions/vstudio/vc2010/test_prop_sheet.lua",
|
||||||
|
"actions/vstudio/vc2010/test_resource_compile.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2012
|
||||||
|
"actions/vs2012/test_csproj_common_props.lua",
|
||||||
|
"actions/vs2012/test_csproj_project_element.lua",
|
||||||
|
"actions/vs2012/test_csproj_project_props.lua",
|
||||||
|
"actions/vs2012/test_csproj_targets.lua",
|
||||||
|
"actions/vs2012/test_sln_header.lua",
|
||||||
|
"actions/vs2012/test_vcxproj_clcompile.lua",
|
||||||
|
"actions/vs2012/test_vcxproj_config_props.lua",
|
||||||
|
|
||||||
|
-- Visual Studio 2013
|
||||||
|
"actions/vs2013/test_csproj_project_element.lua",
|
||||||
|
"actions/vs2013/test_globals.lua",
|
||||||
|
"actions/vs2013/test_sln_header.lua",
|
||||||
|
"actions/vs2013/test_vcxproj_config_props.lua",
|
||||||
|
|
||||||
|
-- Makefile tests
|
||||||
|
"actions/make/test_make_escaping.lua",
|
||||||
|
"actions/make/test_make_tovar.lua",
|
||||||
|
|
||||||
|
-- Makefile solutions
|
||||||
|
"actions/make/solution/test_config_maps.lua",
|
||||||
|
"actions/make/solution/test_default_config.lua",
|
||||||
|
"actions/make/solution/test_help_rule.lua",
|
||||||
|
"actions/make/solution/test_project_rule.lua",
|
||||||
|
|
||||||
|
-- Makefile C/C++ projects
|
||||||
|
"actions/make/cpp/test_clang.lua",
|
||||||
|
"actions/make/cpp/test_file_rules.lua",
|
||||||
|
"actions/make/cpp/test_flags.lua",
|
||||||
|
"actions/make/cpp/test_make_pch.lua",
|
||||||
|
"actions/make/cpp/test_make_linking.lua",
|
||||||
|
"actions/make/cpp/test_objects.lua",
|
||||||
|
"actions/make/cpp/test_target_rules.lua",
|
||||||
|
"actions/make/cpp/test_tools.lua",
|
||||||
|
"actions/make/cpp/test_wiidev.lua",
|
||||||
|
|
||||||
|
-- Makefile C# projects
|
||||||
|
"actions/make/cs/test_embed_files.lua",
|
||||||
|
"actions/make/cs/test_flags.lua",
|
||||||
|
"actions/make/cs/test_links.lua",
|
||||||
|
"actions/make/cs/test_response.lua",
|
||||||
|
"actions/make/cs/test_sources.lua",
|
||||||
|
|
||||||
|
}
|
@ -18,6 +18,7 @@
|
|||||||
function suite.setup()
|
function suite.setup()
|
||||||
local sln, prj = test.createsolution()
|
local sln, prj = test.createsolution()
|
||||||
system "wii"
|
system "wii"
|
||||||
|
flags "Symbols"
|
||||||
cfg = test.getconfig(prj, "Debug")
|
cfg = test.getconfig(prj, "Debug")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,7 +37,7 @@
|
|||||||
function suite.writesCorrectLinkerFlags()
|
function suite.writesCorrectLinkerFlags()
|
||||||
make.ldFlags(cfg, premake.tools.gcc)
|
make.ldFlags(cfg, premake.tools.gcc)
|
||||||
test.capture [[
|
test.capture [[
|
||||||
ALL_LDFLAGS += $(LDFLAGS) -L$(LIBOGC_LIB) -s $(MACHDEP)
|
ALL_LDFLAGS += $(LDFLAGS) -L$(LIBOGC_LIB) $(MACHDEP)
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,18 +55,6 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.normalLink_onIncludedConfig_externalTool()
|
|
||||||
solution("MySolution")
|
|
||||||
system "PS3"
|
|
||||||
prepare("Zeus")
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
OutputFile="$(OutDir)\MyProject.elf"
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- If a sibling is included in one configuration and excluded from
|
-- If a sibling is included in one configuration and excluded from
|
||||||
@ -83,15 +71,3 @@
|
|||||||
AdditionalDependencies="MyProject2.lib"
|
AdditionalDependencies="MyProject2.lib"
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.explicitLink_onExcludedConfig_externalTool()
|
|
||||||
solution("MySolution")
|
|
||||||
system "PS3"
|
|
||||||
prepare("Ares")
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
AdditionalDependencies="libMyProject2.a"
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
--
|
|
||||||
-- tests/actions/vstudio/vc200x/test_external_compiler.lua
|
|
||||||
-- Validate generation the VCCLCompiler element for external tools in VS 200x C/C++ projects.
|
|
||||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
|
||||||
--
|
|
||||||
|
|
||||||
local suite = test.declare("vs200x_external_compiler")
|
|
||||||
local vc200x = premake.vstudio.vc200x
|
|
||||||
local config = premake.config
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Setup/teardown
|
|
||||||
--
|
|
||||||
|
|
||||||
local sln, prj
|
|
||||||
|
|
||||||
function suite.setup()
|
|
||||||
_ACTION = "vs2008"
|
|
||||||
sln, prj = test.createsolution()
|
|
||||||
system "PS3"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function prepare()
|
|
||||||
local cfg = test.getconfig(prj, "Debug")
|
|
||||||
vc200x.VCCLCompilerTool(cfg, config.toolset(cfg))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Verify the basic structure with no extra flags or settings.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.checkDefaults()
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="-Xc+=exceptions -Xc+=rtti"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
ProgramDataBaseFileName=""
|
|
||||||
DebugInformationFormat="0"
|
|
||||||
CompileAs="0"
|
|
||||||
/>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Make sure that include directories are project relative.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.includeDirsAreProjectRelative()
|
|
||||||
includedirs { "../include", "include" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="-Xc+=exceptions -Xc+=rtti"
|
|
||||||
AdditionalIncludeDirectories="..\include;include"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Check handling of forced includes.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.forcedIncludeFiles()
|
|
||||||
forceincludes { "stdafx.h", "include/sys.h" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="-Xc+=exceptions -Xc+=rtti"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
ProgramDataBaseFileName=""
|
|
||||||
DebugInformationFormat="0"
|
|
||||||
CompileAs="0"
|
|
||||||
ForcedIncludeFiles="stdafx.h;include\sys.h"
|
|
||||||
]]
|
|
||||||
end
|
|
@ -1,126 +0,0 @@
|
|||||||
--
|
|
||||||
-- tests/actions/vstudio/vc200x/test_external_compiler.lua
|
|
||||||
-- Validate generation the VCCLLinker element for external tools in VS 200x C/C++ projects.
|
|
||||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
|
||||||
--
|
|
||||||
|
|
||||||
local suite = test.declare("vs200x_external_linker")
|
|
||||||
local vc200x = premake.vstudio.vc200x
|
|
||||||
local config = premake.config
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Setup/teardown
|
|
||||||
--
|
|
||||||
|
|
||||||
local sln, prj
|
|
||||||
|
|
||||||
function suite.setup()
|
|
||||||
_ACTION = "vs2008"
|
|
||||||
sln, prj = test.createsolution()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
system "PS3"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function prepare()
|
|
||||||
local cfg = test.getconfig(prj, "Debug")
|
|
||||||
vc200x.VCLinkerTool(cfg, config.toolset(cfg))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Verify the basic structure of a PS3 executable, with no extra
|
|
||||||
-- flags or settings.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.looksGood_onPS3ConsoleApp()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
OutputFile="$(OutDir)\MyProject.elf"
|
|
||||||
LinkIncremental="0"
|
|
||||||
GenerateManifest="false"
|
|
||||||
ProgramDatabaseFile=""
|
|
||||||
/>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Verify the structure of a PS3 static library.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.looksGood_onPS3StaticLib()
|
|
||||||
kind "StaticLib"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
OutputFile="$(OutDir)\libMyProject.a"
|
|
||||||
/>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Verify the handling of system libraries.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.additionalDependencies_onSystemLibs()
|
|
||||||
links { "fs_stub", "net_stub" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
AdditionalDependencies="-lfs_stub -lnet_stub"
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Sibling dependencies should not appear in the list of links;
|
|
||||||
-- Visual Studio will add those automatically.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.excludesSiblings()
|
|
||||||
links { "MyProject2" }
|
|
||||||
project ("MyProject2")
|
|
||||||
system "PS3"
|
|
||||||
kind "StaticLib"
|
|
||||||
language "C++"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
OutputFile="$(OutDir)\MyProject.elf"
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Sibling dependencies should appear in the list of links if
|
|
||||||
-- the NoImplicitLinks flag is set.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.includesSiblings_onNoExplicitLink()
|
|
||||||
flags { "NoImplicitLink" }
|
|
||||||
links { "MyProject2" }
|
|
||||||
project ("MyProject2")
|
|
||||||
system "PS3"
|
|
||||||
kind "StaticLib"
|
|
||||||
language "C++"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="-s"
|
|
||||||
AdditionalDependencies="libMyProject2.a"
|
|
||||||
]]
|
|
||||||
end
|
|
@ -57,18 +57,6 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.normalLink_onIncludedConfig_externalTool()
|
|
||||||
solution("MySolution")
|
|
||||||
system "PS3"
|
|
||||||
prepare("Zeus")
|
|
||||||
test.capture [[
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
|
||||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
|
||||||
</Link>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -91,20 +79,3 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.explicitLink_onExcludedConfig_externalTool()
|
|
||||||
solution("MySolution")
|
|
||||||
system "PS3"
|
|
||||||
prepare("Ares")
|
|
||||||
test.capture [[
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>libMyProject2.a;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
|
||||||
</Link>
|
|
||||||
<ProjectReference>
|
|
||||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
|
||||||
</ProjectReference>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
@ -311,23 +311,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- On the PS3, system libraries must be prefixed with the "-l" flag.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.additionalDependencies_onPS3SystemLinks()
|
|
||||||
system "PS3"
|
|
||||||
links { "fs_stub", "net_stub" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>-lfs_stub;-lnet_stub;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Correctly handle module definition (.def) files.
|
-- Correctly handle module definition (.def) files.
|
||||||
--
|
--
|
||||||
|
@ -43,6 +43,6 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
function suite.expandsWildcards()
|
function suite.expandsWildcards()
|
||||||
testapi "./*"
|
testapi (_TESTS_DIR .. "/*")
|
||||||
test.istrue(table.contains(api.scope.project.testapi, os.getcwd() .. "/api"))
|
test.istrue(table.contains(api.scope.project.testapi, _TESTS_DIR .. "/api"))
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
--
|
--
|
||||||
-- tests/base/test_include.lua
|
-- tests/base/test_include.lua
|
||||||
-- Test the include() function, for including external scripts
|
-- Test the include() function, for including external scripts
|
||||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
@ -23,26 +23,26 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
function suite.include_findsPremakeFile_onFolderNameOnly()
|
function suite.include_findsPremakeFile_onFolderNameOnly()
|
||||||
include "folder"
|
include (_TESTS_DIR .. "/folder")
|
||||||
test.isequal("ok", premake.captured())
|
test.isequal("ok", premake.captured())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.include_onExactFilename()
|
function suite.include_onExactFilename()
|
||||||
include "folder/premake4.lua"
|
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||||
test.isequal("ok", premake.captured())
|
test.isequal("ok", premake.captured())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.include_runsOnlyOnce_onMultipleIncludes()
|
function suite.include_runsOnlyOnce_onMultipleIncludes()
|
||||||
include "folder/premake4.lua"
|
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||||
include "folder/premake4.lua"
|
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||||
test.isequal("ok", premake.captured())
|
test.isequal("ok", premake.captured())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.include_runsOnlyOnce_onMultipleIncludesWithDifferentPaths()
|
function suite.include_runsOnlyOnce_onMultipleIncludesWithDifferentPaths()
|
||||||
include "folder/premake4.lua"
|
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||||
include "../tests/folder/premake4.lua"
|
include (_TESTS_DIR .. "/../tests/folder/premake5.lua")
|
||||||
test.isequal("ok", premake.captured())
|
test.isequal("ok", premake.captured())
|
||||||
end
|
end
|
||||||
|
@ -6,6 +6,17 @@
|
|||||||
|
|
||||||
local suite = test.declare("base_os")
|
local suite = test.declare("base_os")
|
||||||
|
|
||||||
|
local cwd
|
||||||
|
|
||||||
|
function suite.setup()
|
||||||
|
cwd = os.getcwd()
|
||||||
|
os.chdir(_TESTS_DIR)
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.teardown()
|
||||||
|
os.chdir(cwd)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- os.findlib() tests
|
-- os.findlib() tests
|
||||||
@ -31,7 +42,7 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
function suite.isfile_ReturnsTrue_OnExistingFile()
|
function suite.isfile_ReturnsTrue_OnExistingFile()
|
||||||
test.istrue(os.isfile("premake5.lua"))
|
test.istrue(os.isfile("_manifest.lua"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.isfile_ReturnsFalse_OnNonexistantFile()
|
function suite.isfile_ReturnsFalse_OnNonexistantFile()
|
||||||
@ -105,17 +116,17 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
function suite.pathsearch_ReturnsNil_OnNotFound()
|
function suite.pathsearch_ReturnsNil_OnNotFound()
|
||||||
test.istrue( os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil )
|
test.istrue(os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.pathsearch_ReturnsPath_OnFound()
|
function suite.pathsearch_ReturnsPath_OnFound()
|
||||||
test.isequal(os.getcwd(), os.pathsearch("premake5.lua", os.getcwd()))
|
test.isequal(_TESTS_DIR, os.pathsearch("_manifest.lua", _TESTS_DIR))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.pathsearch_FindsFile_OnComplexPath()
|
function suite.pathsearch_FindsFile_OnComplexPath()
|
||||||
test.isequal(os.getcwd(), os.pathsearch("premake5.lua", "aaa;"..os.getcwd()..";bbb"))
|
test.isequal(_TESTS_DIR, os.pathsearch("_manifest.lua", "aaa;" .. _TESTS_DIR .. ";bbb"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.pathsearch_NilPathsAllowed()
|
function suite.pathsearch_NilPathsAllowed()
|
||||||
test.isequal(os.getcwd(), os.pathsearch("premake5.lua", nil, os.getcwd(), nil))
|
test.isequal(_TESTS_DIR, os.pathsearch("_manifest.lua", nil, _TESTS_DIR, nil))
|
||||||
end
|
end
|
||||||
|
@ -193,30 +193,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name should use ".elf" for PS3 executables.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.nameUsesElf_onPS3ConsoleApp()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
system "PS3"
|
|
||||||
i = prepare()
|
|
||||||
test.isequal("MyProject.elf", i.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name should use "lib" and ".a" for PS3 static libraries.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.nameUsesLib_onPS3StaticLib()
|
|
||||||
kind "StaticLib"
|
|
||||||
system "PS3"
|
|
||||||
i = prepare()
|
|
||||||
test.isequal("libMyProject.a", i.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name should use ".exe" for Xbox360 executables.
|
-- Name should use ".exe" for Xbox360 executables.
|
||||||
--
|
--
|
||||||
|
@ -1,230 +0,0 @@
|
|||||||
--
|
|
||||||
-- tests/premake5.lua
|
|
||||||
-- Automated test suite for Premake 5.x
|
|
||||||
-- Copyright (c) 2008-2013 Jason Perkins and the Premake project
|
|
||||||
--
|
|
||||||
|
|
||||||
dofile("testfx.lua")
|
|
||||||
|
|
||||||
newoption {
|
|
||||||
trigger = "test",
|
|
||||||
description = "A suite or test to run"
|
|
||||||
}
|
|
||||||
|
|
||||||
newoption {
|
|
||||||
trigger = "profile",
|
|
||||||
description = "Profile execution times; saves to profile.txt"
|
|
||||||
}
|
|
||||||
|
|
||||||
if _OPTIONS["profile"] then
|
|
||||||
dofile("pepperfish_profiler.lua")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- The test suites
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Base API tests
|
|
||||||
dofile("test_dofile.lua")
|
|
||||||
dofile("test_string.lua")
|
|
||||||
|
|
||||||
dofile("base/test_configset.lua")
|
|
||||||
dofile("base/test_context.lua")
|
|
||||||
dofile("base/test_criteria.lua")
|
|
||||||
dofile("base/test_detoken.lua")
|
|
||||||
dofile("base/test_include.lua")
|
|
||||||
dofile("base/test_option.lua")
|
|
||||||
dofile("base/test_os.lua")
|
|
||||||
dofile("base/test_override.lua")
|
|
||||||
dofile("base/test_path.lua")
|
|
||||||
dofile("base/test_premake_command.lua")
|
|
||||||
dofile("base/test_table.lua")
|
|
||||||
dofile("base/test_tree.lua")
|
|
||||||
dofile("base/test_uuid.lua")
|
|
||||||
|
|
||||||
-- Solution object tests
|
|
||||||
dofile("solution/test_eachconfig.lua")
|
|
||||||
dofile("solution/test_location.lua")
|
|
||||||
dofile("solution/test_objdirs.lua")
|
|
||||||
|
|
||||||
-- Project object tests
|
|
||||||
dofile("project/test_config_maps.lua")
|
|
||||||
dofile("project/test_eachconfig.lua")
|
|
||||||
dofile("project/test_filename.lua")
|
|
||||||
dofile("project/test_getconfig.lua")
|
|
||||||
dofile("project/test_location.lua")
|
|
||||||
dofile("project/test_vpaths.lua")
|
|
||||||
|
|
||||||
-- Configuration object tests
|
|
||||||
dofile("config/test_linkinfo.lua")
|
|
||||||
dofile("config/test_links.lua")
|
|
||||||
dofile("config/test_targetinfo.lua")
|
|
||||||
|
|
||||||
-- Baking tests
|
|
||||||
dofile("oven/test_filtering.lua")
|
|
||||||
dofile("oven/test_objdirs.lua")
|
|
||||||
|
|
||||||
-- API tests
|
|
||||||
dofile("api/test_containers.lua")
|
|
||||||
dofile("api/test_directory_kind.lua")
|
|
||||||
dofile("api/test_list_kind.lua")
|
|
||||||
dofile("api/test_path_kind.lua")
|
|
||||||
dofile("api/test_register.lua")
|
|
||||||
dofile("api/test_string_kind.lua")
|
|
||||||
dofile("api/test_table_kind.lua")
|
|
||||||
|
|
||||||
-- Control system tests
|
|
||||||
dofile("test_premake.lua")
|
|
||||||
dofile("base/test_validation.lua")
|
|
||||||
|
|
||||||
-- Toolset tests
|
|
||||||
dofile("tools/test_dotnet.lua")
|
|
||||||
dofile("tools/test_gcc.lua")
|
|
||||||
dofile("tools/test_msc.lua")
|
|
||||||
dofile("tools/test_snc.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2005-2010 C# projects
|
|
||||||
dofile("actions/vstudio/cs2005/test_assembly_refs.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_build_events.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_compiler_props.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_debug_props.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_files.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_icon.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_output_props.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/projectelement.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_platform_groups.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/test_project_refs.lua")
|
|
||||||
dofile("actions/vstudio/cs2005/projectsettings.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2005-2010 solutions
|
|
||||||
dofile("actions/vstudio/sln2005/test_dependencies.lua")
|
|
||||||
dofile("actions/vstudio/sln2005/test_header.lua")
|
|
||||||
dofile("actions/vstudio/sln2005/test_nested_projects.lua")
|
|
||||||
dofile("actions/vstudio/sln2005/test_projects.lua")
|
|
||||||
dofile("actions/vstudio/sln2005/test_platforms.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2002-2008 C/C++ projects
|
|
||||||
dofile("actions/vstudio/vc200x/test_assembly_refs.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_build_steps.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_configuration.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_compiler_block.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_debug_settings.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_excluded_configs.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_external_compiler.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_external_linker.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_files.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_linker_block.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_manifest_block.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_nmake_settings.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_platforms.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_project.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_project_refs.lua")
|
|
||||||
dofile("actions/vstudio/vc200x/test_resource_compiler.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2010 C/C++ projects
|
|
||||||
dofile("actions/vstudio/vc2010/test_assembly_refs.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_build_events.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_compile_settings.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_config_props.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_debug_settings.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_excluded_configs.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_extension_settings.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_extension_targets.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_globals.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_header.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_files.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_filter_ids.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_filters.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_item_def_group.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_link.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_manifest.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_nmake_props.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_output_props.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_project_configs.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_project_refs.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_prop_sheet.lua")
|
|
||||||
dofile("actions/vstudio/vc2010/test_resource_compile.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2012
|
|
||||||
dofile("actions/vs2012/test_csproj_common_props.lua")
|
|
||||||
dofile("actions/vs2012/test_csproj_project_element.lua")
|
|
||||||
dofile("actions/vs2012/test_csproj_project_props.lua")
|
|
||||||
dofile("actions/vs2012/test_csproj_targets.lua")
|
|
||||||
dofile("actions/vs2012/test_sln_header.lua")
|
|
||||||
dofile("actions/vs2012/test_vcxproj_clcompile.lua")
|
|
||||||
dofile("actions/vs2012/test_vcxproj_config_props.lua")
|
|
||||||
|
|
||||||
-- Visual Studio 2013
|
|
||||||
dofile("actions/vs2013/test_csproj_project_element.lua")
|
|
||||||
dofile("actions/vs2013/test_globals.lua")
|
|
||||||
dofile("actions/vs2013/test_sln_header.lua")
|
|
||||||
dofile("actions/vs2013/test_vcxproj_config_props.lua")
|
|
||||||
|
|
||||||
-- Makefile tests
|
|
||||||
dofile("actions/make/test_make_escaping.lua")
|
|
||||||
dofile("actions/make/test_make_tovar.lua")
|
|
||||||
|
|
||||||
-- Makefile solutions
|
|
||||||
dofile("actions/make/solution/test_config_maps.lua")
|
|
||||||
dofile("actions/make/solution/test_default_config.lua")
|
|
||||||
dofile("actions/make/solution/test_help_rule.lua")
|
|
||||||
dofile("actions/make/solution/test_project_rule.lua")
|
|
||||||
|
|
||||||
-- Makefile C/C++ projects
|
|
||||||
dofile("actions/make/cpp/test_clang.lua")
|
|
||||||
dofile("actions/make/cpp/test_file_rules.lua")
|
|
||||||
dofile("actions/make/cpp/test_flags.lua")
|
|
||||||
dofile("actions/make/cpp/test_make_pch.lua")
|
|
||||||
dofile("actions/make/cpp/test_make_linking.lua")
|
|
||||||
dofile("actions/make/cpp/test_objects.lua")
|
|
||||||
dofile("actions/make/cpp/test_ps3.lua")
|
|
||||||
dofile("actions/make/cpp/test_target_rules.lua")
|
|
||||||
dofile("actions/make/cpp/test_tools.lua")
|
|
||||||
dofile("actions/make/cpp/test_wiidev.lua")
|
|
||||||
|
|
||||||
-- Makefile C# projects
|
|
||||||
dofile("actions/make/cs/test_embed_files.lua")
|
|
||||||
dofile("actions/make/cs/test_flags.lua")
|
|
||||||
dofile("actions/make/cs/test_links.lua")
|
|
||||||
dofile("actions/make/cs/test_response.lua")
|
|
||||||
dofile("actions/make/cs/test_sources.lua")
|
|
||||||
|
|
||||||
|
|
||||||
newaction {
|
|
||||||
trigger = "test",
|
|
||||||
description = "Run the automated test suite",
|
|
||||||
|
|
||||||
execute = function ()
|
|
||||||
local focus = {}
|
|
||||||
if _OPTIONS["test"] then
|
|
||||||
focus = string.explode(_OPTIONS["test"] or "", ".", true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local profile = _OPTIONS["profile"]
|
|
||||||
if profile == "" then profile = "time" end
|
|
||||||
|
|
||||||
local profiler
|
|
||||||
if profile then
|
|
||||||
profiler = newProfiler()
|
|
||||||
profiler:start()
|
|
||||||
end
|
|
||||||
|
|
||||||
passed, failed = test.runall(focus[1], focus[2])
|
|
||||||
|
|
||||||
if profile then
|
|
||||||
profiler:stop()
|
|
||||||
local outfile = io.open("profile.txt", "w+")
|
|
||||||
profiler:report(outfile)
|
|
||||||
outfile:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
msg = string.format("%d tests passed, %d failed", passed, failed)
|
|
||||||
if (failed > 0) then
|
|
||||||
print(msg)
|
|
||||||
os.exit(5)
|
|
||||||
else
|
|
||||||
print(msg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
../bin/debug/premake5 /scripts=../src /file=test_stress.lua stress
|
|
@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd `dirname $0` && ../bin/debug/premake5 /scripts=../src $1 $2 $3 test
|
cd `dirname $0` && ../bin/debug/premake5 /file=../premake5.lua /scripts=../src $1 $2 $3 test
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
@echo off
|
||||||
CALL ..\\bin\\debug\\premake5 /scripts=..\\src test
|
pushd "%~dp0"
|
||||||
::CALL ..\\bin\\release\\premake5 /scripts=..\\src test
|
..\bin\debug\premake5.exe /scripts=..\src /file=..\premake5.lua %* test
|
||||||
|
popd
|
||||||
|
@ -1,36 +1,33 @@
|
|||||||
--
|
--
|
||||||
-- tests/test_dofile.lua
|
-- tests/test_dofile.lua
|
||||||
-- Automated test suite for the extended dofile() functions.
|
-- Automated test suite for the extended dofile() functions.
|
||||||
-- Copyright (c) 2008 Jason Perkins and the Premake project
|
-- Copyright (c) 2008, 2014 Jason Perkins and the Premake project
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
T.dofile = { }
|
local suite = test.declare("do_file")
|
||||||
|
|
||||||
|
|
||||||
local os_getenv
|
local os_getenv
|
||||||
|
|
||||||
function T.dofile.setup()
|
function suite.setup()
|
||||||
os_getenv = os.getenv
|
os_getenv = os.getenv
|
||||||
end
|
end
|
||||||
|
|
||||||
function T.dofile.teardown()
|
function suite.teardown()
|
||||||
os.getenv = os_getenv
|
os.getenv = os_getenv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- dofile() tests
|
|
||||||
--
|
|
||||||
|
|
||||||
function T.dofile.SearchesPath()
|
function suite.searchesPath()
|
||||||
os.getenv = function() return os.getcwd().."/folder" end
|
os.getenv = function() return _TESTS_DIR .. "/folder" end
|
||||||
result = dofile("ok.lua")
|
result = dofile("ok.lua")
|
||||||
test.isequal("ok", result)
|
test.isequal("ok", result)
|
||||||
end
|
end
|
||||||
|
|
||||||
function T.dofile.SearchesScriptsOption()
|
function suite.searchesScriptsOption()
|
||||||
_OPTIONS["scripts"] = os.getcwd().."/folder"
|
_OPTIONS["scripts"] = _TESTS_DIR .. "/folder"
|
||||||
result = dofile("ok.lua")
|
result = dofile("ok.lua")
|
||||||
test.isequal("ok", result)
|
test.isequal("ok", result)
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
test = {}
|
test = {}
|
||||||
|
test.suppressed = {}
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -76,6 +77,17 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function test.excludes(expected, actual)
|
||||||
|
if type(expected) == "table" then
|
||||||
|
for i, v in ipairs(expected) do
|
||||||
|
test.excludes(v, actual)
|
||||||
|
end
|
||||||
|
elseif table.contains(actual, expected) then
|
||||||
|
test.fail("excluded value %s found", expected)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function test.fail(format, ...)
|
function test.fail(format, ...)
|
||||||
|
|
||||||
-- if format is a number then it is the stack depth
|
-- if format is a number then it is the stack depth
|
||||||
@ -365,15 +377,32 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function test.declare(id)
|
function test.declare(id)
|
||||||
if T[id] then
|
if T[id] then
|
||||||
error("Duplicate test suite " .. id)
|
error("Duplicate test suite " .. id)
|
||||||
end
|
end
|
||||||
T[id] = {}
|
T[id] = {
|
||||||
|
_TESTS_DIR = _TESTS_DIR,
|
||||||
|
_SCRIPT_DIR = _SCRIPT_DIR,
|
||||||
|
}
|
||||||
return T[id]
|
return T[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function test.suppress(id)
|
||||||
|
if type(id) == "table" then
|
||||||
|
for i = 1, #id do
|
||||||
|
test.suppress(id[i])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
test.suppressed[id] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function test.runall(suitename, testname)
|
function test.runall(suitename, testname)
|
||||||
test.print = print
|
test.print = print
|
||||||
|
|
||||||
@ -387,10 +416,13 @@
|
|||||||
|
|
||||||
local numpassed = 0
|
local numpassed = 0
|
||||||
local numfailed = 0
|
local numfailed = 0
|
||||||
local start_time = os.clock()
|
|
||||||
|
|
||||||
function runtest(suitename, suitetests, testname, testfunc)
|
function runtest(suitename, suitetests, testname, testfunc)
|
||||||
if suitetests.setup ~= testfunc and suitetests.teardown ~= testfunc then
|
if suitetests.setup ~= testfunc and
|
||||||
|
suitetests.teardown ~= testfunc and
|
||||||
|
not test.suppressed[suitename .. "." .. testname]
|
||||||
|
then
|
||||||
local ok, err = test_setup(suitetests, testfunc)
|
local ok, err = test_setup(suitetests, testfunc)
|
||||||
|
|
||||||
if ok then
|
if ok then
|
||||||
@ -410,18 +442,25 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function runsuite(suitename, suitetests, testname)
|
function runsuite(suitename, suitetests, testname)
|
||||||
if suitetests then
|
if suitetests and not test.suppressed[suitename] then
|
||||||
|
_TESTS_DIR = suitetests._TESTS_DIR
|
||||||
|
_SCRIPT_DIR = suitetests._SCRIPT_DIR
|
||||||
|
|
||||||
if testname then
|
if testname then
|
||||||
runtest(suitename, suitetests, testname, suitetests[testname])
|
runtest(suitename, suitetests, testname, suitetests[testname])
|
||||||
else
|
else
|
||||||
for testname, testfunc in pairs(suitetests) do
|
for testname, testfunc in pairs(suitetests) do
|
||||||
runtest(suitename, suitetests, testname, testfunc)
|
if type(testfunc) == "function" then
|
||||||
|
runtest(suitename, suitetests, testname, testfunc)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if suitename then
|
if suitename then
|
||||||
runsuite(suitename, T[suitename], testname)
|
runsuite(suitename, T[suitename], testname)
|
||||||
else
|
else
|
||||||
@ -430,8 +469,6 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
io.write('running time : ', os.clock() - start_time,'\n')
|
|
||||||
|
|
||||||
print = real_print
|
print = real_print
|
||||||
io.open = real_open
|
io.open = real_open
|
||||||
io.output = real_output
|
io.output = real_output
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
function suite.cppflags_defaultWithMMD()
|
function suite.cppflags_defaultWithMMD()
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({"-MMD", "-MP"}, gcc.getcppflags(cfg))
|
test.contains({"-MMD", "-MP"}, gcc.getcppflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +64,7 @@
|
|||||||
function suite.cppflagsExcludeMP_onHaiku()
|
function suite.cppflagsExcludeMP_onHaiku()
|
||||||
system "Haiku"
|
system "Haiku"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-MMD" }, gcc.getcppflags(cfg))
|
test.excludes({ "-MP" }, gcc.getcppflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -75,43 +75,43 @@
|
|||||||
function suite.cflags_onExtraWarnings()
|
function suite.cflags_onExtraWarnings()
|
||||||
warnings "extra"
|
warnings "extra"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Wall -Wextra" }, gcc.getcflags(cfg))
|
test.contains({ "-Wall -Wextra" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onFatalWarnings()
|
function suite.cflags_onFatalWarnings()
|
||||||
flags { "FatalWarnings" }
|
flags { "FatalWarnings" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Werror" }, gcc.getcflags(cfg))
|
test.contains({ "-Werror" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onFloastFast()
|
function suite.cflags_onFloastFast()
|
||||||
floatingpoint "Fast"
|
floatingpoint "Fast"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-ffast-math" }, gcc.getcflags(cfg))
|
test.contains({ "-ffast-math" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onFloastStrict()
|
function suite.cflags_onFloastStrict()
|
||||||
floatingpoint "Strict"
|
floatingpoint "Strict"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-ffloat-store" }, gcc.getcflags(cfg))
|
test.contains({ "-ffloat-store" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onNoWarnings()
|
function suite.cflags_onNoWarnings()
|
||||||
warnings "Off"
|
warnings "Off"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-w" }, gcc.getcflags(cfg))
|
test.contains({ "-w" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onSSE()
|
function suite.cflags_onSSE()
|
||||||
vectorextensions "SSE"
|
vectorextensions "SSE"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-msse" }, gcc.getcflags(cfg))
|
test.contains({ "-msse" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onSSE2()
|
function suite.cflags_onSSE2()
|
||||||
vectorextensions "SSE2"
|
vectorextensions "SSE2"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-msse2" }, gcc.getcflags(cfg))
|
test.contains({ "-msse2" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -122,37 +122,37 @@
|
|||||||
function suite.cflags_onNoOptimize()
|
function suite.cflags_onNoOptimize()
|
||||||
optimize "Off"
|
optimize "Off"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-O0" }, gcc.getcflags(cfg))
|
test.contains({ "-O0" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onOptimize()
|
function suite.cflags_onOptimize()
|
||||||
optimize "On"
|
optimize "On"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-O2" }, gcc.getcflags(cfg))
|
test.contains({ "-O2" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onOptimizeSize()
|
function suite.cflags_onOptimizeSize()
|
||||||
optimize "Size"
|
optimize "Size"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Os" }, gcc.getcflags(cfg))
|
test.contains({ "-Os" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onOptimizeSpeed()
|
function suite.cflags_onOptimizeSpeed()
|
||||||
optimize "Speed"
|
optimize "Speed"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-O3" }, gcc.getcflags(cfg))
|
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onOptimizeFull()
|
function suite.cflags_onOptimizeFull()
|
||||||
optimize "Full"
|
optimize "Full"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-O3" }, gcc.getcflags(cfg))
|
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onOptimizeDebug()
|
function suite.cflags_onOptimizeDebug()
|
||||||
optimize "Debug"
|
optimize "Debug"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Og" }, gcc.getcflags(cfg))
|
test.contains({ "-Og" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -163,13 +163,13 @@
|
|||||||
function suite.cflags_onNoExceptions()
|
function suite.cflags_onNoExceptions()
|
||||||
flags { "NoExceptions" }
|
flags { "NoExceptions" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
test.contains({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onNoBufferSecurityCheck()
|
function suite.cflags_onNoBufferSecurityCheck()
|
||||||
flags { "NoBufferSecurityCheck" }
|
flags { "NoBufferSecurityCheck" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
test.contains({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -177,21 +177,21 @@
|
|||||||
-- Check the basic translation of LDFLAGS for a Posix system.
|
-- Check the basic translation of LDFLAGS for a Posix system.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.ldflags_defaultOnLinux()
|
function suite.ldflags_onNoSymbols()
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s" }, gcc.getldflags(cfg))
|
test.contains({ "-s" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onSymbols()
|
function suite.ldflags_onSymbols()
|
||||||
flags { "Symbols" }
|
flags { "Symbols" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({}, gcc.getldflags(cfg))
|
test.excludes("-s", gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onSharedLib()
|
function suite.ldflags_onSharedLib()
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s", "-shared" }, gcc.getldflags(cfg))
|
test.contains({ "-shared" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -199,17 +199,17 @@
|
|||||||
-- Check Mac OS X variants on LDFLAGS.
|
-- Check Mac OS X variants on LDFLAGS.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.ldflags_onMacOSXStrip()
|
function suite.ldflags_onMacOSXNoSymbols()
|
||||||
system "MacOSX"
|
system "MacOSX"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Wl,-x" }, gcc.getldflags(cfg))
|
test.contains({ "-Wl,-x" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onMacOSXSharedLib()
|
function suite.ldflags_onMacOSXSharedLib()
|
||||||
system "MacOSX"
|
system "MacOSX"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-Wl,-x", "-dynamiclib" }, gcc.getldflags(cfg))
|
test.contains({ "-dynamiclib" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -221,14 +221,14 @@
|
|||||||
system "Windows"
|
system "Windows"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s", "-shared", '-Wl,--out-implib="MyProject.lib"' }, gcc.getldflags(cfg))
|
test.contains({ "-shared", '-Wl,--out-implib="MyProject.lib"' }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onWindowsApp()
|
function suite.ldflags_onWindowsApp()
|
||||||
system "Windows"
|
system "Windows"
|
||||||
kind "WindowedApp"
|
kind "WindowedApp"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s", "-mwindows" }, gcc.getldflags(cfg))
|
test.contains({ "-mwindows" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -240,25 +240,25 @@
|
|||||||
function suite.cflags_onX32()
|
function suite.cflags_onX32()
|
||||||
architecture "x32"
|
architecture "x32"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-m32" }, gcc.getcflags(cfg))
|
test.contains({ "-m32" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onX32()
|
function suite.ldflags_onX32()
|
||||||
architecture "x32"
|
architecture "x32"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s", "-m32" }, gcc.getldflags(cfg))
|
test.contains({ "-m32" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onX64()
|
function suite.cflags_onX64()
|
||||||
architecture "x64"
|
architecture "x64"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-m64" }, gcc.getcflags(cfg))
|
test.contains({ "-m64" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ldflags_onX64()
|
function suite.ldflags_onX64()
|
||||||
architecture "x64"
|
architecture "x64"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-s", "-m64" }, gcc.getldflags(cfg))
|
test.contains({ "-m64" }, gcc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -270,7 +270,7 @@
|
|||||||
system "MacOSX"
|
system "MacOSX"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-fPIC" }, gcc.getcflags(cfg))
|
test.contains({ "-fPIC" }, gcc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -281,13 +281,13 @@
|
|||||||
function suite.links_onSystemLibs()
|
function suite.links_onSystemLibs()
|
||||||
links { "fs_stub", "net_stub" }
|
links { "fs_stub", "net_stub" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-lfs_stub", "-lnet_stub" }, gcc.getlinks(cfg))
|
test.contains({ "-lfs_stub", "-lnet_stub" }, gcc.getlinks(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.links_onFramework()
|
function suite.links_onFramework()
|
||||||
links { "Cocoa.framework" }
|
links { "Cocoa.framework" }
|
||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "-framework Cocoa" }, gcc.getlinks(cfg))
|
test.contains({ "-framework Cocoa" }, gcc.getlinks(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user