From 6871e492b12a29a027287398f544d5503ae6922d Mon Sep 17 00:00:00 2001 From: Damien Courtois Date: Thu, 3 Apr 2014 12:02:13 +0200 Subject: added a test to ensure VS macros are correctly handled in include paths. --HG-- branch : test_vs_macros --- tests/actions/vstudio/test_vs2010_vcxproj.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') 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').. '.*.*'.. path.translate(include_directory2, '\\') ..';.*') 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').. '.*.*'.. path.translate(search_string, '\\') ..'.*') + end + function vs10_vcxproj.debugContainsPreprossorBlock() local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*') -- cgit v1.2.3 From a411a4265650779087894d662a84c028c3ca1035 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 3 Apr 2014 11:10:28 -0400 Subject: Issue #236: Fix failing PCH unit tests --- tests/actions/make/test_make_pch.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua index 18e6026..500f2ae 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 "$<" -- cgit v1.2.3 From 0c1e1741b36b6beb83c8b5288b0cca0d340fde5b Mon Sep 17 00:00:00 2001 From: Damien Courtois Date: Tue, 22 Apr 2014 14:27:27 +0200 Subject: added post and pre build events support for C# projects --HG-- branch : issue_60 --- tests/actions/vstudio/cs2005/buildevents.lua | 53 ++++++++++++++++++++++++++++ tests/premake4.lua | 1 + 2 files changed, 54 insertions(+) create mode 100644 tests/actions/vstudio/cs2005/buildevents.lua (limited to 'tests') 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 [[ + + pre + + ]] + end + +-- +-- Postbuild events +-- + + function suite.postbuildEvents() + postbuildcommands { "post" } + prepare() + test.capture [[ + + post + + ]] + 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") -- cgit v1.2.3 From 80238323c1cb71f1897c70d7a9a22b7e6850d12a Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 24 Apr 2014 10:44:03 -0400 Subject: Fix issue #20 - can now find files with a dot prefix; directories are still ignored --- tests/base/test_os.lua | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'tests') 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 - + -- cgit v1.2.3 From 793140632759c79b0183619306fb60ec17133243 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 16 Sep 2014 11:40:47 -0400 Subject: Backport native path functions from Premake-dev --- tests/base/test_path.lua | 56 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3 From 380953a882b9c7610e6949d79b9bff0996caa735 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Wed, 19 Nov 2014 12:26:06 -0500 Subject: Remove $(ARCH) variable from makefiles; causing issues on Linux --- tests/actions/make/test_wiidev.lua | 2 +- tests/test_gmake_cpp.lua | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') 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/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 -- cgit v1.2.3 From c04a1a0f6c98c119febb3e1ac479dfe38dcaa279 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 8 Dec 2014 11:46:34 -0500 Subject: Add missing quotes around PCH compile flags (h/t Daniel Gibson) See comment at https://bitbucket.org/premake/premake-4.x/commits/7e583c84a367985227e0865bedfda6315416e288#comment-1468822 --- tests/actions/make/test_make_pch.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua index 500f2ae..6d30ef1 100644 --- a/tests/actions/make/test_make_pch.lua +++ b/tests/actions/make/test_make_pch.lua @@ -100,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 -- cgit v1.2.3