diff options
author | Jason Perkins <starkos@industriousone.com> | 2013-01-11 17:53:59 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2013-01-11 17:53:59 +0400 |
commit | bc38d316887263a1a53783efb73968e69acadfcd (patch) | |
tree | c13ae97c6e007c9ddf49915d35326390024332a0 /tests/actions | |
parent | e9599feea3b3b42d92797ac789c43dadcee81f29 (diff) |
Bug 268: Target extension not set properly for Visual Studio 2010
Diffstat (limited to 'tests/actions')
-rw-r--r-- | tests/actions/vstudio/test_vs2010_flags.lua | 57 | ||||
-rw-r--r-- | tests/actions/vstudio/test_vs2010_project_kinds.lua | 45 | ||||
-rw-r--r-- | tests/actions/vstudio/test_vs2010_vcxproj.lua | 60 | ||||
-rw-r--r-- | tests/actions/vstudio/vc2010/test_output_props.lua | 179 |
4 files changed, 204 insertions, 137 deletions
diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua index c09776c..973ab71 100644 --- a/tests/actions/vstudio/test_vs2010_flags.lua +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -9,12 +9,12 @@ function vs10_flags.setup() sln = solution "MySolution"
configurations { "Debug" }
platforms {}
-
+
prj = project "MyProject"
language "C++"
kind "ConsoleApp"
- uuid "AE61726D-187C-E440-BD07-2556188A6565"
- includedirs{"foo/bar"}
+ uuid "AE61726D-187C-E440-BD07-2556188A6565"
+ includedirs{"foo/bar"}
end
function vs10_flags.teardown()
@@ -35,14 +35,14 @@ end function vs10_flags.sseSet()
flags {"EnableSSE"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
end
function vs10_flags.sse2Set()
flags {"EnableSSE2"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
end
@@ -54,63 +54,63 @@ end function vs10_flags.extraWarning_warningLevelIsFour()
flags {"ExtraWarnings"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<WarningLevel>Level4</WarningLevel>')
end
function vs10_flags.extraWarning_treatWarningsAsError_setToTrue()
flags {"FatalWarnings"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWarningAsError>true</TreatWarningAsError>')
end
function vs10_flags.floatFast_floatingPointModel_setToFast()
flags {"FloatFast"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<FloatingPointModel>Fast</FloatingPointModel>')
end
function vs10_flags.floatStrict_floatingPointModel_setToStrict()
flags {"FloatStrict"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<FloatingPointModel>Strict</FloatingPointModel>')
end
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToTrue()
flags {"NativeWChar"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
end
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToFalse()
flags {"NoNativeWChar"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
end
function vs10_flags.noExceptions_exceptionHandling_setToFalse()
flags {"NoExceptions"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<ExceptionHandling>false</ExceptionHandling>')
end
function vs10_flags.structuredExceptions_exceptionHandling_setToAsync()
flags {"SEH"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<ExceptionHandling>Async</ExceptionHandling>')
end
function vs10_flags.noFramePointer_omitFramePointers_setToTrue()
flags {"NoFramePointer"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<OmitFramePointers>true</OmitFramePointers>')
end
@@ -118,27 +118,27 @@ end function vs10_flags.noRTTI_runtimeTypeInfo_setToFalse()
flags {"NoRTTI"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
end
function vs10_flags.optimizeSize_optimization_setToMinSpace()
flags {"OptimizeSize"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>MinSpace</Optimization>')
end
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
flags {"OptimizeSpeed"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>MaxSpeed</Optimization>')
end
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
flags {"Optimize"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>Full</Optimization>')
end
@@ -177,7 +177,7 @@ end function vs10_flags.unicode_characterSet_setToUnicode()
flags {"Unicode"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<CharacterSet>Unicode</CharacterSet>')
end
@@ -186,28 +186,28 @@ end function vs10_flags.debugAndNoMinimalRebuildAndSymbols_minimalRebuild_setToFalse()
flags {debug_string,"NoMinimalRebuild"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end
function vs10_flags.debugYetNotMinimalRebuild_minimalRebuild_setToTrue()
flags {debug_string}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>true</MinimalRebuild>')
end
function vs10_flags.release_minimalRebuild_setToFalse()
flags {release_string}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end
function vs10_flags.mfc_useOfMfc_setToStatic()
flags{"MFC"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<UseOfMfc>Dynamic</UseOfMfc>')
end
@@ -232,14 +232,14 @@ end function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_setToProgramDatabase()
flags{"Symbols","NoEditAndContinue"}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end
function vs10_flags.symbolsAndRelease_DebugInformationFormat_setToProgramDatabase()
flags{"Symbols",release_string}
-
+
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end
@@ -255,13 +255,6 @@ function vs10_flags.noSymbols_DebugInformationFormat_blockIsEmpty() test.string_contains(buffer,'<DebugInformationFormat></DebugInformationFormat>')
end
-function vs10_flags.noManifest_GenerateManifest_setToFalse()
- flags{"NoManifest"}
-
- local buffer = get_buffer()
- test.string_contains(buffer,'<GenerateManifest Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">false</GenerateManifest>')
-end
-
function vs10_flags.noSymbols_bufferDoesNotContainprogramDataBaseFile()
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<Link>.*<ProgramDataBaseFileName>.*</Link>')
diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 1de75a4..d32146a 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -65,51 +65,6 @@ test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
end
- function vs10_project_kinds.sharedLib_bufferContainsImportLibrary()
- kind "SharedLib"
- local buffer = get_buffer()
- test.string_contains(buffer,'<Link>.*<ImportLibrary>MyProject.lib</ImportLibrary>.*</Link>')
- end
-
- function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_linkSectionContainsImportLibrary()
- kind "SharedLib"
- flags{"NoImportLib"}
- local buffer = get_buffer()
- test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
- end
-
- function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
- kind "SharedLib"
- local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
- end
-
- function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
- kind "SharedLib"
- flags{"NoImportLib"}
- local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
- end
-
- function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_ignoreImportLibraryValueIsFalse()
- kind "SharedLib"
- local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*false</IgnoreImportLibrary>.*</PropertyGroup>')
- end
-
- function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_ignoreImportLibraryValueIsTrue()
- kind "SharedLib"
- flags{"NoImportLib"}
- local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*true</IgnoreImportLibrary>.*</PropertyGroup>')
- end
-
- function vs10_project_kinds.staticLib_doesNotContainLinkIncremental()
- kind "StaticLib"
- local buffer = get_buffer()
- test.string_does_not_contain(buffer,'<LinkIncremental.*</LinkIncremental>')
- end
-
function vs10_project_kinds.sharedLib_withoutOptimisation_linkIncrementalValueIsTrue()
kind "SharedLib"
local buffer = get_buffer()
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index a7a3942..c5b3401 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -117,20 +117,6 @@ 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>') - end - function vs10_vcxproj.initDirPresent() - 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>') @@ -233,52 +219,6 @@ test.string_contains(buffer,'<PostBuildEvent>.*<Command>"doSomeThing"</Command>.*</PostBuildEvent>') end - function vs10_vcxproj.outDir_directorySuppliedIsNotSlashPostFixed_bufferContainsOutDirSlashPostFixed() - targetdir("dir") - local buffer = get_buffer() - test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>') - end - --postfixed directory slashes are removed by default - --yet these following two tests are to ensure if this behaviour is changed they will fail - function vs10_vcxproj.outDir_directorySuppliedWhichIsForwardSlashPostFixed_bufferContainsOutDirSlashPostFixed() - targetdir("dir/") - 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() - 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 - 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() - test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>') - end - function vs10_vcxproj.targetName() - configuration("Debug") - targetname ("foo_d") - local buffer = get_buffer() - test.string_contains(buffer,'<TargetName Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">foo_d</TargetName>') - end - function vs10_vcxproj.noExtraWarnings_bufferDoesNotContainSmallerTypeCheck() local buffer = get_buffer() test.string_does_not_contain(buffer,'<SmallerTypeCheck>') diff --git a/tests/actions/vstudio/vc2010/test_output_props.lua b/tests/actions/vstudio/vc2010/test_output_props.lua new file mode 100644 index 0000000..30c6375 --- /dev/null +++ b/tests/actions/vstudio/vc2010/test_output_props.lua @@ -0,0 +1,179 @@ +-- +-- tests/actions/vstudio/vc2010/test_output_props.lua +-- Validate generation of the output property groups. +-- Copyright (c) 2011-2013 Jason Perkins and the Premake project +-- + + T.vstudio_vs2010_output_props = {} + local suite = T.vstudio_vs2010_output_props + local vc2010 = premake.vstudio.vc2010 + + +-- +-- Setup +-- + + local sln + + function suite.setup() + _ACTION = "vs2010" + sln = test.createsolution() + end + + local function prepare() + premake.bake.buildconfigs() + sln.vstudio_configs = premake.vstudio.buildconfigs(sln) + local prj = premake.solution.getproject(sln, 1) + vc2010.outputProperties(prj) + end + + +-- +-- Check the structure with the default project values. +-- + + function suite.structureIsCorrect_onDefaultValues() + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.exe</TargetExt> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + ]] + end + + +-- +-- Static libraries should omit the link incremental element entirely. +-- + + function suite.omitLinkIncremental_onStaticLib() + kind "StaticLib" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.lib</TargetExt> + </PropertyGroup> + ]] + end + +-- +-- Optimized builds should not link incrementally. +-- + + function suite.noIncrementalLink_onOptimizedBuild() + flags "Optimize" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.exe</TargetExt> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + ]] + end + +-- +-- The target directory is applied, if specified. +-- + + function suite.outDir_onTargetDir() + targetdir "../bin" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>..\bin\</OutDir> + ]] + end + +-- +-- The objeccts directory is applied, if specified. +-- + + function suite.intDir_onTargetDir() + objdir "../tmp" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>..\tmp\Debug\</IntDir> + ]] + end + +-- +-- The target name is applied, if specified. +-- + + function suite.targetName_onTargetName() + targetname "MyTarget" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyTarget</TargetName> + ]] + end + +-- +-- A target extension should be used if specified. +-- + + function suite.targetExt_onTargetExtension() + targetextension ".delta" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.delta</TargetExt> + ]] + end + +-- +-- If the NoImportLib flag is set, add the IgnoreImportLibrary element. +-- + + function suite.ignoreImportLib_onNoImportLib() + kind "SharedLib" + flags "NoImportLib" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.dll</TargetExt> + <IgnoreImportLibrary>true</IgnoreImportLibrary> + ]] + end + + +-- +-- If the NoManifest flag is set, add the GenerateManifest element. +-- + + function suite.generateManifest_onNoManifest() + flags "NoManifest" + prepare() + test.capture [[ + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\</OutDir> + <IntDir>obj\Debug\</IntDir> + <TargetName>MyProject</TargetName> + <TargetExt>.exe</TargetExt> + <LinkIncremental>true</LinkIncremental> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + ]] + end |