Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2011-11-13 18:27:27 +0400
committerJason Perkins <starkos@industriousone.com>2011-11-13 18:27:27 +0400
commitfd26375aee5d111037f06ee0a4ba39cda388e9e4 (patch)
treec2626928bcc52f6b61df1cd49959c2a711555b42 /tests
parentbf1e7ed1e524e895414438c74474f1537550eea5 (diff)
parentcc5dbeb230236023a4d99e8d106081e9ecf5c469 (diff)
Merge latest changes from premake-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/actions/make/test_make_pch.lua12
-rw-r--r--tests/actions/make/test_makesettings.lua51
-rw-r--r--tests/actions/make/test_wiidev.lua56
-rw-r--r--tests/actions/vstudio/test_vs2010_vcxproj.lua120
-rw-r--r--tests/actions/vstudio/vc200x/files.lua73
-rw-r--r--tests/actions/vstudio/vc200x/test_filters.lua6
-rw-r--r--tests/actions/vstudio/vc2010/test_links.lua87
-rw-r--r--tests/actions/xcode/test_xcode4_project.lua59
-rw-r--r--tests/actions/xcode/test_xcode_dependencies.lua4
-rw-r--r--tests/actions/xcode/test_xcode_project.lua35
-rw-r--r--tests/premake4.lua24
-rw-r--r--tests/project/test_vpaths.lua29
-rw-r--r--tests/test_gmake_cpp.lua8
-rw-r--r--tests/testfx.lua1
14 files changed, 446 insertions, 119 deletions
diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua
index 8d772d4..f52bf3e 100644
--- a/tests/actions/make/test_make_pch.lua
+++ b/tests/actions/make/test_make_pch.lua
@@ -68,8 +68,12 @@
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
+ifeq (posix,$(SHELLTYPE))
-$(SILENT) cp $< $(OBJDIR)
- $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
+else
+ $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
+endif
+ $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
endif
]]
end
@@ -83,8 +87,12 @@ endif
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
+ifeq (posix,$(SHELLTYPE))
-$(SILENT) cp $< $(OBJDIR)
- $(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"
+else
+ $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
+endif
+ $(SILENT) $(CC) $(CFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
endif
]]
end
diff --git a/tests/actions/make/test_makesettings.lua b/tests/actions/make/test_makesettings.lua
new file mode 100644
index 0000000..8a6f132
--- /dev/null
+++ b/tests/actions/make/test_makesettings.lua
@@ -0,0 +1,51 @@
+--
+-- tests/actions/make/test_makesettings.lua
+-- Tests makesettings lists in generated makefiles.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.make_settings = { }
+ local suite = T.make_settings
+ local make = premake.make
+
+ local sln, prj, cfg
+
+ function suite.setup()
+ _ACTION = "gmake"
+
+ sln = solution("MySolution")
+ configurations { "Debug", "Release" }
+ makesettings { "SOLUTION_LEVEL_SETTINGS" }
+
+ project("MyProject")
+ makesettings { "PROJECT_LEVEL_SETTINGS" }
+
+ configuration { "Debug" }
+ makesettings { "DEBUG_LEVEL_SETTINGS" }
+
+ configuration { "Release" }
+ makesettings { "RELEASE_LEVEL_SETTINGS" }
+
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ cfg = premake.getconfig(prj, "Debug")
+ end
+
+
+ function suite.writesProjectSettings()
+ make.settings(prj, premake.gcc)
+ test.capture [[
+SOLUTION_LEVEL_SETTINGS
+PROJECT_LEVEL_SETTINGS
+
+ ]]
+ end
+
+ function suite.writesConfigSettings()
+ make.settings(cfg, premake.gcc)
+ test.capture [[
+DEBUG_LEVEL_SETTINGS
+
+ ]]
+ end
+
diff --git a/tests/actions/make/test_wiidev.lua b/tests/actions/make/test_wiidev.lua
new file mode 100644
index 0000000..fd0bfdd
--- /dev/null
+++ b/tests/actions/make/test_wiidev.lua
@@ -0,0 +1,56 @@
+--
+-- tests/actions/make/test_wiidev.lua
+-- Tests for Wii homebrew support in makefiles.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.make_wiidev = { }
+ local suite = T.make_wiidev
+ local make = premake.make
+ local cpp = premake.make.cpp
+
+ local sln, prj, cfg
+
+ function suite.setup()
+ _ACTION = "gmake"
+
+ sln = solution("MySolution")
+ configurations { "Debug", "Release" }
+ platforms { "WiiDev" }
+
+ prj = project("MyProject")
+
+ premake.bake.buildconfigs()
+ cfg = premake.getconfig(prj, "Debug", "WiiDev")
+ end
+
+
+--
+-- Make sure that the Wii-specific flags are passed to the tools.
+--
+
+ function suite.writesCorrectFlags()
+ cpp.flags(cfg, premake.gcc)
+ test.capture [[
+ CPPFLAGS += -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES)
+ CFLAGS += $(CPPFLAGS) $(ARCH)
+ CXXFLAGS += $(CFLAGS)
+ LDFLAGS += -s -L$(LIBOGC_LIB) $(MACHDEP)
+ RESFLAGS += $(DEFINES) $(INCLUDES)
+ ]]
+ end
+
+
+--
+-- Make sure the dev kit include is written to each Wii build configuration.
+--
+
+ function suite.writesIncludeBlock()
+ make.settings(cfg, premake.gcc)
+ test.capture [[
+ ifeq ($(strip $(DEVKITPPC)),)
+ $(error "DEVKITPPC environment variable is not set")'
+ endif
+ include $(DEVKITPPC)/wii_rules'
+ ]]
+ end
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua
index 42a5a4c..a7a3942 100644
--- a/tests/actions/vstudio/test_vs2010_vcxproj.lua
+++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua
@@ -3,8 +3,8 @@
local include_directory = "bar/foo"
local include_directory2 = "baz/foo"
local debug_define = "I_AM_ALIVE_NUMBER_FIVE"
- local vc2010 = premake.vstudio.vc2010
-
+ local vc2010 = premake.vstudio.vc2010
+
local sln, prj
function vs10_vcxproj.teardown()
sln = nil
@@ -16,30 +16,30 @@
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
-
+
prj = project "MyProject"
language "C++"
kind "ConsoleApp"
- uuid "AE61726D-187C-E440-BD07-2556188A6565"
-
+ uuid "AE61726D-187C-E440-BD07-2556188A6565"
+
includedirs
{
include_directory,
include_directory2
}
- files
- {
- "foo/dummyHeader.h",
- "foo/dummySource.cpp",
+ files
+ {
+ "foo/dummyHeader.h",
+ "foo/dummySource.cpp",
"../src/host/*h",
"../src/host/*.c",
"dummyResourceScript.rc"
}
-
+
configuration("Release")
flags {"Optimize"}
links{"foo","bar"}
-
+
configuration("Debug")
defines {debug_define}
links{"foo_d"}
@@ -75,12 +75,12 @@
local buffer = get_buffer()
test.string_contains(buffer,'<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">.*</Project>')
end
-
+
function vs10_vcxproj.configItemGroupPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ItemGroup Label="ProjectConfigurations">.*</ItemGroup>')
end
-
+
function vs10_vcxproj.configBlocksArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ProjectConfiguration.*</ProjectConfiguration>')
@@ -90,38 +90,38 @@
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'" Label="Configuration">.*</PropertyGroup>')
end
-
+
function vs10_vcxproj.twoConfigTypeBlocksPresent()
local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup Condition.*</PropertyGroup>.*<PropertyGroup Condition=.*</PropertyGroup>')
+ test.string_contains(buffer,'<PropertyGroup Condition.*</PropertyGroup>.*<PropertyGroup Condition=.*</PropertyGroup>')
end
-
+
function vs10_vcxproj.propsDefaultForCppProjArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<Import Project="$%(VCTargetsPath%)\\Microsoft.Cpp.Default.props" />')
end
-
-
+
+
function vs10_vcxproj.propsForCppProjArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<Import Project="%$%(VCTargetsPath%)\\Microsoft.Cpp.props" />')
end
-
+
function vs10_vcxproj.extensionSettingArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ImportGroup Label="ExtensionSettings">.*</ImportGroup>')
end
-
+
function vs10_vcxproj.userMacrosPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup Label="UserMacros" />')
end
-
+
function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber()
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup>.*<_ProjectFileVersion>10%.0%.30319%.1</_ProjectFileVersion>')
end
-
+
function vs10_vcxproj.outDirPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir.*</OutDir>')
@@ -130,7 +130,7 @@
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir.*</IntDir>')
end
-
+
function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs()
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir.*</OutDir>.*<IntDir.*</IntDir>.*<OutDir.*</OutDir>.*<IntDir.*</IntDir>')
@@ -140,68 +140,68 @@
local buffer = get_buffer()
test.string_contains(buffer,'<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.containsClCompileBlock()
local buffer = get_buffer()
- test.string_contains(buffer,'<ClCompile>.*</ClCompile>')
+ test.string_contains(buffer,'<ClCompile>.*</ClCompile>')
end
function vs10_vcxproj.containsAdditionalOptions()
buildoptions {"/Gm"}
local buffer = get_buffer()
- test.string_contains(buffer,'<AdditionalOptions>/Gm %%%(AdditionalOptions%)</AdditionalOptions>')
+ test.string_contains(buffer,'<AdditionalOptions>/Gm %%%(AdditionalOptions%)</AdditionalOptions>')
end
-
+
local function cl_compile_string(version)
return '<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\''..version..'|Win32\'">.*<ClCompile>'
end
-
+
function vs10_vcxproj.debugHasNoOptimisation()
local buffer = get_buffer()
test.string_contains(buffer, cl_compile_string('Debug').. '.*<Optimization>Disabled</Optimization>.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.releaseHasFullOptimisation()
local buffer = get_buffer()
test.string_contains(buffer, cl_compile_string('Release').. '.*<Optimization>Full</Optimization>.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>'.. path.translate(include_directory, '\\') ..'.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*;'.. path.translate(include_directory2, '\\') ..'.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(include_directory2, '\\') ..';.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.debugContainsPreprossorBlock()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<PreprocessorDefinitions>.*</PreprocessorDefinitions>')
end
-
+
function vs10_vcxproj.debugHasDebugDefine()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug')..'.*<PreprocessorDefinitions>.*'..debug_define..'.*</PreprocessorDefinitions>')
end
-
+
function vs10_vcxproj.releaseHasStringPoolingOn()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Release')..'.*<StringPooling>true</StringPooling>')
end
-
+
function vs10_vcxproj.hasItemGroupSection()
local buffer = get_buffer()
test.string_contains(buffer,'<ItemGroup>.*</ItemGroup>')
end
-
+
function vs10_vcxproj.itemGroupSection_hasResourceCompileSection()
--for some reason this does not work here and it needs to be in
--the project setting at the top ?
@@ -214,25 +214,25 @@
local buffer = get_buffer()
test.string_contains(buffer,'<ProjectConfiguration Include="Debug|Win32">')
end
-
+
function vs10_vcxproj.postBuildEvent_isPresent()
postbuildcommands { "doSomeThing" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>.*</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.postBuildEvent_containsCorrectInformationBetweenCommandTag()
postbuildcommands { "doSomeThing" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>doSomeThing</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.postBuildEvent_eventEncloseByQuotes_containsCorrectInformationBetweenCommandTag()
postbuildcommands { "\"doSomeThing\"" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>&quot;doSomeThing&quot;</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.outDir_directorySuppliedIsNotSlashPostFixed_bufferContainsOutDirSlashPostFixed()
targetdir("dir")
local buffer = get_buffer()
@@ -245,28 +245,28 @@
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
end
-
+
function vs10_vcxproj.outDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsOutDirSlashPostFixed()
targetdir("dir\\")
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
end
-
- function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
+
+ function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir")
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
end
-
+
--postfixed directory slashes are removed by default
- --yet these following two tests are to ensure if this behaviour is changed they will fail
+ --yet these following two tests are to ensure if this behaviour is changed they will fail
function vs10_vcxproj.objectDir_directorySuppliedWhichIsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir/")
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
end
-
+
function vs10_vcxproj.objectDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir\\")
local buffer = get_buffer()
@@ -283,7 +283,7 @@
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
end
-
+
function vs10_vcxproj.debugAndExtraWarnings_bufferContainsSmallerTypeCheck()
configuration("Debug")
flags {"ExtraWarnings"}
@@ -297,35 +297,35 @@
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
end
-
+
function vs10_vcxproj.onlyOneProjectConfigurationBlockWhenMultipleConfigs()
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<ItemGroup Label="ProjectConfigurations">.*<ItemGroup Label="ProjectConfigurations">')
- end
-
+ end
+
function vs10_vcxproj.languageC_bufferContainsCompileAsC()
- language "C"
+ language "C"
local buffer = get_buffer()
test.string_contains(buffer,'<CompileAs>CompileAsC</CompileAs>')
- end
-
+ end
+
local debug_config_pch_string = '<PrecompiledHeader Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">Create</PrecompiledHeader>'
local release_config_pch_string = debug_config_pch_string:gsub('Debug','Release')
-
+
function vs10_vcxproj.noPchFlagSet_bufferDoesNotContainPchCreate()
configuration("Debug")
flags{"NoPCH"}
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
-
+
function vs10_vcxproj.pchHeaderSetYetPchSourceIsNot_bufferDoesNotContainPchCreate()
configuration("Debug")
pchheader "foo/dummyHeader.h"
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
- end
-
+ end
+
function vs10_vcxproj.pchHeaderAndSourceSet_yetAlsoNoPch_bufferDoesNotContainpchCreate()
configuration('Debug')
pchheader "foo/dummyHeader.h"
@@ -339,8 +339,8 @@
configuration("Debug")
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
- local buffer = get_buffer()
- test.string_contains(buffer,debug_config_pch_string)
+ local buffer = get_buffer()
+ test.string_contains(buffer,debug_config_pch_string)
end
function vs10_vcxproj.wholeProgramOptimizationIsNotSetByDefault_bufferDoesNotContainWholeProgramOptimization()
diff --git a/tests/actions/vstudio/vc200x/files.lua b/tests/actions/vstudio/vc200x/files.lua
index facb17d..4633674 100644
--- a/tests/actions/vstudio/vc200x/files.lua
+++ b/tests/actions/vstudio/vc200x/files.lua
@@ -32,18 +32,18 @@
--
function suite.SimpleSourceFile()
- files { "hello.c" }
+ files { "hello.cpp" }
prepare()
test.capture [[
<File
- RelativePath="hello.c"
+ RelativePath="hello.cpp"
>
</File>
]]
end
function suite.SingleFolderLevel()
- files { "src/hello.c" }
+ files { "src/hello.cpp" }
prepare()
test.capture [[
<Filter
@@ -51,7 +51,7 @@
Filter=""
>
<File
- RelativePath="src\hello.c"
+ RelativePath="src\hello.cpp"
>
</File>
</Filter>
@@ -59,7 +59,7 @@
end
function suite.MultipleFolderLevels()
- files { "src/greetings/hello.c" }
+ files { "src/greetings/hello.cpp" }
prepare()
test.capture [[
<Filter
@@ -71,7 +71,7 @@
Filter=""
>
<File
- RelativePath="src\greetings\hello.c"
+ RelativePath="src\greetings\hello.cpp"
>
</File>
</Filter>
@@ -81,6 +81,67 @@
--
+-- Mixed language support
+--
+
+ function suite.CompileAsC_InCppProject()
+ language "c++"
+ files { "hello.c" }
+ prepare()
+ test.capture [[
+ <File
+ RelativePath="hello.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="1"
+ />
+ </FileConfiguration>
+ </File>
+ ]]
+ end
+
+ function suite.CompileAsCpp_InCProject()
+ language "c"
+ files { "hello.cpp" }
+ prepare()
+ test.capture [[
+ <File
+ RelativePath="hello.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ </File>
+ ]]
+ end
+
+
+--
-- PCH support
--
diff --git a/tests/actions/vstudio/vc200x/test_filters.lua b/tests/actions/vstudio/vc200x/test_filters.lua
index d2bb3cd..148dcd4 100644
--- a/tests/actions/vstudio/vc200x/test_filters.lua
+++ b/tests/actions/vstudio/vc200x/test_filters.lua
@@ -40,8 +40,8 @@ local vc200x = premake.vstudio.vc200x
--
function suite.Filter_UsesVirtualForm_OnVpath()
- files { "src/hello.c" }
- vpaths { ["Source Files"] = "**.c" }
+ files { "src/hello.cpp" }
+ vpaths { ["Source Files"] = "**.cpp" }
prepare()
vc200x.Files(prj)
test.capture [[
@@ -50,7 +50,7 @@ local vc200x = premake.vstudio.vc200x
Filter=""
>
<File
- RelativePath="src\hello.c"
+ RelativePath="src\hello.cpp"
>
</File>
</Filter>
diff --git a/tests/actions/vstudio/vc2010/test_links.lua b/tests/actions/vstudio/vc2010/test_links.lua
new file mode 100644
index 0000000..de642f5
--- /dev/null
+++ b/tests/actions/vstudio/vc2010/test_links.lua
@@ -0,0 +1,87 @@
+--
+-- tests/actions/vstudio/vc2010/test_links.lua
+-- Validate linking and project references in Visual Studio 2010 C/C++ projects.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.vstudio_vs2010_links = { }
+ local suite = T.vstudio_vs2010_links
+ local vc2010 = premake.vstudio.vc2010
+
+
+--
+-- Setup
+--
+
+ local sln, prj, prj2
+
+ function suite.setup()
+ os_uuid = os.uuid
+ os.uuid = function() return "00112233-4455-6677-8888-99AABBCCDDEE" end
+
+ sln = test.createsolution()
+ test.createproject(sln)
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ prj2 = premake.solution.getproject(sln, 2)
+ sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
+ end
+
+
+--
+-- If there are no sibling projects listed in links(), then the
+-- entire project references item group should be skipped.
+--
+
+ function suite.noSectionWritten_onNoSiblingReferences()
+ prepare()
+ vc2010.projectReferences(prj2)
+ test.isemptycapture()
+ end
+
+
+--
+-- If a sibling project is listed in links(), an item group should
+-- be written with a reference to that sibling project.
+--
+
+ function suite.projectReferenceAdded_onSiblingProjectLink()
+ links { "MyProject" }
+ prepare()
+ vc2010.projectReferences(prj2)
+ test.capture [[
+ <ItemGroup>
+ <ProjectReference Include="MyProject.vcproj">
+ <Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ ]]
+ end
+
+
+--
+-- If a sibling library is listed in links(), it should NOT appear in
+-- the additional dependencies element. Visual Studio will figure that
+-- out from the project reference item group.
+--
+
+ function suite.noDependencies_onOnlySiblingProjectLinks()
+ links { "MyProject" }
+ prepare()
+ vc2010.additionalDependencies(prj2)
+ test.isemptycapture()
+ end
+
+ function suite.onlySystemDependencies_OnSiblingProjectLink()
+ links { "MyProject", "kernel32" }
+ prepare()
+ vc2010.additionalDependencies(prj2)
+ test.capture [[
+ <AdditionalDependencies>kernel32;%(AdditionalDependencies)</AdditionalDependencies>
+ ]]
+ end
+
+
diff --git a/tests/actions/xcode/test_xcode4_project.lua b/tests/actions/xcode/test_xcode4_project.lua
new file mode 100644
index 0000000..30cda28
--- /dev/null
+++ b/tests/actions/xcode/test_xcode4_project.lua
@@ -0,0 +1,59 @@
+--
+-- tests/actions/xcode/test_xcode4_project.lua
+-- Automated test suite for Xcode project generation.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.xcode4_project = { }
+
+ local suite = T.xcode4_project
+ local xcode = premake.xcode
+
+
+---------------------------------------------------------------------------
+-- Setup/Teardown
+---------------------------------------------------------------------------
+
+ local sln, tr
+ function suite.setup()
+ _ACTION = "xcode4"
+ io.eol = "\n"
+ xcode.used_ids = { } -- reset the list of generated IDs
+ sln = test.createsolution()
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ xcode.preparesolution(sln)
+ local prj = premake.solution.getproject(sln, 1)
+ tr = xcode.buildprjtree(prj)
+ end
+
+
+---------------------------------------------------------------------------
+-- XCBuildConfiguration_Project tests
+---------------------------------------------------------------------------
+
+ function suite.XCBuildConfigurationProject_OnSymbols()
+ flags { "Symbols" }
+ prepare()
+ xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
+ test.capture [[
+ [MyProject:Debug(2)] /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+ CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OBJROOT = "obj/Debug";
+ ONLY_ACTIVE_ARCH = YES;
+ };
+ name = "Debug";
+ };
+ ]]
+ end
diff --git a/tests/actions/xcode/test_xcode_dependencies.lua b/tests/actions/xcode/test_xcode_dependencies.lua
index e748b2b..ad14d5e 100644
--- a/tests/actions/xcode/test_xcode_dependencies.lua
+++ b/tests/actions/xcode/test_xcode_dependencies.lua
@@ -1,7 +1,7 @@
--
-- tests/actions/xcode/test_xcode_dependencies.lua
-- Automated test suite for Xcode project dependencies.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.xcode3_deps = { }
@@ -249,7 +249,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "MyProject" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = [MyProject] /* MyProject */;
projectDirPath = "";
diff --git a/tests/actions/xcode/test_xcode_project.lua b/tests/actions/xcode/test_xcode_project.lua
index 4ab50ba..1ecde36 100644
--- a/tests/actions/xcode/test_xcode_project.lua
+++ b/tests/actions/xcode/test_xcode_project.lua
@@ -1,7 +1,7 @@
--
-- tests/actions/xcode/test_xcode_project.lua
-- Automated test suite for Xcode project generation.
--- Copyright (c) 2009-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.xcode3_project = { }
@@ -16,7 +16,7 @@
local sln, tr
function suite.setup()
- premake.action.set("xcode3")
+ _ACTION = "xcode3"
io.eol = "\n"
xcode.used_ids = { } -- reset the list of generated IDs
sln = test.createsolution()
@@ -656,7 +656,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "MyProject" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = [MyProject] /* MyProject */;
projectDirPath = "";
@@ -1084,7 +1084,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1109,7 +1108,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1134,7 +1132,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1159,7 +1156,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
};
name = "Debug";
@@ -1186,7 +1182,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
SYMROOT = "bin";
};
name = "Debug";
@@ -1216,7 +1211,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1245,7 +1239,6 @@
);
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1274,7 +1267,6 @@
"build option 1",
"build option 2",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1302,7 +1294,6 @@
OTHER_LDFLAGS = (
"-lldap",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1330,7 +1321,6 @@
"link option 1",
"link option 2",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1355,7 +1345,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
WARNING_CFLAGS = "-Wall";
};
name = "Debug";
@@ -1382,7 +1371,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1410,7 +1398,6 @@
OTHER_CFLAGS = (
"-ffast-math",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1438,7 +1425,6 @@
OTHER_CFLAGS = (
"-ffloat-store",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1464,7 +1450,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1491,7 +1476,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1519,7 +1503,6 @@
OTHER_CFLAGS = (
"-fomit-frame-pointer",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1545,7 +1528,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1571,7 +1553,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1598,7 +1579,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1627,7 +1607,6 @@
);
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1654,7 +1633,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1679,7 +1657,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1704,7 +1681,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1729,7 +1705,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal64/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1754,7 +1729,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1779,7 +1753,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/x32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1804,7 +1777,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/x64/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1828,7 +1800,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug 32-bit Universal";
};
diff --git a/tests/premake4.lua b/tests/premake4.lua
index e24b7eb..1154235 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -13,7 +13,7 @@
test.createsolution = function()
local sln = solution "MySolution"
configurations { "Debug", "Release" }
-
+
local prj = project "MyProject"
language "C++"
kind "ConsoleApp"
@@ -25,7 +25,7 @@
test.createproject = function(sln)
local n = #sln.projects + 1
if n == 1 then n = "" end
-
+
local prj = project ("MyProject" .. n)
language "C++"
kind "ConsoleApp"
@@ -60,14 +60,14 @@
dofile("test_project.lua")
dofile("project/test_eachfile.lua")
dofile("project/test_vpaths.lua")
-
+
-- Baking tests
dofile("base/test_baking.lua")
dofile("baking/test_merging.lua")
-
+
-- Clean tests
dofile("actions/test_clean.lua")
-
+
-- Visual Studio tests
dofile("test_vs2002_sln.lua")
dofile("test_vs2003_sln.lua")
@@ -100,30 +100,34 @@
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/files.lua")
dofile("actions/vstudio/vc200x/test_filters.lua")
-
+
-- Visual Studio 2010 C/C++ projects
dofile("actions/vstudio/vc2010/test_debugdir.lua")
dofile("actions/vstudio/vc2010/test_header.lua")
dofile("actions/vstudio/vc2010/test_files.lua")
dofile("actions/vstudio/vc2010/test_filters.lua")
+ dofile("actions/vstudio/vc2010/test_links.lua")
dofile("actions/vstudio/vc2010/test_pch.lua")
-- Makefile tests
dofile("actions/make/test_make_escaping.lua")
dofile("actions/make/test_make_pch.lua")
dofile("actions/make/test_make_linking.lua")
-
+ -- dofile("actions/make/test_makesettings.lua")
+ dofile("actions/make/test_wiidev.lua")
+
-- Xcode3 tests
dofile("actions/xcode/test_xcode_common.lua")
dofile("actions/xcode/test_xcode_project.lua")
dofile("actions/xcode/test_xcode_dependencies.lua")
-- Xcode4 tests
+ dofile("actions/xcode/test_xcode4_project.lua")
dofile("actions/xcode/test_xcode4_workspace.lua")
-
+
-- CodeLite tests
dofile("actions/codelite/codelite_files.lua")
-
+
-- CodeBlocks tests
dofile("actions/codeblocks/codeblocks_files.lua")
dofile("actions/codeblocks/test_filters.lua")
@@ -136,7 +140,7 @@
newaction {
trigger = "test",
description = "Run the automated test suite",
-
+
execute = function ()
passed, failed = test.runall()
msg = string.format("%d tests passed, %d failed", passed, failed)
diff --git a/tests/project/test_vpaths.lua b/tests/project/test_vpaths.lua
index 49631e2..8616907 100644
--- a/tests/project/test_vpaths.lua
+++ b/tests/project/test_vpaths.lua
@@ -124,3 +124,32 @@
prepare()
test.isequal("src/hello.c", project.getvpath(prj, "../../src/hello.c"))
end
+
+
+--
+-- Test with project locations
+--
+
+ function suite.MatchPath_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { [""] = "src" }
+ prepare()
+ test.isequal("hello.h", project.getvpath(prj, prj.files[1]))
+ end
+
+ function suite.MatchFilePattern_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { ["Headers"] = "**.h" }
+ prepare()
+ test.isequal("Headers/hello.h", project.getvpath(prj, prj.files[1]))
+ end
+
+ function suite.MatchFilePatternWithPath_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { ["Headers"] = "src/**.h" }
+ prepare()
+ test.isequal("Headers/hello.h", project.getvpath(prj, prj.files[1]))
+ end
diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua
index 5730ca9..8c80411 100644
--- a/tests/test_gmake_cpp.lua
+++ b/tests/test_gmake_cpp.lua
@@ -82,8 +82,8 @@ ifeq ($(config),debug)
CFLAGS += $(CPPFLAGS) $(ARCH)
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -116,8 +116,8 @@ ifeq ($(config),debugps3)
CFLAGS += $(CPPFLAGS) $(ARCH)
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -147,8 +147,8 @@ ifeq ($(config),debug64)
CFLAGS += $(CPPFLAGS) $(ARCH) -m64
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -m64 -L/usr/lib64
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -179,8 +179,8 @@ ifeq ($(config),debuguniv32)
CFLAGS += $(CPPFLAGS) $(ARCH) -arch i386 -arch ppc
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -arch i386 -arch ppc
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = libtool -o $(TARGET) $(OBJECTS)
define PREBUILDCMDS
diff --git a/tests/testfx.lua b/tests/testfx.lua
index 3c412a7..a33a391 100644
--- a/tests/testfx.lua
+++ b/tests/testfx.lua
@@ -200,6 +200,7 @@
_OS = _OS_host
premake.solution.list = { }
io.indent = nil
+ io.eol = "\n"
-- reset captured I/O values
test.value_openedfilename = nil