Merge latest development branch
This commit is contained in:
commit
039d83cc28
@ -1,5 +1,6 @@
|
||||
PREMAKE
|
||||
A build configuration tool
|
||||
Core module
|
||||
|
||||
Copyright (C) 2002-2014 by Jason Perkins
|
||||
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.
|
||||
See their website at http://www.lua.org/
|
||||
|
||||
|
||||
See the file BUILD.txt for instructions on building Premake.
|
||||
|
||||
|
||||
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
|
||||
-- Use this script to configure the project with Premake5.
|
||||
-- You can generate from here if you only want to build Premake's core
|
||||
-- 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
|
||||
-- versions will still be able to regenerate the scripts.
|
||||
-- versions of Premake can be used to bootstrap new builds.
|
||||
--
|
||||
|
||||
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
|
||||
-- default when folks build using the makefile. That way they don't have to
|
||||
-- worry about the /scripts argument and all that.
|
||||
--
|
||||
-- TODO: defaultConfiguration "Release"
|
||||
--
|
||||
|
||||
solution "Premake5"
|
||||
@ -88,6 +125,7 @@
|
||||
links { "m" }
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- 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, '/');
|
||||
if (ptr) *ptr = '\0';
|
||||
lua_pushstring(L, script);
|
||||
lua_setglobal(L, "_SCRIPT_DIR");
|
||||
do_chdir(script);
|
||||
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()
|
||||
local sln, prj = test.createsolution()
|
||||
system "wii"
|
||||
flags "Symbols"
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
end
|
||||
|
||||
@ -36,7 +37,7 @@
|
||||
function suite.writesCorrectLinkerFlags()
|
||||
make.ldFlags(cfg, premake.tools.gcc)
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L$(LIBOGC_LIB) -s $(MACHDEP)
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L$(LIBOGC_LIB) $(MACHDEP)
|
||||
]]
|
||||
end
|
||||
|
||||
|
@ -55,18 +55,6 @@
|
||||
]]
|
||||
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
|
||||
@ -83,15 +71,3 @@
|
||||
AdditionalDependencies="MyProject2.lib"
|
||||
]]
|
||||
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
|
||||
|
||||
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>
|
||||
]]
|
||||
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
|
||||
|
||||
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
|
@ -43,6 +43,6 @@
|
||||
--
|
||||
|
||||
function suite.expandsWildcards()
|
||||
testapi "./*"
|
||||
test.istrue(table.contains(api.scope.project.testapi, os.getcwd() .. "/api"))
|
||||
testapi (_TESTS_DIR .. "/*")
|
||||
test.istrue(table.contains(api.scope.project.testapi, _TESTS_DIR .. "/api"))
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- tests/base/test_include.lua
|
||||
-- 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()
|
||||
include "folder"
|
||||
include (_TESTS_DIR .. "/folder")
|
||||
test.isequal("ok", premake.captured())
|
||||
end
|
||||
|
||||
|
||||
function suite.include_onExactFilename()
|
||||
include "folder/premake4.lua"
|
||||
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||
test.isequal("ok", premake.captured())
|
||||
end
|
||||
|
||||
|
||||
function suite.include_runsOnlyOnce_onMultipleIncludes()
|
||||
include "folder/premake4.lua"
|
||||
include "folder/premake4.lua"
|
||||
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||
test.isequal("ok", premake.captured())
|
||||
end
|
||||
|
||||
|
||||
function suite.include_runsOnlyOnce_onMultipleIncludesWithDifferentPaths()
|
||||
include "folder/premake4.lua"
|
||||
include "../tests/folder/premake4.lua"
|
||||
include (_TESTS_DIR .. "/folder/premake5.lua")
|
||||
include (_TESTS_DIR .. "/../tests/folder/premake5.lua")
|
||||
test.isequal("ok", premake.captured())
|
||||
end
|
||||
|
@ -6,6 +6,17 @@
|
||||
|
||||
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
|
||||
@ -31,7 +42,7 @@
|
||||
--
|
||||
|
||||
function suite.isfile_ReturnsTrue_OnExistingFile()
|
||||
test.istrue(os.isfile("premake5.lua"))
|
||||
test.istrue(os.isfile("_manifest.lua"))
|
||||
end
|
||||
|
||||
function suite.isfile_ReturnsFalse_OnNonexistantFile()
|
||||
@ -109,13 +120,13 @@
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
@ -193,30 +193,6 @@
|
||||
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.
|
||||
--
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
../bin/debug/premake5 /scripts=../src /file=test_stress.lua stress
|
@ -1,2 +1,2 @@
|
||||
#!/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 @@
|
||||
|
||||
CALL ..\\bin\\debug\\premake5 /scripts=..\\src test
|
||||
::CALL ..\\bin\\release\\premake5 /scripts=..\\src test
|
||||
@echo off
|
||||
pushd "%~dp0"
|
||||
..\bin\debug\premake5.exe /scripts=..\src /file=..\premake5.lua %* test
|
||||
popd
|
||||
|
@ -1,36 +1,33 @@
|
||||
--
|
||||
-- tests/test_dofile.lua
|
||||
-- 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
|
||||
|
||||
function T.dofile.setup()
|
||||
function suite.setup()
|
||||
os_getenv = os.getenv
|
||||
end
|
||||
|
||||
function T.dofile.teardown()
|
||||
function suite.teardown()
|
||||
os.getenv = os_getenv
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- dofile() tests
|
||||
--
|
||||
|
||||
function T.dofile.SearchesPath()
|
||||
os.getenv = function() return os.getcwd().."/folder" end
|
||||
function suite.searchesPath()
|
||||
os.getenv = function() return _TESTS_DIR .. "/folder" end
|
||||
result = dofile("ok.lua")
|
||||
test.isequal("ok", result)
|
||||
end
|
||||
|
||||
function T.dofile.SearchesScriptsOption()
|
||||
_OPTIONS["scripts"] = os.getcwd().."/folder"
|
||||
function suite.searchesScriptsOption()
|
||||
_OPTIONS["scripts"] = _TESTS_DIR .. "/folder"
|
||||
result = dofile("ok.lua")
|
||||
test.isequal("ok", result)
|
||||
end
|
||||
|
@ -10,6 +10,7 @@
|
||||
--
|
||||
|
||||
test = {}
|
||||
test.suppressed = {}
|
||||
|
||||
|
||||
--
|
||||
@ -76,6 +77,17 @@
|
||||
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, ...)
|
||||
|
||||
-- if format is a number then it is the stack depth
|
||||
@ -365,15 +377,32 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
function test.declare(id)
|
||||
if T[id] then
|
||||
error("Duplicate test suite " .. id)
|
||||
end
|
||||
T[id] = {}
|
||||
T[id] = {
|
||||
_TESTS_DIR = _TESTS_DIR,
|
||||
_SCRIPT_DIR = _SCRIPT_DIR,
|
||||
}
|
||||
return T[id]
|
||||
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)
|
||||
test.print = print
|
||||
|
||||
@ -387,10 +416,13 @@
|
||||
|
||||
local numpassed = 0
|
||||
local numfailed = 0
|
||||
local start_time = os.clock()
|
||||
|
||||
|
||||
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)
|
||||
|
||||
if ok then
|
||||
@ -410,17 +442,24 @@
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
runtest(suitename, suitetests, testname, suitetests[testname])
|
||||
else
|
||||
for testname, testfunc in pairs(suitetests) do
|
||||
if type(testfunc) == "function" then
|
||||
runtest(suitename, suitetests, testname, testfunc)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if suitename then
|
||||
runsuite(suitename, T[suitename], testname)
|
||||
@ -430,8 +469,6 @@
|
||||
end
|
||||
end
|
||||
|
||||
io.write('running time : ', os.clock() - start_time,'\n')
|
||||
|
||||
print = real_print
|
||||
io.open = real_open
|
||||
io.output = real_output
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
function suite.cppflags_defaultWithMMD()
|
||||
prepare()
|
||||
test.isequal({"-MMD", "-MP"}, gcc.getcppflags(cfg))
|
||||
test.contains({"-MMD", "-MP"}, gcc.getcppflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
function suite.cppflagsExcludeMP_onHaiku()
|
||||
system "Haiku"
|
||||
prepare()
|
||||
test.isequal({ "-MMD" }, gcc.getcppflags(cfg))
|
||||
test.excludes({ "-MP" }, gcc.getcppflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -75,43 +75,43 @@
|
||||
function suite.cflags_onExtraWarnings()
|
||||
warnings "extra"
|
||||
prepare()
|
||||
test.isequal({ "-Wall -Wextra" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-Wall -Wextra" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onFatalWarnings()
|
||||
flags { "FatalWarnings" }
|
||||
prepare()
|
||||
test.isequal({ "-Werror" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-Werror" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onFloastFast()
|
||||
floatingpoint "Fast"
|
||||
prepare()
|
||||
test.isequal({ "-ffast-math" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-ffast-math" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onFloastStrict()
|
||||
floatingpoint "Strict"
|
||||
prepare()
|
||||
test.isequal({ "-ffloat-store" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-ffloat-store" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onNoWarnings()
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.isequal({ "-w" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-w" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSSE()
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.isequal({ "-msse" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-msse" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.isequal({ "-msse2" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-msse2" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -122,37 +122,37 @@
|
||||
function suite.cflags_onNoOptimize()
|
||||
optimize "Off"
|
||||
prepare()
|
||||
test.isequal({ "-O0" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-O0" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOptimize()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.isequal({ "-O2" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-O2" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOptimizeSize()
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.isequal({ "-Os" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-Os" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOptimizeSpeed()
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.isequal({ "-O3" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOptimizeFull()
|
||||
optimize "Full"
|
||||
prepare()
|
||||
test.isequal({ "-O3" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOptimizeDebug()
|
||||
optimize "Debug"
|
||||
prepare()
|
||||
test.isequal({ "-Og" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-Og" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -163,13 +163,13 @@
|
||||
function suite.cflags_onNoExceptions()
|
||||
flags { "NoExceptions" }
|
||||
prepare()
|
||||
test.isequal({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onNoBufferSecurityCheck()
|
||||
flags { "NoBufferSecurityCheck" }
|
||||
prepare()
|
||||
test.isequal({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -177,21 +177,21 @@
|
||||
-- Check the basic translation of LDFLAGS for a Posix system.
|
||||
--
|
||||
|
||||
function suite.ldflags_defaultOnLinux()
|
||||
function suite.ldflags_onNoSymbols()
|
||||
prepare()
|
||||
test.isequal({ "-s" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-s" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onSymbols()
|
||||
flags { "Symbols" }
|
||||
prepare()
|
||||
test.isequal({}, gcc.getldflags(cfg))
|
||||
test.excludes("-s", gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.isequal({ "-s", "-shared" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-shared" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -199,17 +199,17 @@
|
||||
-- Check Mac OS X variants on LDFLAGS.
|
||||
--
|
||||
|
||||
function suite.ldflags_onMacOSXStrip()
|
||||
function suite.ldflags_onMacOSXNoSymbols()
|
||||
system "MacOSX"
|
||||
prepare()
|
||||
test.isequal({ "-Wl,-x" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-Wl,-x" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onMacOSXSharedLib()
|
||||
system "MacOSX"
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.isequal({ "-Wl,-x", "-dynamiclib" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-dynamiclib" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -221,14 +221,14 @@
|
||||
system "Windows"
|
||||
kind "SharedLib"
|
||||
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
|
||||
|
||||
function suite.ldflags_onWindowsApp()
|
||||
system "Windows"
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.isequal({ "-s", "-mwindows" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-mwindows" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -240,25 +240,25 @@
|
||||
function suite.cflags_onX32()
|
||||
architecture "x32"
|
||||
prepare()
|
||||
test.isequal({ "-m32" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-m32" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onX32()
|
||||
architecture "x32"
|
||||
prepare()
|
||||
test.isequal({ "-s", "-m32" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-m32" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onX64()
|
||||
architecture "x64"
|
||||
prepare()
|
||||
test.isequal({ "-m64" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-m64" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onX64()
|
||||
architecture "x64"
|
||||
prepare()
|
||||
test.isequal({ "-s", "-m64" }, gcc.getldflags(cfg))
|
||||
test.contains({ "-m64" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -270,7 +270,7 @@
|
||||
system "MacOSX"
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.isequal({ "-fPIC" }, gcc.getcflags(cfg))
|
||||
test.contains({ "-fPIC" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
@ -281,13 +281,13 @@
|
||||
function suite.links_onSystemLibs()
|
||||
links { "fs_stub", "net_stub" }
|
||||
prepare()
|
||||
test.isequal({ "-lfs_stub", "-lnet_stub" }, gcc.getlinks(cfg))
|
||||
test.contains({ "-lfs_stub", "-lnet_stub" }, gcc.getlinks(cfg))
|
||||
end
|
||||
|
||||
function suite.links_onFramework()
|
||||
links { "Cocoa.framework" }
|
||||
prepare()
|
||||
test.isequal({ "-framework Cocoa" }, gcc.getlinks(cfg))
|
||||
test.contains({ "-framework Cocoa" }, gcc.getlinks(cfg))
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user