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:
authorOliver Schneider <oliver@assarbad.net>2015-11-09 01:03:49 +0300
committerOliver Schneider <oliver@assarbad.net>2015-11-09 01:03:49 +0300
commit35861301093da54e4b7f5112c0660a678467c92f (patch)
tree507760552cf2bf3f60be42f674130c07779328d2 /tests
parent8f7c5ef2c61da06038f4d8314af64b4b548757b5 (diff)
parentc04a1a0f6c98c119febb3e1ac479dfe38dcaa279 (diff)
Merge with upstream
--HG-- branch : WDS-build
Diffstat (limited to 'tests')
-rw-r--r--tests/actions/make/test_make_pch.lua4
-rw-r--r--tests/actions/make/test_wiidev.lua2
-rw-r--r--tests/actions/vstudio/cs2005/buildevents.lua53
-rw-r--r--tests/actions/vstudio/test_vs2010_vcxproj.lua11
-rw-r--r--tests/base/test_os.lua39
-rw-r--r--tests/base/test_path.lua56
-rw-r--r--tests/premake4.lua1
-rw-r--r--tests/test_gmake_cpp.lua14
8 files changed, 125 insertions, 55 deletions
diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua
index 18e6026..6d30ef1 100644
--- a/tests/actions/make/test_make_pch.lua
+++ b/tests/actions/make/test_make_pch.lua
@@ -66,6 +66,7 @@
_.pchrules(prj)
test.capture [[
ifneq (,$(PCH))
+.NOTPARALLEL: $(GCH) $(PCH)
$(GCH): $(PCH)
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
@@ -79,6 +80,7 @@ $(GCH): $(PCH)
_.pchrules(prj)
test.capture [[
ifneq (,$(PCH))
+.NOTPARALLEL: $(GCH) $(PCH)
$(GCH): $(PCH)
@echo $(notdir $<)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
@@ -98,7 +100,7 @@ $(GCH): $(PCH)
test.capture [[
$(OBJDIR)/main.o: main.cpp
@echo $(notdir $<)
- $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+ $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
]]
end
diff --git a/tests/actions/make/test_wiidev.lua b/tests/actions/make/test_wiidev.lua
index f3787a0..d766097 100644
--- a/tests/actions/make/test_wiidev.lua
+++ b/tests/actions/make/test_wiidev.lua
@@ -33,7 +33,7 @@
cpp.flags(cfg, premake.gcc)
test.capture [[
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
]]
diff --git a/tests/actions/vstudio/cs2005/buildevents.lua b/tests/actions/vstudio/cs2005/buildevents.lua
new file mode 100644
index 0000000..213de1b
--- /dev/null
+++ b/tests/actions/vstudio/cs2005/buildevents.lua
@@ -0,0 +1,53 @@
+--
+-- tests/actions/vstudio/cs2005/buildevents.lua
+-- Validate the build events in Visual Studio 2005+ .csproj
+-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
+--
+
+ T.vstudio_cs2005_buildevents = { }
+ local suite = T.vstudio_cs2005_buildevents
+ local cs2005 = premake.vstudio.cs2005
+
+--
+-- Setup
+--
+
+ local sln, prj
+
+ function suite.setup()
+ sln = test.createsolution()
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ cs2005.buildevents(prj)
+ end
+
+--
+-- Prebuild events
+--
+
+ function suite.prebuildEvents()
+ prebuildcommands { "pre" }
+ prepare()
+ test.capture [[
+ <PropertyGroup>
+ <PreBuildEvent>pre</PreBuildEvent>
+ </PropertyGroup>
+ ]]
+ end
+
+--
+-- Postbuild events
+--
+
+ function suite.postbuildEvents()
+ postbuildcommands { "post" }
+ prepare()
+ test.capture [[
+ <PropertyGroup>
+ <PostBuildEvent>post</PostBuildEvent>
+ </PropertyGroup>
+ ]]
+ end
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua
index c5b3401..c11ec9e 100644
--- a/tests/actions/vstudio/test_vs2010_vcxproj.lua
+++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua
@@ -2,6 +2,7 @@
local vs10_vcxproj = T.vs2010_vcxproj
local include_directory = "bar/foo"
local include_directory2 = "baz/foo"
+ local include_directory_vs_macros = "$(Macro1)/foo/bar/$(Macro2)/baz"
local debug_define = "I_AM_ALIVE_NUMBER_FIVE"
local vc2010 = premake.vstudio.vc2010
@@ -25,7 +26,8 @@
includedirs
{
include_directory,
- include_directory2
+ include_directory2,
+ include_directory_vs_macros
}
files
{
@@ -168,6 +170,13 @@
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(include_directory2, '\\') ..';.*</AdditionalIncludeDirectories>')
end
+ function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory_vs_macros()
+ local buffer = get_buffer()
+ -- visual studio macros use $ as a prefix, which is a special regex character, so we need to replace them.
+ local search_string = string.gsub(include_directory_vs_macros, "%$", "%$%")
+ test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(search_string, '\\') ..'.*</AdditionalIncludeDirectories>')
+ end
+
function vs10_vcxproj.debugContainsPreprossorBlock()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<PreprocessorDefinitions>.*</PreprocessorDefinitions>')
diff --git a/tests/base/test_os.lua b/tests/base/test_os.lua
index fb720c9..db49547 100644
--- a/tests/base/test_os.lua
+++ b/tests/base/test_os.lua
@@ -8,7 +8,7 @@
T.os = { }
local suite = T.os
-
+
--
-- os.findlib() tests
--
@@ -17,17 +17,17 @@
if os.is("windows") then
test.istrue(os.findlib("user32"))
elseif os.is("haiku") then
- test.istrue(os.findlib("root"))
+ test.istrue(os.findlib("root"))
else
- test.istrue(os.findlib("m"))
+ test.istrue(os.findlib("m"))
end
end
-
+
function suite.findlib_FailsOnBadLibName()
test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
end
-
-
+
+
--
-- os.isfile() tests
--
@@ -49,7 +49,7 @@
function suite.matchfiles_OnNonRecursive()
local result = os.matchfiles("*.lua")
test.istrue(table.contains(result, "testfx.lua"))
- test.isfalse(table.contains(result, "folder/ok.lua"))
+ test.isfalse(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_Recursive()
@@ -61,31 +61,36 @@
local result = os.matchfiles("**.lua")
test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
end
-
+
function suite.matchfiles_OnSubfolderMatch()
local result = os.matchfiles("**/xcode/*")
test.istrue(table.contains(result, "actions/xcode/test_xcode_project.lua"))
test.isfalse(table.contains(result, "premake4.lua"))
end
-
+
function suite.matchfiles_OnDotSlashPrefix()
local result = os.matchfiles("./**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
-
+
function suite.matchfiles_OnImplicitEndOfString()
local result = os.matchfiles("folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
test.isfalse(table.contains(result, "folder/ok.lua.2"))
end
-
+
function suite.matchfiles_OnLeadingDotSlashWithPath()
local result = os.matchfiles("./folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
+ function suite.matchfiles_OnDottedFile()
+ local result = os.matchfiles("../.*")
+ test.istrue(table.contains(result, "../.hgignore"))
+ end
+
+
-
--
-- os.pathsearch() tests
--
@@ -93,20 +98,20 @@
function suite.pathsearch_ReturnsNil_OnNotFound()
test.istrue( os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil )
end
-
+
function suite.pathsearch_ReturnsPath_OnFound()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", os.getcwd()))
end
-
+
function suite.pathsearch_FindsFile_OnComplexPath()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", "aaa;"..os.getcwd()..";bbb"))
end
-
+
function suite.pathsearch_NilPathsAllowed()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", nil, os.getcwd(), nil))
end
-
+
--
-- os.uuid() tests
--
@@ -123,4 +128,4 @@
test.isequal("-", g:sub(19,19))
test.isequal("-", g:sub(24,24))
end
-
+
diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua
index 2332dce..46e3181 100644
--- a/tests/base/test_path.lua
+++ b/tests/base/test_path.lua
@@ -24,26 +24,26 @@
function suite.getabsolute_RemovesDotDots_OnPosixAbsolute()
test.isequal("/ProjectB/bin", path.getabsolute("/ProjectA/../ProjectB/bin"))
end
-
+
function suite.getabsolute_OnTrailingSlash()
local expected = path.translate(os.getcwd(), "/") .. "/a/b/c"
test.isequal(expected, path.getabsolute("a/b/c/"))
end
-
+
function suite.getabsolute_OnLeadingEnvVar()
test.isequal("$(HOME)/user", path.getabsolute("$(HOME)/user"))
end
-
- function suite.getabsolute_OnMultipleEnvVar()
+
+ function suite.getabsolute_OnMultipleEnvVar()
test.isequal("$(HOME)/$(USER)", path.getabsolute("$(HOME)/$(USER)"))
end
-
+
function suite.getabsolute_OnTrailingEnvVar()
local expected = path.translate(os.getcwd(), "/") .. "/home/$(USER)"
test.isequal(expected, path.getabsolute("home/$(USER)"))
end
-
-
+
+
--
-- path.getbasename() tests
--
@@ -60,11 +60,11 @@
function suite.getdirectory_ReturnsEmptyString_OnNoDirectory()
test.isequal(".", path.getdirectory("filename.ext"))
end
-
+
function suite.getdirectory_ReturnsDirectory_OnSingleLevelPath()
test.isequal("dir0", path.getdirectory("dir0/filename.ext"))
end
-
+
function suite.getdirectory_ReturnsDirectory_OnMultiLeveLPath()
test.isequal("dir0/dir1/dir2", path.getdirectory("dir0/dir1/dir2/filename.ext"))
end
@@ -72,7 +72,7 @@
function suite.getdirectory_ReturnsRootPath_OnRootPathOnly()
test.isequal("/", path.getdirectory("/filename.ext"))
end
-
+
--
@@ -82,13 +82,13 @@
function suite.getdrive_ReturnsNil_OnNotWindows()
test.isnil(path.getdrive("/hello"))
end
-
+
function suite.getdrive_ReturnsLetter_OnWindowsAbsolute()
test.isequal("x", path.getdrive("x:/hello"))
end
-
-
-
+
+
+
--
-- path.getextension() tests
--
@@ -100,19 +100,19 @@
function suite.getextension_ReturnsExtension()
test.isequal(".txt", path.getextension("filename.txt"))
end
-
+
function suite.getextension_OnMultipleDots()
test.isequal(".txt", path.getextension("filename.mod.txt"))
end
-
+
function suite.getextension_OnLeadingNumeric()
test.isequal(".7z", path.getextension("filename.7z"))
end
-
+
function suite.getextension_OnUnderscore()
test.isequal(".a_c", path.getextension("filename.a_c"))
end
-
+
function suite.getextension_OnHyphen()
test.isequal(".a-c", path.getextension("filename.a-c"))
end
@@ -130,7 +130,7 @@
function suite.getrelative_ReturnsDoubleDot_OnChildToParent()
test.isequal("..", path.getrelative("/a/b/c", "/a/b"))
end
-
+
function suite.getrelative_ReturnsDoubleDot_OnSiblingToSibling()
test.isequal("../d", path.getrelative("/a/b/c", "/a/b/d"))
end
@@ -142,19 +142,19 @@
function suite.getrelative_ReturnsChildPath_OnWindowsAbsolute()
test.isequal("obj/debug", path.getrelative("C:/Code/Premake4", "C:/Code/Premake4/obj/debug"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnDifferentDriveLetters()
test.isequal("D:/Files", path.getrelative("C:/Code/Premake4", "D:/Files"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnDollarMacro()
test.isequal("$(SDK_HOME)/include", path.getrelative("C:/Code/Premake4", "$(SDK_HOME)/include"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnRootedPath()
test.isequal("/opt/include", path.getrelative("/home/me/src/project", "/opt/include"))
end
-
+
--
-- path.isabsolute() tests
@@ -171,7 +171,7 @@
function suite.isabsolute_ReturnsFalse_OnRelativePath()
test.isfalse(path.isabsolute("a/b/c"))
end
-
+
function suite.isabsolute_ReturnsTrue_OnDollarSign()
test.istrue(path.isabsolute("$(SDK_HOME)/include"))
end
@@ -184,11 +184,11 @@
function suite.join_OnValidParts()
test.isequal("p1/p2", path.join("p1", "p2"))
end
-
+
function suite.join_OnAbsoluteUnixPath()
test.isequal("/p2", path.join("p1", "/p2"))
end
-
+
function suite.join_OnAbsoluteWindowsPath()
test.isequal("C:/p2", path.join("p1", "C:/p2"))
end
@@ -196,11 +196,11 @@
function suite.join_OnCurrentDirectory()
test.isequal("p2", path.join(".", "p2"))
end
-
+
function suite.join_OnNilSecondPart()
test.isequal("p1", path.join("p1", nil))
end
-
+
function suite.join_onMoreThanTwoParts()
test.isequal("p1/p2/p3", path.join("p1", "p2", "p3"))
end
diff --git a/tests/premake4.lua b/tests/premake4.lua
index b0ebde9..6c149e3 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -86,6 +86,7 @@
dofile("actions/vstudio/cs2005/projectelement.lua")
dofile("actions/vstudio/cs2005/projectsettings.lua")
dofile("actions/vstudio/cs2005/propertygroup.lua")
+ dofile("actions/vstudio/cs2005/buildevents.lua")
-- Visual Studio 2005-2010 solutions
dofile("actions/vstudio/sln2005/dependencies.lua")
diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua
index 7ce0279..b0bd4cf 100644
--- a/tests/test_gmake_cpp.lua
+++ b/tests/test_gmake_cpp.lua
@@ -79,13 +79,13 @@ ifeq ($(config),debug)
DEFINES +=
INCLUDES +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
ALL_LDFLAGS += $(LDFLAGS) -s
LDDEPS +=
LIBS += $(LDDEPS)
- LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
+ LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
@@ -113,13 +113,13 @@ ifeq ($(config),debugps3)
DEFINES +=
INCLUDES +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
ALL_LDFLAGS += $(LDFLAGS) -s
LDDEPS +=
LIBS += $(LDDEPS)
- LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
+ LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
@@ -144,13 +144,13 @@ ifeq ($(config),debug64)
DEFINES +=
INCLUDES +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -m64
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
ALL_LDFLAGS += $(LDFLAGS) -s -m64 -L/usr/lib64
LDDEPS +=
LIBS += $(LDDEPS)
- LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
+ LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
@@ -176,7 +176,7 @@ ifeq ($(config),debuguniv32)
DEFINES +=
INCLUDES +=
ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -arch i386 -arch ppc
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -arch i386 -arch ppc
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
ALL_LDFLAGS += $(LDFLAGS) -s -arch i386 -arch ppc