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
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt2
-rw-r--r--src/actions/codeblocks/codeblocks_cbp.lua33
-rw-r--r--src/actions/vstudio/vs200x_vcproj_user.lua14
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua12
-rw-r--r--src/base/api.lua8
-rwxr-xr-xsrc/host/os_getversion.c16
-rw-r--r--tests/actions/codeblocks/environment_variables.lua59
-rw-r--r--tests/actions/vstudio/test_vs2010_vcxproj.lua117
-rw-r--r--tests/actions/vstudio/vc200x/debugdir.lua28
-rwxr-xr-xtests/actions/vstudio/vc2010/test_debugdir.lua41
-rw-r--r--tests/premake4.lua1
-rw-r--r--tests/testfx.lua3
12 files changed, 263 insertions, 71 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 8544052..ddff72d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -38,6 +38,8 @@
* Patch 3337372: Improved precompiled header support (Anders Ericsson)
* Patch 3401184: Fix Gmake LDFLAGS generation order (Adam Petrone)
* Patch 3381066: Fix VS2010 project references
+* Added debug environment variable support for Visual Studio
+* Added debug environment variable support for Codeblocks using gdb
-------
diff --git a/src/actions/codeblocks/codeblocks_cbp.lua b/src/actions/codeblocks/codeblocks_cbp.lua
index 44b1c84..6f31e29 100644
--- a/src/actions/codeblocks/codeblocks_cbp.lua
+++ b/src/actions/codeblocks/codeblocks_cbp.lua
@@ -37,7 +37,27 @@
end
end
-
+ function premake.codeblocks.debugenvs(cfg)
+ --Assumption: if gcc is being used then so is gdb although this section will be ignored by
+ --other debuggers. If using gcc and not gdb it will silently not pass the
+ --environment arguments to the debugger
+ if premake.gettool(cfg) == premake.gcc then
+ _p(3,'<debugger>')
+ _p(4,'<remote_debugging target="%s">', premake.esc(cfg.longname))
+ local args = ''
+ local sz = #cfg.debugenvs
+ for idx, v in ipairs(cfg.debugenvs) do
+ args = args .. 'set env ' .. v
+ if sz ~= idx then args = args .. '&#x0A;' end
+ end
+ _p(5,'<options additional_cmds_before="%s" />',args)
+ _p(4,'</remote_debugging>')
+ _p(3,'</debugger>')
+ else
+ error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')
+ end
+ end
+
--
-- The main function: write out the project file.
--
@@ -152,7 +172,16 @@
codeblocks.files(prj)
- _p(2,'<Extensions />')
+ _p(2,'<Extensions>')
+ for _, platform in ipairs(platforms) do
+ for cfg in premake.eachconfig(prj, platform) do
+ if cfg.debugenvs and #cfg.debugenvs > 0 then
+ premake.codeblocks.debugenvs(cfg)
+ end
+ end
+ end
+ _p(2,'</Extensions>')
+
_p(1,'</Project>')
_p('</CodeBlocks_project_file>')
_p('')
diff --git a/src/actions/vstudio/vs200x_vcproj_user.lua b/src/actions/vstudio/vs200x_vcproj_user.lua
index 7a51a79..6431a7d 100644
--- a/src/actions/vstudio/vs200x_vcproj_user.lua
+++ b/src/actions/vstudio/vs200x_vcproj_user.lua
@@ -45,7 +45,15 @@
--
-- Output the debug settings element
--
-
+ function vc200x.environmentargs(cfg)
+ if cfg.environmentargs and #cfg.environmentargs > 0 then
+ _p(4,'Environment="%s"', string.gsub(table.concat(cfg.environmentargs, "&#x0A;"),'"','&quot;'))
+ if cfg.flags.EnvironmentArgsDontMerge then
+ _p(4,'EnvironmentMerge="false"')
+ end
+ end
+ end
+
function vc200x.debugdir(cfg)
_p(3,'<DebugSettings')
@@ -56,6 +64,8 @@
if #cfg.debugargs > 0 then
_p(4,'CommandArguments="%s"', table.concat(cfg.debugargs, " "))
end
-
+
+ vc200x.environmentargs(cfg)
+
_p(3,'/>')
end
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index 9038abe..29621b5 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -630,6 +630,17 @@
end
end
+ function vc2010.debugenvs(cfg)
+ if cfg.debugenvs and #cfg.debugenvs > 0 then
+ _p(2,'<LocalDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>',table.concat(cfg.debugenvs, "\n")
+ ,iif(cfg.flags.DebugEnvsInherit,'\n$(LocalDebuggerEnvironment)','')
+ )
+ if cfg.flags.DebugEnvsDontMerge then
+ _p(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
+ end
+ end
+ end
+
function premake.vs2010_vcxproj_user(prj)
io.indent = " "
vc2010.header()
@@ -637,6 +648,7 @@
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(' <PropertyGroup '.. if_config_and_platform() ..'>', premake.esc(cfginfo.name))
vc2010.debugdir(cfg)
+ vc2010.debugenvs(cfg)
_p(' </PropertyGroup>')
end
_p('</Project>')
diff --git a/src/base/api.lua b/src/base/api.lua
index c6bfd18..b47d107 100644
--- a/src/base/api.lua
+++ b/src/base/api.lua
@@ -54,6 +54,12 @@
scope = "config",
},
+ debugenvs =
+ {
+ kind = "list",
+ scope = "config",
+ },
+
defines =
{
kind = "list",
@@ -88,6 +94,8 @@
allowed = function(value)
local allowed_flags = {
+ DebugEnvsDontMerge = 1,
+ DebugEnvsInherit = 1,
EnableSSE = 1,
EnableSSE2 = 1,
ExtraWarnings = 1,
diff --git a/src/host/os_getversion.c b/src/host/os_getversion.c
index f01f892..3cef742 100755
--- a/src/host/os_getversion.c
+++ b/src/host/os_getversion.c
@@ -26,7 +26,7 @@ int os_getversion(lua_State* L)
lua_pushstring(L, "majorversion");
lua_pushnumber(L, info.majorversion);
lua_settable(L, -3);
-
+
lua_pushstring(L, "minorversion");
lua_pushnumber(L, info.minorversion);
lua_settable(L, -3);
@@ -59,7 +59,7 @@ SYSTEM_INFO getsysteminfo()
typedef void (WINAPI *GetNativeSystemInfoSig)(LPSYSTEM_INFO);
GetNativeSystemInfoSig nativeSystemInfo = (GetNativeSystemInfoSig)
GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetNativeSystemInfo");
-
+
SYSTEM_INFO systemInfo = {{0}};
if ( nativeSystemInfo ) nativeSystemInfo(&systemInfo);
else GetSystemInfo(&systemInfo);
@@ -69,14 +69,14 @@ SYSTEM_INFO getsysteminfo()
void getversion(struct OsVersionInfo* info)
{
OSVERSIONINFOEX versionInfo = {0};
-
+
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((OSVERSIONINFO*)&versionInfo);
info->majorversion = versionInfo.dwMajorVersion;
info->minorversion = versionInfo.dwMinorVersion;
info->revision = versionInfo.wServicePackMajor;
-
+
if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 0)
{
info->description = "Windows 2000";
@@ -123,7 +123,7 @@ void getversion(struct OsVersionInfo* info)
{
info->description = "Windows Server 2008 R2";
}
- else
+ else
{
info->description = "Windows 7";
}
@@ -141,11 +141,11 @@ void getversion(struct OsVersionInfo* info)
#include <CoreServices/CoreServices.h>
void getversion(struct OsVersionInfo* info)
-{
+{
Gestalt(gestaltSystemVersionMajor, &info->majorversion);
Gestalt(gestaltSystemVersionMinor, &info->minorversion);
- Gestalt(gestaltSystemVersionBugFix, &info->revision);
-
+ Gestalt(gestaltSystemVersionBugFix, &info->revision);
+
info->description = "Mac OS X";
if (info->majorversion == 10)
{
diff --git a/tests/actions/codeblocks/environment_variables.lua b/tests/actions/codeblocks/environment_variables.lua
new file mode 100644
index 0000000..83602ad
--- /dev/null
+++ b/tests/actions/codeblocks/environment_variables.lua
@@ -0,0 +1,59 @@
+--
+-- tests/actions/codeblocks/environment_variables.lua
+-- Validate generation of files block in CodeLite C/C++ projects.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.codeblocks_environment = { }
+ local suite = T.codeblocks_environment
+ local codeblocks = premake.codeblocks
+
+ local old_eol = io.eol
+ function suite.setup()
+ _OPTIONS.cc = 'gcc'
+ old_eol = io.eol
+ io.eol = '\n'
+ end
+
+ function suite.teardown()
+ io.eol = old_eol
+ end
+
+ function suite.withVar_bufferContainsDebugger()
+ local MockName = 'MockName'
+ codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname=MockName} )
+ test.string_contains(io.endcapture(),
+ '\t\t\t<debugger>\n' ..
+ '\t\t\t\t<remote_debugging target="'..MockName..'">\n' ..
+ '\t\t\t\t\t<options additional_cmds_before=.- />\n' ..
+ '\t\t\t\t</remote_debugging>\n' ..
+ '\t\t\t</debugger>'
+ )
+ end
+
+ function suite.format_SetEnvKeyValuePair()
+ local env_arg = 'foo=bar'
+ codeblocks.debugenvs( {debugenvs = {env_arg},language='C',longname='DontCare'} )
+ test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '..env_arg..'" />')
+ end
+
+ function suite.format_mutipleValues_setEnvKeyValuePairEscapeSetEnvKeyValuePair()
+ local env_arg = { 'foo=bar','baz=qux'}
+ codeblocks.debugenvs( {debugenvs = env_arg,language='C',longname='DontCare'} )
+ test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '.. env_arg[1]
+ ..'&#x0A;set env ' .. env_arg[2] .. '" />')
+ end
+
+ --Why is this an error and not silent? Because I feel if you are setting environment variables
+ --and they are not getting set in your IDE, than that is a problem which premake should not be
+ --quite about.
+ --See codeblocks project generator source for the assumption that gcc has anything to do with this setting.
+ function suite.withVar_noneGccCompiler_willCallError()
+ _OPTIONS.cc = 'msc'
+ local called = 0
+ local real_error = error
+ error = function() called = 1 end
+ codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname='foo'} )
+ error = real_error
+ test.isequal(1,called)
+ end \ No newline at end of file
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua
index d5de698..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"
@@ -334,6 +334,7 @@
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
+
function vs10_vcxproj.pchHeaderAndPchSourceSet_bufferContainPchCreate()
configuration("Debug")
pchheader "foo/dummyHeader.h"
diff --git a/tests/actions/vstudio/vc200x/debugdir.lua b/tests/actions/vstudio/vc200x/debugdir.lua
index df5c0b9..644ee38 100644
--- a/tests/actions/vstudio/vc200x/debugdir.lua
+++ b/tests/actions/vstudio/vc200x/debugdir.lua
@@ -58,3 +58,31 @@
/>
]]
end
+
+
+ T.vc200x_env_args = { }
+ local vs200x_env_args = T.vc200x_env_args
+
+ function vs200x_env_args.environmentArgs_notSet_bufferDoesNotContainEnvironment()
+ vc200x.environmentargs( {flags={}} )
+ test.string_does_not_contain(io.endcapture(),'Environment=')
+ end
+ function vs200x_env_args.environmentArgs_set_bufferContainsEnvironment()
+ vc200x.environmentargs( {flags={},environmentargs={'key=value'}} )
+ test.string_contains(io.endcapture(),'Environment=')
+ end
+
+ function vs200x_env_args.environmentArgs_valueUsesQuotes_quotesMarksReplaced()
+ vc200x.environmentargs( {flags={},environmentargs={'key="value"'}} )
+ test.string_contains(io.endcapture(),'Environment="key=&quot;value&quot;"')
+ end
+
+ function vs200x_env_args.environmentArgs_multipleArgs_seperatedUsingCorrectEscape()
+ vc200x.environmentargs( {flags={},environmentargs={'key=value','foo=bar'}} )
+ test.string_contains(io.endcapture(),'Environment="key=value&#x0A;foo=bar"')
+ end
+
+ function vs200x_env_args.environmentArgs_withDontMergeFlag_EnvironmentArgsDontMergeEqualsFalse()
+ vc200x.environmentargs( {flags={EnvironmentArgsDontMerge=1},environmentargs={'key=value'}} )
+ test.string_contains(io.endcapture(),'EnvironmentMerge="false"')
+ end
diff --git a/tests/actions/vstudio/vc2010/test_debugdir.lua b/tests/actions/vstudio/vc2010/test_debugdir.lua
index 6aff768..5651515 100755
--- a/tests/actions/vstudio/vc2010/test_debugdir.lua
+++ b/tests/actions/vstudio/vc2010/test_debugdir.lua
@@ -53,3 +53,44 @@
<LocalDebuggerCommandArguments>arg1 arg2</LocalDebuggerCommandArguments>
]]
end
+
+
+
+ T.vs2010_debug_environment = { }
+ local vs10_debug_environment = T.vs2010_debug_environment
+ local vs2010 = premake.vstudio.vc2010
+
+ function vs10_debug_environment.config_noDebugEnvsTable_bufferDoesNotContainLocalDebuggerEnvironment()
+ vs2010.debugenvs( {flags={}} )
+ test.string_does_not_contain(io.endcapture(),'<LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.config_NoneEmtpyDebugEnvTable_bufferContainsLocalDebuggerEnvironment()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.format_listContainsOneEntry_openTagKeyValuePairCloseTag()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.format_listContainsTwoEntries_openTagFirstPairNewLineSecondPairCloseTag()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value','foo=bar'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value\nfoo=bar</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.flags_withOutEnvironmentArgsInherit_doesNotContainLocalDebuggerEnvironmentArg()
+ vs2010.debugenvs({flags={},environmentargs ={'key=value'}} )
+ test.string_does_not_contain(io.endcapture(),'%$%(LocalDebuggerEnvironment%)')
+ end
+
+ function vs10_debug_environment.flags_withDebugEnvsInherit_endsWithNewLineLocalDebuggerEnvironmentFollowedByClosedTag()
+ vs2010.debugenvs({flags={DebugEnvsInherit=1},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'\n%$%(LocalDebuggerEnvironment%)</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.flags_withDebugEnvsDontMerge_localDebuggerMergeEnvironmentSetToFalse()
+ vs2010.debugenvs({flags={DebugEnvsDontMerge=1},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
+ end
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 1b5ab45..1154235 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -131,6 +131,7 @@
-- CodeBlocks tests
dofile("actions/codeblocks/codeblocks_files.lua")
dofile("actions/codeblocks/test_filters.lua")
+ dofile("actions/codeblocks/environment_variables.lua")
--
-- Register a test action
diff --git a/tests/testfx.lua b/tests/testfx.lua
index c5b49e5..a33a391 100644
--- a/tests/testfx.lua
+++ b/tests/testfx.lua
@@ -191,12 +191,13 @@
--
-- Test execution function
--
-
+ local _OS_host = _OS
local function test_setup(suite, fn)
-- clear out some important globals
_ACTION = "test"
_ARGS = { }
_OPTIONS = { }
+ _OS = _OS_host
premake.solution.list = { }
io.indent = nil
io.eol = "\n"