PageRenderTime 49ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/front/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py

https://gitlab.com/boxnia/NFU_MOVIL
Python | 1117 lines | 1100 code | 9 blank | 8 comment | 12 complexity | 1c3319fdd82eb3a0f2905c20c86cdfc7 MD5 | raw file
  1. #!/usr/bin/env python
  2. # Copyright (c) 2012 Google Inc. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Unit tests for the MSVSSettings.py file."""
  6. import StringIO
  7. import unittest
  8. import gyp.MSVSSettings as MSVSSettings
  9. class TestSequenceFunctions(unittest.TestCase):
  10. def setUp(self):
  11. self.stderr = StringIO.StringIO()
  12. def _ExpectedWarnings(self, expected):
  13. """Compares recorded lines to expected warnings."""
  14. self.stderr.seek(0)
  15. actual = self.stderr.read().split('\n')
  16. actual = [line for line in actual if line]
  17. self.assertEqual(sorted(expected), sorted(actual))
  18. def testValidateMSVSSettings_tool_names(self):
  19. """Tests that only MSVS tool names are allowed."""
  20. MSVSSettings.ValidateMSVSSettings(
  21. {'VCCLCompilerTool': {},
  22. 'VCLinkerTool': {},
  23. 'VCMIDLTool': {},
  24. 'foo': {},
  25. 'VCResourceCompilerTool': {},
  26. 'VCLibrarianTool': {},
  27. 'VCManifestTool': {},
  28. 'ClCompile': {}},
  29. self.stderr)
  30. self._ExpectedWarnings([
  31. 'Warning: unrecognized tool foo',
  32. 'Warning: unrecognized tool ClCompile'])
  33. def testValidateMSVSSettings_settings(self):
  34. """Tests that for invalid MSVS settings."""
  35. MSVSSettings.ValidateMSVSSettings(
  36. {'VCCLCompilerTool': {
  37. 'AdditionalIncludeDirectories': 'folder1;folder2',
  38. 'AdditionalOptions': ['string1', 'string2'],
  39. 'AdditionalUsingDirectories': 'folder1;folder2',
  40. 'AssemblerListingLocation': 'a_file_name',
  41. 'AssemblerOutput': '0',
  42. 'BasicRuntimeChecks': '5',
  43. 'BrowseInformation': 'fdkslj',
  44. 'BrowseInformationFile': 'a_file_name',
  45. 'BufferSecurityCheck': 'true',
  46. 'CallingConvention': '-1',
  47. 'CompileAs': '1',
  48. 'DebugInformationFormat': '2',
  49. 'DefaultCharIsUnsigned': 'true',
  50. 'Detect64BitPortabilityProblems': 'true',
  51. 'DisableLanguageExtensions': 'true',
  52. 'DisableSpecificWarnings': 'string1;string2',
  53. 'EnableEnhancedInstructionSet': '1',
  54. 'EnableFiberSafeOptimizations': 'true',
  55. 'EnableFunctionLevelLinking': 'true',
  56. 'EnableIntrinsicFunctions': 'true',
  57. 'EnablePREfast': 'true',
  58. 'Enableprefast': 'bogus',
  59. 'ErrorReporting': '1',
  60. 'ExceptionHandling': '1',
  61. 'ExpandAttributedSource': 'true',
  62. 'FavorSizeOrSpeed': '1',
  63. 'FloatingPointExceptions': 'true',
  64. 'FloatingPointModel': '1',
  65. 'ForceConformanceInForLoopScope': 'true',
  66. 'ForcedIncludeFiles': 'file1;file2',
  67. 'ForcedUsingFiles': 'file1;file2',
  68. 'GeneratePreprocessedFile': '1',
  69. 'GenerateXMLDocumentationFiles': 'true',
  70. 'IgnoreStandardIncludePath': 'true',
  71. 'InlineFunctionExpansion': '1',
  72. 'KeepComments': 'true',
  73. 'MinimalRebuild': 'true',
  74. 'ObjectFile': 'a_file_name',
  75. 'OmitDefaultLibName': 'true',
  76. 'OmitFramePointers': 'true',
  77. 'OpenMP': 'true',
  78. 'Optimization': '1',
  79. 'PrecompiledHeaderFile': 'a_file_name',
  80. 'PrecompiledHeaderThrough': 'a_file_name',
  81. 'PreprocessorDefinitions': 'string1;string2',
  82. 'ProgramDataBaseFileName': 'a_file_name',
  83. 'RuntimeLibrary': '1',
  84. 'RuntimeTypeInfo': 'true',
  85. 'ShowIncludes': 'true',
  86. 'SmallerTypeCheck': 'true',
  87. 'StringPooling': 'true',
  88. 'StructMemberAlignment': '1',
  89. 'SuppressStartupBanner': 'true',
  90. 'TreatWChar_tAsBuiltInType': 'true',
  91. 'UndefineAllPreprocessorDefinitions': 'true',
  92. 'UndefinePreprocessorDefinitions': 'string1;string2',
  93. 'UseFullPaths': 'true',
  94. 'UsePrecompiledHeader': '1',
  95. 'UseUnicodeResponseFiles': 'true',
  96. 'WarnAsError': 'true',
  97. 'WarningLevel': '1',
  98. 'WholeProgramOptimization': 'true',
  99. 'XMLDocumentationFileName': 'a_file_name',
  100. 'ZZXYZ': 'bogus'},
  101. 'VCLinkerTool': {
  102. 'AdditionalDependencies': 'file1;file2',
  103. 'AdditionalDependencies_excluded': 'file3',
  104. 'AdditionalLibraryDirectories': 'folder1;folder2',
  105. 'AdditionalManifestDependencies': 'file1;file2',
  106. 'AdditionalOptions': 'a string1',
  107. 'AddModuleNamesToAssembly': 'file1;file2',
  108. 'AllowIsolation': 'true',
  109. 'AssemblyDebug': '2',
  110. 'AssemblyLinkResource': 'file1;file2',
  111. 'BaseAddress': 'a string1',
  112. 'CLRImageType': '2',
  113. 'CLRThreadAttribute': '2',
  114. 'CLRUnmanagedCodeCheck': 'true',
  115. 'DataExecutionPrevention': '2',
  116. 'DelayLoadDLLs': 'file1;file2',
  117. 'DelaySign': 'true',
  118. 'Driver': '2',
  119. 'EmbedManagedResourceFile': 'file1;file2',
  120. 'EnableCOMDATFolding': '2',
  121. 'EnableUAC': 'true',
  122. 'EntryPointSymbol': 'a string1',
  123. 'ErrorReporting': '2',
  124. 'FixedBaseAddress': '2',
  125. 'ForceSymbolReferences': 'file1;file2',
  126. 'FunctionOrder': 'a_file_name',
  127. 'GenerateDebugInformation': 'true',
  128. 'GenerateManifest': 'true',
  129. 'GenerateMapFile': 'true',
  130. 'HeapCommitSize': 'a string1',
  131. 'HeapReserveSize': 'a string1',
  132. 'IgnoreAllDefaultLibraries': 'true',
  133. 'IgnoreDefaultLibraryNames': 'file1;file2',
  134. 'IgnoreEmbeddedIDL': 'true',
  135. 'IgnoreImportLibrary': 'true',
  136. 'ImportLibrary': 'a_file_name',
  137. 'KeyContainer': 'a_file_name',
  138. 'KeyFile': 'a_file_name',
  139. 'LargeAddressAware': '2',
  140. 'LinkIncremental': '2',
  141. 'LinkLibraryDependencies': 'true',
  142. 'LinkTimeCodeGeneration': '2',
  143. 'ManifestFile': 'a_file_name',
  144. 'MapExports': 'true',
  145. 'MapFileName': 'a_file_name',
  146. 'MergedIDLBaseFileName': 'a_file_name',
  147. 'MergeSections': 'a string1',
  148. 'MidlCommandFile': 'a_file_name',
  149. 'ModuleDefinitionFile': 'a_file_name',
  150. 'OptimizeForWindows98': '1',
  151. 'OptimizeReferences': '2',
  152. 'OutputFile': 'a_file_name',
  153. 'PerUserRedirection': 'true',
  154. 'Profile': 'true',
  155. 'ProfileGuidedDatabase': 'a_file_name',
  156. 'ProgramDatabaseFile': 'a_file_name',
  157. 'RandomizedBaseAddress': '2',
  158. 'RegisterOutput': 'true',
  159. 'ResourceOnlyDLL': 'true',
  160. 'SetChecksum': 'true',
  161. 'ShowProgress': '2',
  162. 'StackCommitSize': 'a string1',
  163. 'StackReserveSize': 'a string1',
  164. 'StripPrivateSymbols': 'a_file_name',
  165. 'SubSystem': '2',
  166. 'SupportUnloadOfDelayLoadedDLL': 'true',
  167. 'SuppressStartupBanner': 'true',
  168. 'SwapRunFromCD': 'true',
  169. 'SwapRunFromNet': 'true',
  170. 'TargetMachine': '2',
  171. 'TerminalServerAware': '2',
  172. 'TurnOffAssemblyGeneration': 'true',
  173. 'TypeLibraryFile': 'a_file_name',
  174. 'TypeLibraryResourceID': '33',
  175. 'UACExecutionLevel': '2',
  176. 'UACUIAccess': 'true',
  177. 'UseLibraryDependencyInputs': 'true',
  178. 'UseUnicodeResponseFiles': 'true',
  179. 'Version': 'a string1'},
  180. 'VCMIDLTool': {
  181. 'AdditionalIncludeDirectories': 'folder1;folder2',
  182. 'AdditionalOptions': 'a string1',
  183. 'CPreprocessOptions': 'a string1',
  184. 'DefaultCharType': '1',
  185. 'DLLDataFileName': 'a_file_name',
  186. 'EnableErrorChecks': '1',
  187. 'ErrorCheckAllocations': 'true',
  188. 'ErrorCheckBounds': 'true',
  189. 'ErrorCheckEnumRange': 'true',
  190. 'ErrorCheckRefPointers': 'true',
  191. 'ErrorCheckStubData': 'true',
  192. 'GenerateStublessProxies': 'true',
  193. 'GenerateTypeLibrary': 'true',
  194. 'HeaderFileName': 'a_file_name',
  195. 'IgnoreStandardIncludePath': 'true',
  196. 'InterfaceIdentifierFileName': 'a_file_name',
  197. 'MkTypLibCompatible': 'true',
  198. 'notgood': 'bogus',
  199. 'OutputDirectory': 'a string1',
  200. 'PreprocessorDefinitions': 'string1;string2',
  201. 'ProxyFileName': 'a_file_name',
  202. 'RedirectOutputAndErrors': 'a_file_name',
  203. 'StructMemberAlignment': '1',
  204. 'SuppressStartupBanner': 'true',
  205. 'TargetEnvironment': '1',
  206. 'TypeLibraryName': 'a_file_name',
  207. 'UndefinePreprocessorDefinitions': 'string1;string2',
  208. 'ValidateParameters': 'true',
  209. 'WarnAsError': 'true',
  210. 'WarningLevel': '1'},
  211. 'VCResourceCompilerTool': {
  212. 'AdditionalOptions': 'a string1',
  213. 'AdditionalIncludeDirectories': 'folder1;folder2',
  214. 'Culture': '1003',
  215. 'IgnoreStandardIncludePath': 'true',
  216. 'notgood2': 'bogus',
  217. 'PreprocessorDefinitions': 'string1;string2',
  218. 'ResourceOutputFileName': 'a string1',
  219. 'ShowProgress': 'true',
  220. 'SuppressStartupBanner': 'true',
  221. 'UndefinePreprocessorDefinitions': 'string1;string2'},
  222. 'VCLibrarianTool': {
  223. 'AdditionalDependencies': 'file1;file2',
  224. 'AdditionalLibraryDirectories': 'folder1;folder2',
  225. 'AdditionalOptions': 'a string1',
  226. 'ExportNamedFunctions': 'string1;string2',
  227. 'ForceSymbolReferences': 'a string1',
  228. 'IgnoreAllDefaultLibraries': 'true',
  229. 'IgnoreSpecificDefaultLibraries': 'file1;file2',
  230. 'LinkLibraryDependencies': 'true',
  231. 'ModuleDefinitionFile': 'a_file_name',
  232. 'OutputFile': 'a_file_name',
  233. 'SuppressStartupBanner': 'true',
  234. 'UseUnicodeResponseFiles': 'true'},
  235. 'VCManifestTool': {
  236. 'AdditionalManifestFiles': 'file1;file2',
  237. 'AdditionalOptions': 'a string1',
  238. 'AssemblyIdentity': 'a string1',
  239. 'ComponentFileName': 'a_file_name',
  240. 'DependencyInformationFile': 'a_file_name',
  241. 'GenerateCatalogFiles': 'true',
  242. 'InputResourceManifests': 'a string1',
  243. 'ManifestResourceFile': 'a_file_name',
  244. 'OutputManifestFile': 'a_file_name',
  245. 'RegistrarScriptFile': 'a_file_name',
  246. 'ReplacementsFile': 'a_file_name',
  247. 'SuppressStartupBanner': 'true',
  248. 'TypeLibraryFile': 'a_file_name',
  249. 'UpdateFileHashes': 'truel',
  250. 'UpdateFileHashesSearchPath': 'a_file_name',
  251. 'UseFAT32Workaround': 'true',
  252. 'UseUnicodeResponseFiles': 'true',
  253. 'VerboseOutput': 'true'}},
  254. self.stderr)
  255. self._ExpectedWarnings([
  256. 'Warning: for VCCLCompilerTool/BasicRuntimeChecks, '
  257. 'index value (5) not in expected range [0, 4)',
  258. 'Warning: for VCCLCompilerTool/BrowseInformation, '
  259. "invalid literal for int() with base 10: 'fdkslj'",
  260. 'Warning: for VCCLCompilerTool/CallingConvention, '
  261. 'index value (-1) not in expected range [0, 4)',
  262. 'Warning: for VCCLCompilerTool/DebugInformationFormat, '
  263. 'converted value for 2 not specified.',
  264. 'Warning: unrecognized setting VCCLCompilerTool/Enableprefast',
  265. 'Warning: unrecognized setting VCCLCompilerTool/ZZXYZ',
  266. 'Warning: for VCLinkerTool/TargetMachine, '
  267. 'converted value for 2 not specified.',
  268. 'Warning: unrecognized setting VCMIDLTool/notgood',
  269. 'Warning: unrecognized setting VCResourceCompilerTool/notgood2',
  270. 'Warning: for VCManifestTool/UpdateFileHashes, '
  271. "expected bool; got 'truel'"
  272. ''])
  273. def testValidateMSBuildSettings_settings(self):
  274. """Tests that for invalid MSBuild settings."""
  275. MSVSSettings.ValidateMSBuildSettings(
  276. {'ClCompile': {
  277. 'AdditionalIncludeDirectories': 'folder1;folder2',
  278. 'AdditionalOptions': ['string1', 'string2'],
  279. 'AdditionalUsingDirectories': 'folder1;folder2',
  280. 'AssemblerListingLocation': 'a_file_name',
  281. 'AssemblerOutput': 'NoListing',
  282. 'BasicRuntimeChecks': 'StackFrameRuntimeCheck',
  283. 'BrowseInformation': 'false',
  284. 'BrowseInformationFile': 'a_file_name',
  285. 'BufferSecurityCheck': 'true',
  286. 'BuildingInIDE': 'true',
  287. 'CallingConvention': 'Cdecl',
  288. 'CompileAs': 'CompileAsC',
  289. 'CompileAsManaged': 'true',
  290. 'CreateHotpatchableImage': 'true',
  291. 'DebugInformationFormat': 'ProgramDatabase',
  292. 'DisableLanguageExtensions': 'true',
  293. 'DisableSpecificWarnings': 'string1;string2',
  294. 'EnableEnhancedInstructionSet': 'StreamingSIMDExtensions',
  295. 'EnableFiberSafeOptimizations': 'true',
  296. 'EnablePREfast': 'true',
  297. 'Enableprefast': 'bogus',
  298. 'ErrorReporting': 'Prompt',
  299. 'ExceptionHandling': 'SyncCThrow',
  300. 'ExpandAttributedSource': 'true',
  301. 'FavorSizeOrSpeed': 'Neither',
  302. 'FloatingPointExceptions': 'true',
  303. 'FloatingPointModel': 'Precise',
  304. 'ForceConformanceInForLoopScope': 'true',
  305. 'ForcedIncludeFiles': 'file1;file2',
  306. 'ForcedUsingFiles': 'file1;file2',
  307. 'FunctionLevelLinking': 'false',
  308. 'GenerateXMLDocumentationFiles': 'true',
  309. 'IgnoreStandardIncludePath': 'true',
  310. 'InlineFunctionExpansion': 'OnlyExplicitInline',
  311. 'IntrinsicFunctions': 'false',
  312. 'MinimalRebuild': 'true',
  313. 'MultiProcessorCompilation': 'true',
  314. 'ObjectFileName': 'a_file_name',
  315. 'OmitDefaultLibName': 'true',
  316. 'OmitFramePointers': 'true',
  317. 'OpenMPSupport': 'true',
  318. 'Optimization': 'Disabled',
  319. 'PrecompiledHeader': 'NotUsing',
  320. 'PrecompiledHeaderFile': 'a_file_name',
  321. 'PrecompiledHeaderOutputFile': 'a_file_name',
  322. 'PreprocessKeepComments': 'true',
  323. 'PreprocessorDefinitions': 'string1;string2',
  324. 'PreprocessOutputPath': 'a string1',
  325. 'PreprocessSuppressLineNumbers': 'false',
  326. 'PreprocessToFile': 'false',
  327. 'ProcessorNumber': '33',
  328. 'ProgramDataBaseFileName': 'a_file_name',
  329. 'RuntimeLibrary': 'MultiThreaded',
  330. 'RuntimeTypeInfo': 'true',
  331. 'ShowIncludes': 'true',
  332. 'SmallerTypeCheck': 'true',
  333. 'StringPooling': 'true',
  334. 'StructMemberAlignment': '1Byte',
  335. 'SuppressStartupBanner': 'true',
  336. 'TrackerLogDirectory': 'a_folder',
  337. 'TreatSpecificWarningsAsErrors': 'string1;string2',
  338. 'TreatWarningAsError': 'true',
  339. 'TreatWChar_tAsBuiltInType': 'true',
  340. 'UndefineAllPreprocessorDefinitions': 'true',
  341. 'UndefinePreprocessorDefinitions': 'string1;string2',
  342. 'UseFullPaths': 'true',
  343. 'UseUnicodeForAssemblerListing': 'true',
  344. 'WarningLevel': 'TurnOffAllWarnings',
  345. 'WholeProgramOptimization': 'true',
  346. 'XMLDocumentationFileName': 'a_file_name',
  347. 'ZZXYZ': 'bogus'},
  348. 'Link': {
  349. 'AdditionalDependencies': 'file1;file2',
  350. 'AdditionalLibraryDirectories': 'folder1;folder2',
  351. 'AdditionalManifestDependencies': 'file1;file2',
  352. 'AdditionalOptions': 'a string1',
  353. 'AddModuleNamesToAssembly': 'file1;file2',
  354. 'AllowIsolation': 'true',
  355. 'AssemblyDebug': '',
  356. 'AssemblyLinkResource': 'file1;file2',
  357. 'BaseAddress': 'a string1',
  358. 'BuildingInIDE': 'true',
  359. 'CLRImageType': 'ForceIJWImage',
  360. 'CLRSupportLastError': 'Enabled',
  361. 'CLRThreadAttribute': 'MTAThreadingAttribute',
  362. 'CLRUnmanagedCodeCheck': 'true',
  363. 'CreateHotPatchableImage': 'X86Image',
  364. 'DataExecutionPrevention': 'false',
  365. 'DelayLoadDLLs': 'file1;file2',
  366. 'DelaySign': 'true',
  367. 'Driver': 'NotSet',
  368. 'EmbedManagedResourceFile': 'file1;file2',
  369. 'EnableCOMDATFolding': 'false',
  370. 'EnableUAC': 'true',
  371. 'EntryPointSymbol': 'a string1',
  372. 'FixedBaseAddress': 'false',
  373. 'ForceFileOutput': 'Enabled',
  374. 'ForceSymbolReferences': 'file1;file2',
  375. 'FunctionOrder': 'a_file_name',
  376. 'GenerateDebugInformation': 'true',
  377. 'GenerateMapFile': 'true',
  378. 'HeapCommitSize': 'a string1',
  379. 'HeapReserveSize': 'a string1',
  380. 'IgnoreAllDefaultLibraries': 'true',
  381. 'IgnoreEmbeddedIDL': 'true',
  382. 'IgnoreSpecificDefaultLibraries': 'a_file_list',
  383. 'ImageHasSafeExceptionHandlers': 'true',
  384. 'ImportLibrary': 'a_file_name',
  385. 'KeyContainer': 'a_file_name',
  386. 'KeyFile': 'a_file_name',
  387. 'LargeAddressAware': 'false',
  388. 'LinkDLL': 'true',
  389. 'LinkErrorReporting': 'SendErrorReport',
  390. 'LinkStatus': 'true',
  391. 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration',
  392. 'ManifestFile': 'a_file_name',
  393. 'MapExports': 'true',
  394. 'MapFileName': 'a_file_name',
  395. 'MergedIDLBaseFileName': 'a_file_name',
  396. 'MergeSections': 'a string1',
  397. 'MidlCommandFile': 'a_file_name',
  398. 'MinimumRequiredVersion': 'a string1',
  399. 'ModuleDefinitionFile': 'a_file_name',
  400. 'MSDOSStubFileName': 'a_file_name',
  401. 'NoEntryPoint': 'true',
  402. 'OptimizeReferences': 'false',
  403. 'OutputFile': 'a_file_name',
  404. 'PerUserRedirection': 'true',
  405. 'PreventDllBinding': 'true',
  406. 'Profile': 'true',
  407. 'ProfileGuidedDatabase': 'a_file_name',
  408. 'ProgramDatabaseFile': 'a_file_name',
  409. 'RandomizedBaseAddress': 'false',
  410. 'RegisterOutput': 'true',
  411. 'SectionAlignment': '33',
  412. 'SetChecksum': 'true',
  413. 'ShowProgress': 'LinkVerboseREF',
  414. 'SpecifySectionAttributes': 'a string1',
  415. 'StackCommitSize': 'a string1',
  416. 'StackReserveSize': 'a string1',
  417. 'StripPrivateSymbols': 'a_file_name',
  418. 'SubSystem': 'Console',
  419. 'SupportNobindOfDelayLoadedDLL': 'true',
  420. 'SupportUnloadOfDelayLoadedDLL': 'true',
  421. 'SuppressStartupBanner': 'true',
  422. 'SwapRunFromCD': 'true',
  423. 'SwapRunFromNET': 'true',
  424. 'TargetMachine': 'MachineX86',
  425. 'TerminalServerAware': 'false',
  426. 'TrackerLogDirectory': 'a_folder',
  427. 'TreatLinkerWarningAsErrors': 'true',
  428. 'TurnOffAssemblyGeneration': 'true',
  429. 'TypeLibraryFile': 'a_file_name',
  430. 'TypeLibraryResourceID': '33',
  431. 'UACExecutionLevel': 'AsInvoker',
  432. 'UACUIAccess': 'true',
  433. 'Version': 'a string1'},
  434. 'ResourceCompile': {
  435. 'AdditionalIncludeDirectories': 'folder1;folder2',
  436. 'AdditionalOptions': 'a string1',
  437. 'Culture': '0x236',
  438. 'IgnoreStandardIncludePath': 'true',
  439. 'NullTerminateStrings': 'true',
  440. 'PreprocessorDefinitions': 'string1;string2',
  441. 'ResourceOutputFileName': 'a string1',
  442. 'ShowProgress': 'true',
  443. 'SuppressStartupBanner': 'true',
  444. 'TrackerLogDirectory': 'a_folder',
  445. 'UndefinePreprocessorDefinitions': 'string1;string2'},
  446. 'Midl': {
  447. 'AdditionalIncludeDirectories': 'folder1;folder2',
  448. 'AdditionalOptions': 'a string1',
  449. 'ApplicationConfigurationMode': 'true',
  450. 'ClientStubFile': 'a_file_name',
  451. 'CPreprocessOptions': 'a string1',
  452. 'DefaultCharType': 'Signed',
  453. 'DllDataFileName': 'a_file_name',
  454. 'EnableErrorChecks': 'EnableCustom',
  455. 'ErrorCheckAllocations': 'true',
  456. 'ErrorCheckBounds': 'true',
  457. 'ErrorCheckEnumRange': 'true',
  458. 'ErrorCheckRefPointers': 'true',
  459. 'ErrorCheckStubData': 'true',
  460. 'GenerateClientFiles': 'Stub',
  461. 'GenerateServerFiles': 'None',
  462. 'GenerateStublessProxies': 'true',
  463. 'GenerateTypeLibrary': 'true',
  464. 'HeaderFileName': 'a_file_name',
  465. 'IgnoreStandardIncludePath': 'true',
  466. 'InterfaceIdentifierFileName': 'a_file_name',
  467. 'LocaleID': '33',
  468. 'MkTypLibCompatible': 'true',
  469. 'OutputDirectory': 'a string1',
  470. 'PreprocessorDefinitions': 'string1;string2',
  471. 'ProxyFileName': 'a_file_name',
  472. 'RedirectOutputAndErrors': 'a_file_name',
  473. 'ServerStubFile': 'a_file_name',
  474. 'StructMemberAlignment': 'NotSet',
  475. 'SuppressCompilerWarnings': 'true',
  476. 'SuppressStartupBanner': 'true',
  477. 'TargetEnvironment': 'Itanium',
  478. 'TrackerLogDirectory': 'a_folder',
  479. 'TypeLibFormat': 'NewFormat',
  480. 'TypeLibraryName': 'a_file_name',
  481. 'UndefinePreprocessorDefinitions': 'string1;string2',
  482. 'ValidateAllParameters': 'true',
  483. 'WarnAsError': 'true',
  484. 'WarningLevel': '1'},
  485. 'Lib': {
  486. 'AdditionalDependencies': 'file1;file2',
  487. 'AdditionalLibraryDirectories': 'folder1;folder2',
  488. 'AdditionalOptions': 'a string1',
  489. 'DisplayLibrary': 'a string1',
  490. 'ErrorReporting': 'PromptImmediately',
  491. 'ExportNamedFunctions': 'string1;string2',
  492. 'ForceSymbolReferences': 'a string1',
  493. 'IgnoreAllDefaultLibraries': 'true',
  494. 'IgnoreSpecificDefaultLibraries': 'file1;file2',
  495. 'LinkTimeCodeGeneration': 'true',
  496. 'MinimumRequiredVersion': 'a string1',
  497. 'ModuleDefinitionFile': 'a_file_name',
  498. 'Name': 'a_file_name',
  499. 'OutputFile': 'a_file_name',
  500. 'RemoveObjects': 'file1;file2',
  501. 'SubSystem': 'Console',
  502. 'SuppressStartupBanner': 'true',
  503. 'TargetMachine': 'MachineX86i',
  504. 'TrackerLogDirectory': 'a_folder',
  505. 'TreatLibWarningAsErrors': 'true',
  506. 'UseUnicodeResponseFiles': 'true',
  507. 'Verbose': 'true'},
  508. 'Manifest': {
  509. 'AdditionalManifestFiles': 'file1;file2',
  510. 'AdditionalOptions': 'a string1',
  511. 'AssemblyIdentity': 'a string1',
  512. 'ComponentFileName': 'a_file_name',
  513. 'EnableDPIAwareness': 'fal',
  514. 'GenerateCatalogFiles': 'truel',
  515. 'GenerateCategoryTags': 'true',
  516. 'InputResourceManifests': 'a string1',
  517. 'ManifestFromManagedAssembly': 'a_file_name',
  518. 'notgood3': 'bogus',
  519. 'OutputManifestFile': 'a_file_name',
  520. 'OutputResourceManifests': 'a string1',
  521. 'RegistrarScriptFile': 'a_file_name',
  522. 'ReplacementsFile': 'a_file_name',
  523. 'SuppressDependencyElement': 'true',
  524. 'SuppressStartupBanner': 'true',
  525. 'TrackerLogDirectory': 'a_folder',
  526. 'TypeLibraryFile': 'a_file_name',
  527. 'UpdateFileHashes': 'true',
  528. 'UpdateFileHashesSearchPath': 'a_file_name',
  529. 'VerboseOutput': 'true'},
  530. 'ProjectReference': {
  531. 'LinkLibraryDependencies': 'true',
  532. 'UseLibraryDependencyInputs': 'true'},
  533. 'ManifestResourceCompile': {
  534. 'ResourceOutputFileName': 'a_file_name'},
  535. '': {
  536. 'EmbedManifest': 'true',
  537. 'GenerateManifest': 'true',
  538. 'IgnoreImportLibrary': 'true',
  539. 'LinkIncremental': 'false'}},
  540. self.stderr)
  541. self._ExpectedWarnings([
  542. 'Warning: unrecognized setting ClCompile/Enableprefast',
  543. 'Warning: unrecognized setting ClCompile/ZZXYZ',
  544. 'Warning: unrecognized setting Manifest/notgood3',
  545. 'Warning: for Manifest/GenerateCatalogFiles, '
  546. "expected bool; got 'truel'",
  547. 'Warning: for Lib/TargetMachine, unrecognized enumerated value '
  548. 'MachineX86i',
  549. "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'"])
  550. def testConvertToMSBuildSettings_empty(self):
  551. """Tests an empty conversion."""
  552. msvs_settings = {}
  553. expected_msbuild_settings = {}
  554. actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
  555. msvs_settings,
  556. self.stderr)
  557. self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
  558. self._ExpectedWarnings([])
  559. def testConvertToMSBuildSettings_minimal(self):
  560. """Tests a minimal conversion."""
  561. msvs_settings = {
  562. 'VCCLCompilerTool': {
  563. 'AdditionalIncludeDirectories': 'dir1',
  564. 'AdditionalOptions': '/foo',
  565. 'BasicRuntimeChecks': '0',
  566. },
  567. 'VCLinkerTool': {
  568. 'LinkTimeCodeGeneration': '1',
  569. 'ErrorReporting': '1',
  570. 'DataExecutionPrevention': '2',
  571. },
  572. }
  573. expected_msbuild_settings = {
  574. 'ClCompile': {
  575. 'AdditionalIncludeDirectories': 'dir1',
  576. 'AdditionalOptions': '/foo',
  577. 'BasicRuntimeChecks': 'Default',
  578. },
  579. 'Link': {
  580. 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration',
  581. 'LinkErrorReporting': 'PromptImmediately',
  582. 'DataExecutionPrevention': 'true',
  583. },
  584. }
  585. actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
  586. msvs_settings,
  587. self.stderr)
  588. self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
  589. self._ExpectedWarnings([])
  590. def testConvertToMSBuildSettings_warnings(self):
  591. """Tests conversion that generates warnings."""
  592. msvs_settings = {
  593. 'VCCLCompilerTool': {
  594. 'AdditionalIncludeDirectories': '1',
  595. 'AdditionalOptions': '2',
  596. # These are incorrect values:
  597. 'BasicRuntimeChecks': '12',
  598. 'BrowseInformation': '21',
  599. 'UsePrecompiledHeader': '13',
  600. 'GeneratePreprocessedFile': '14'},
  601. 'VCLinkerTool': {
  602. # These are incorrect values:
  603. 'Driver': '10',
  604. 'LinkTimeCodeGeneration': '31',
  605. 'ErrorReporting': '21',
  606. 'FixedBaseAddress': '6'},
  607. 'VCResourceCompilerTool': {
  608. # Custom
  609. 'Culture': '1003'}}
  610. expected_msbuild_settings = {
  611. 'ClCompile': {
  612. 'AdditionalIncludeDirectories': '1',
  613. 'AdditionalOptions': '2'},
  614. 'Link': {},
  615. 'ResourceCompile': {
  616. # Custom
  617. 'Culture': '0x03eb'}}
  618. actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
  619. msvs_settings,
  620. self.stderr)
  621. self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
  622. self._ExpectedWarnings([
  623. 'Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to '
  624. 'MSBuild, index value (12) not in expected range [0, 4)',
  625. 'Warning: while converting VCCLCompilerTool/BrowseInformation to '
  626. 'MSBuild, index value (21) not in expected range [0, 3)',
  627. 'Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to '
  628. 'MSBuild, index value (13) not in expected range [0, 3)',
  629. 'Warning: while converting VCCLCompilerTool/GeneratePreprocessedFile to '
  630. 'MSBuild, value must be one of [0, 1, 2]; got 14',
  631. 'Warning: while converting VCLinkerTool/Driver to '
  632. 'MSBuild, index value (10) not in expected range [0, 4)',
  633. 'Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to '
  634. 'MSBuild, index value (31) not in expected range [0, 5)',
  635. 'Warning: while converting VCLinkerTool/ErrorReporting to '
  636. 'MSBuild, index value (21) not in expected range [0, 3)',
  637. 'Warning: while converting VCLinkerTool/FixedBaseAddress to '
  638. 'MSBuild, index value (6) not in expected range [0, 3)',
  639. ])
  640. def testConvertToMSBuildSettings_full_synthetic(self):
  641. """Tests conversion of all the MSBuild settings."""
  642. msvs_settings = {
  643. 'VCCLCompilerTool': {
  644. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  645. 'AdditionalOptions': 'a_string',
  646. 'AdditionalUsingDirectories': 'folder1;folder2;folder3',
  647. 'AssemblerListingLocation': 'a_file_name',
  648. 'AssemblerOutput': '0',
  649. 'BasicRuntimeChecks': '1',
  650. 'BrowseInformation': '2',
  651. 'BrowseInformationFile': 'a_file_name',
  652. 'BufferSecurityCheck': 'true',
  653. 'CallingConvention': '0',
  654. 'CompileAs': '1',
  655. 'DebugInformationFormat': '4',
  656. 'DefaultCharIsUnsigned': 'true',
  657. 'Detect64BitPortabilityProblems': 'true',
  658. 'DisableLanguageExtensions': 'true',
  659. 'DisableSpecificWarnings': 'd1;d2;d3',
  660. 'EnableEnhancedInstructionSet': '0',
  661. 'EnableFiberSafeOptimizations': 'true',
  662. 'EnableFunctionLevelLinking': 'true',
  663. 'EnableIntrinsicFunctions': 'true',
  664. 'EnablePREfast': 'true',
  665. 'ErrorReporting': '1',
  666. 'ExceptionHandling': '2',
  667. 'ExpandAttributedSource': 'true',
  668. 'FavorSizeOrSpeed': '0',
  669. 'FloatingPointExceptions': 'true',
  670. 'FloatingPointModel': '1',
  671. 'ForceConformanceInForLoopScope': 'true',
  672. 'ForcedIncludeFiles': 'file1;file2;file3',
  673. 'ForcedUsingFiles': 'file1;file2;file3',
  674. 'GeneratePreprocessedFile': '1',
  675. 'GenerateXMLDocumentationFiles': 'true',
  676. 'IgnoreStandardIncludePath': 'true',
  677. 'InlineFunctionExpansion': '2',
  678. 'KeepComments': 'true',
  679. 'MinimalRebuild': 'true',
  680. 'ObjectFile': 'a_file_name',
  681. 'OmitDefaultLibName': 'true',
  682. 'OmitFramePointers': 'true',
  683. 'OpenMP': 'true',
  684. 'Optimization': '3',
  685. 'PrecompiledHeaderFile': 'a_file_name',
  686. 'PrecompiledHeaderThrough': 'a_file_name',
  687. 'PreprocessorDefinitions': 'd1;d2;d3',
  688. 'ProgramDataBaseFileName': 'a_file_name',
  689. 'RuntimeLibrary': '0',
  690. 'RuntimeTypeInfo': 'true',
  691. 'ShowIncludes': 'true',
  692. 'SmallerTypeCheck': 'true',
  693. 'StringPooling': 'true',
  694. 'StructMemberAlignment': '1',
  695. 'SuppressStartupBanner': 'true',
  696. 'TreatWChar_tAsBuiltInType': 'true',
  697. 'UndefineAllPreprocessorDefinitions': 'true',
  698. 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
  699. 'UseFullPaths': 'true',
  700. 'UsePrecompiledHeader': '1',
  701. 'UseUnicodeResponseFiles': 'true',
  702. 'WarnAsError': 'true',
  703. 'WarningLevel': '2',
  704. 'WholeProgramOptimization': 'true',
  705. 'XMLDocumentationFileName': 'a_file_name'},
  706. 'VCLinkerTool': {
  707. 'AdditionalDependencies': 'file1;file2;file3',
  708. 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
  709. 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3',
  710. 'AdditionalManifestDependencies': 'file1;file2;file3',
  711. 'AdditionalOptions': 'a_string',
  712. 'AddModuleNamesToAssembly': 'file1;file2;file3',
  713. 'AllowIsolation': 'true',
  714. 'AssemblyDebug': '0',
  715. 'AssemblyLinkResource': 'file1;file2;file3',
  716. 'BaseAddress': 'a_string',
  717. 'CLRImageType': '1',
  718. 'CLRThreadAttribute': '2',
  719. 'CLRUnmanagedCodeCheck': 'true',
  720. 'DataExecutionPrevention': '0',
  721. 'DelayLoadDLLs': 'file1;file2;file3',
  722. 'DelaySign': 'true',
  723. 'Driver': '1',
  724. 'EmbedManagedResourceFile': 'file1;file2;file3',
  725. 'EnableCOMDATFolding': '0',
  726. 'EnableUAC': 'true',
  727. 'EntryPointSymbol': 'a_string',
  728. 'ErrorReporting': '0',
  729. 'FixedBaseAddress': '1',
  730. 'ForceSymbolReferences': 'file1;file2;file3',
  731. 'FunctionOrder': 'a_file_name',
  732. 'GenerateDebugInformation': 'true',
  733. 'GenerateManifest': 'true',
  734. 'GenerateMapFile': 'true',
  735. 'HeapCommitSize': 'a_string',
  736. 'HeapReserveSize': 'a_string',
  737. 'IgnoreAllDefaultLibraries': 'true',
  738. 'IgnoreDefaultLibraryNames': 'file1;file2;file3',
  739. 'IgnoreEmbeddedIDL': 'true',
  740. 'IgnoreImportLibrary': 'true',
  741. 'ImportLibrary': 'a_file_name',
  742. 'KeyContainer': 'a_file_name',
  743. 'KeyFile': 'a_file_name',
  744. 'LargeAddressAware': '2',
  745. 'LinkIncremental': '1',
  746. 'LinkLibraryDependencies': 'true',
  747. 'LinkTimeCodeGeneration': '2',
  748. 'ManifestFile': 'a_file_name',
  749. 'MapExports': 'true',
  750. 'MapFileName': 'a_file_name',
  751. 'MergedIDLBaseFileName': 'a_file_name',
  752. 'MergeSections': 'a_string',
  753. 'MidlCommandFile': 'a_file_name',
  754. 'ModuleDefinitionFile': 'a_file_name',
  755. 'OptimizeForWindows98': '1',
  756. 'OptimizeReferences': '0',
  757. 'OutputFile': 'a_file_name',
  758. 'PerUserRedirection': 'true',
  759. 'Profile': 'true',
  760. 'ProfileGuidedDatabase': 'a_file_name',
  761. 'ProgramDatabaseFile': 'a_file_name',
  762. 'RandomizedBaseAddress': '1',
  763. 'RegisterOutput': 'true',
  764. 'ResourceOnlyDLL': 'true',
  765. 'SetChecksum': 'true',
  766. 'ShowProgress': '0',
  767. 'StackCommitSize': 'a_string',
  768. 'StackReserveSize': 'a_string',
  769. 'StripPrivateSymbols': 'a_file_name',
  770. 'SubSystem': '2',
  771. 'SupportUnloadOfDelayLoadedDLL': 'true',
  772. 'SuppressStartupBanner': 'true',
  773. 'SwapRunFromCD': 'true',
  774. 'SwapRunFromNet': 'true',
  775. 'TargetMachine': '3',
  776. 'TerminalServerAware': '2',
  777. 'TurnOffAssemblyGeneration': 'true',
  778. 'TypeLibraryFile': 'a_file_name',
  779. 'TypeLibraryResourceID': '33',
  780. 'UACExecutionLevel': '1',
  781. 'UACUIAccess': 'true',
  782. 'UseLibraryDependencyInputs': 'false',
  783. 'UseUnicodeResponseFiles': 'true',
  784. 'Version': 'a_string'},
  785. 'VCResourceCompilerTool': {
  786. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  787. 'AdditionalOptions': 'a_string',
  788. 'Culture': '1003',
  789. 'IgnoreStandardIncludePath': 'true',
  790. 'PreprocessorDefinitions': 'd1;d2;d3',
  791. 'ResourceOutputFileName': 'a_string',
  792. 'ShowProgress': 'true',
  793. 'SuppressStartupBanner': 'true',
  794. 'UndefinePreprocessorDefinitions': 'd1;d2;d3'},
  795. 'VCMIDLTool': {
  796. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  797. 'AdditionalOptions': 'a_string',
  798. 'CPreprocessOptions': 'a_string',
  799. 'DefaultCharType': '0',
  800. 'DLLDataFileName': 'a_file_name',
  801. 'EnableErrorChecks': '2',
  802. 'ErrorCheckAllocations': 'true',
  803. 'ErrorCheckBounds': 'true',
  804. 'ErrorCheckEnumRange': 'true',
  805. 'ErrorCheckRefPointers': 'true',
  806. 'ErrorCheckStubData': 'true',
  807. 'GenerateStublessProxies': 'true',
  808. 'GenerateTypeLibrary': 'true',
  809. 'HeaderFileName': 'a_file_name',
  810. 'IgnoreStandardIncludePath': 'true',
  811. 'InterfaceIdentifierFileName': 'a_file_name',
  812. 'MkTypLibCompatible': 'true',
  813. 'OutputDirectory': 'a_string',
  814. 'PreprocessorDefinitions': 'd1;d2;d3',
  815. 'ProxyFileName': 'a_file_name',
  816. 'RedirectOutputAndErrors': 'a_file_name',
  817. 'StructMemberAlignment': '3',
  818. 'SuppressStartupBanner': 'true',
  819. 'TargetEnvironment': '1',
  820. 'TypeLibraryName': 'a_file_name',
  821. 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
  822. 'ValidateParameters': 'true',
  823. 'WarnAsError': 'true',
  824. 'WarningLevel': '4'},
  825. 'VCLibrarianTool': {
  826. 'AdditionalDependencies': 'file1;file2;file3',
  827. 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
  828. 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3',
  829. 'AdditionalOptions': 'a_string',
  830. 'ExportNamedFunctions': 'd1;d2;d3',
  831. 'ForceSymbolReferences': 'a_string',
  832. 'IgnoreAllDefaultLibraries': 'true',
  833. 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
  834. 'LinkLibraryDependencies': 'true',
  835. 'ModuleDefinitionFile': 'a_file_name',
  836. 'OutputFile': 'a_file_name',
  837. 'SuppressStartupBanner': 'true',
  838. 'UseUnicodeResponseFiles': 'true'},
  839. 'VCManifestTool': {
  840. 'AdditionalManifestFiles': 'file1;file2;file3',
  841. 'AdditionalOptions': 'a_string',
  842. 'AssemblyIdentity': 'a_string',
  843. 'ComponentFileName': 'a_file_name',
  844. 'DependencyInformationFile': 'a_file_name',
  845. 'EmbedManifest': 'true',
  846. 'GenerateCatalogFiles': 'true',
  847. 'InputResourceManifests': 'a_string',
  848. 'ManifestResourceFile': 'my_name',
  849. 'OutputManifestFile': 'a_file_name',
  850. 'RegistrarScriptFile': 'a_file_name',
  851. 'ReplacementsFile': 'a_file_name',
  852. 'SuppressStartupBanner': 'true',
  853. 'TypeLibraryFile': 'a_file_name',
  854. 'UpdateFileHashes': 'true',
  855. 'UpdateFileHashesSearchPath': 'a_file_name',
  856. 'UseFAT32Workaround': 'true',
  857. 'UseUnicodeResponseFiles': 'true',
  858. 'VerboseOutput': 'true'}}
  859. expected_msbuild_settings = {
  860. 'ClCompile': {
  861. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  862. 'AdditionalOptions': 'a_string /J',
  863. 'AdditionalUsingDirectories': 'folder1;folder2;folder3',
  864. 'AssemblerListingLocation': 'a_file_name',
  865. 'AssemblerOutput': 'NoListing',
  866. 'BasicRuntimeChecks': 'StackFrameRuntimeCheck',
  867. 'BrowseInformation': 'true',
  868. 'BrowseInformationFile': 'a_file_name',
  869. 'BufferSecurityCheck': 'true',
  870. 'CallingConvention': 'Cdecl',
  871. 'CompileAs': 'CompileAsC',
  872. 'DebugInformationFormat': 'EditAndContinue',
  873. 'DisableLanguageExtensions': 'true',
  874. 'DisableSpecificWarnings': 'd1;d2;d3',
  875. 'EnableEnhancedInstructionSet': 'NotSet',
  876. 'EnableFiberSafeOptimizations': 'true',
  877. 'EnablePREfast': 'true',
  878. 'ErrorReporting': 'Prompt',
  879. 'ExceptionHandling': 'Async',
  880. 'ExpandAttributedSource': 'true',
  881. 'FavorSizeOrSpeed': 'Neither',
  882. 'FloatingPointExceptions': 'true',
  883. 'FloatingPointModel': 'Strict',
  884. 'ForceConformanceInForLoopScope': 'true',
  885. 'ForcedIncludeFiles': 'file1;file2;file3',
  886. 'ForcedUsingFiles': 'file1;file2;file3',
  887. 'FunctionLevelLinking': 'true',
  888. 'GenerateXMLDocumentationFiles': 'true',
  889. 'IgnoreStandardIncludePath': 'true',
  890. 'InlineFunctionExpansion': 'AnySuitable',
  891. 'IntrinsicFunctions': 'true',
  892. 'MinimalRebuild': 'true',
  893. 'ObjectFileName': 'a_file_name',
  894. 'OmitDefaultLibName': 'true',
  895. 'OmitFramePointers': 'true',
  896. 'OpenMPSupport': 'true',
  897. 'Optimization': 'Full',
  898. 'PrecompiledHeader': 'Create',
  899. 'PrecompiledHeaderFile': 'a_file_name',
  900. 'PrecompiledHeaderOutputFile': 'a_file_name',
  901. 'PreprocessKeepComments': 'true',
  902. 'PreprocessorDefinitions': 'd1;d2;d3',
  903. 'PreprocessSuppressLineNumbers': 'false',
  904. 'PreprocessToFile': 'true',
  905. 'ProgramDataBaseFileName': 'a_file_name',
  906. 'RuntimeLibrary': 'MultiThreaded',
  907. 'RuntimeTypeInfo': 'true',
  908. 'ShowIncludes': 'true',
  909. 'SmallerTypeCheck': 'true',
  910. 'StringPooling': 'true',
  911. 'StructMemberAlignment': '1Byte',
  912. 'SuppressStartupBanner': 'true',
  913. 'TreatWarningAsError': 'true',
  914. 'TreatWChar_tAsBuiltInType': 'true',
  915. 'UndefineAllPreprocessorDefinitions': 'true',
  916. 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
  917. 'UseFullPaths': 'true',
  918. 'WarningLevel': 'Level2',
  919. 'WholeProgramOptimization': 'true',
  920. 'XMLDocumentationFileName': 'a_file_name'},
  921. 'Link': {
  922. 'AdditionalDependencies': 'file1;file2;file3',
  923. 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
  924. 'AdditionalManifestDependencies': 'file1;file2;file3',
  925. 'AdditionalOptions': 'a_string',
  926. 'AddModuleNamesToAssembly': 'file1;file2;file3',
  927. 'AllowIsolation': 'true',
  928. 'AssemblyDebug': '',
  929. 'AssemblyLinkResource': 'file1;file2;file3',
  930. 'BaseAddress': 'a_string',
  931. 'CLRImageType': 'ForceIJWImage',
  932. 'CLRThreadAttribute': 'STAThreadingAttribute',
  933. 'CLRUnmanagedCodeCheck': 'true',
  934. 'DataExecutionPrevention': '',
  935. 'DelayLoadDLLs': 'file1;file2;file3',
  936. 'DelaySign': 'true',
  937. 'Driver': 'Driver',
  938. 'EmbedManagedResourceFile': 'file1;file2;file3',
  939. 'EnableCOMDATFolding': '',
  940. 'EnableUAC': 'true',
  941. 'EntryPointSymbol': 'a_string',
  942. 'FixedBaseAddress': 'false',
  943. 'ForceSymbolReferences': 'file1;file2;file3',
  944. 'FunctionOrder': 'a_file_name',
  945. 'GenerateDebugInformation': 'true',
  946. 'GenerateMapFile': 'true',
  947. 'HeapCommitSize': 'a_string',
  948. 'HeapReserveSize': 'a_string',
  949. 'IgnoreAllDefaultLibraries': 'true',
  950. 'IgnoreEmbeddedIDL': 'true',
  951. 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
  952. 'ImportLibrary': 'a_file_name',
  953. 'KeyContainer': 'a_file_name',
  954. 'KeyFile': 'a_file_name',
  955. 'LargeAddressAware': 'true',
  956. 'LinkErrorReporting': 'NoErrorReport',
  957. 'LinkTimeCodeGeneration': 'PGInstrument',
  958. 'ManifestFile': 'a_file_name',
  959. 'MapExports': 'true',
  960. 'MapFileName': 'a_file_name',
  961. 'MergedIDLBaseFileName': 'a_file_name',
  962. 'MergeSections': 'a_string',
  963. 'MidlCommandFile': 'a_file_name',
  964. 'ModuleDefinitionFile': 'a_file_name',
  965. 'NoEntryPoint': 'true',
  966. 'OptimizeReferences': '',
  967. 'OutputFile': 'a_file_name',
  968. 'PerUserRedirection': 'true',
  969. 'Profile': 'true',
  970. 'ProfileGuidedDatabase': 'a_file_name',
  971. 'ProgramDatabaseFile': 'a_file_name',
  972. 'RandomizedBaseAddress': 'false',
  973. 'RegisterOutput': 'true',
  974. 'SetChecksum': 'true',
  975. 'ShowProgress': 'NotSet',
  976. 'StackCommitSize': 'a_string',
  977. 'StackReserveSize': 'a_string',
  978. 'StripPrivateSymbols': 'a_file_name',
  979. 'SubSystem': 'Windows',
  980. 'SupportUnloadOfDelayLoadedDLL': 'true',
  981. 'SuppressStartupBanner': 'true',
  982. 'SwapRunFromCD': 'true',
  983. 'SwapRunFromNET': 'true',
  984. 'TargetMachine': 'MachineARM',
  985. 'TerminalServerAware': 'true',
  986. 'TurnOffAssemblyGeneration': 'true',
  987. 'TypeLibraryFile': 'a_file_name',
  988. 'TypeLibraryResourceID': '33',
  989. 'UACExecutionLevel': 'HighestAvailable',
  990. 'UACUIAccess': 'true',
  991. 'Version': 'a_string'},
  992. 'ResourceCompile': {
  993. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  994. 'AdditionalOptions': 'a_string',
  995. 'Culture': '0x03eb',
  996. 'IgnoreStandardIncludePath': 'true',
  997. 'PreprocessorDefinitions': 'd1;d2;d3',
  998. 'ResourceOutputFileName': 'a_string',
  999. 'ShowProgress': 'true',
  1000. 'SuppressStartupBanner': 'true',
  1001. 'UndefinePreprocessorDefinitions': 'd1;d2;d3'},
  1002. 'Midl': {
  1003. 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
  1004. 'AdditionalOptions': 'a_string',
  1005. 'CPreprocessOptions': 'a_string',
  1006. 'DefaultCharType': 'Unsigned',
  1007. 'DllDataFileName': 'a_file_name',
  1008. 'EnableErrorChecks': 'All',
  1009. 'ErrorCheckAllocations': 'true',
  1010. 'ErrorCheckBounds': 'true',
  1011. 'ErrorCheckEnumRange': 'true',
  1012. 'ErrorCheckRefPointers': 'true',
  1013. 'ErrorCheckStubData': 'true',
  1014. 'GenerateStublessProxies': 'true',
  1015. 'GenerateTypeLibrary': 'true',
  1016. 'HeaderFileName': 'a_file_name',
  1017. 'IgnoreStandardIncludePath': 'true',
  1018. 'InterfaceIdentifierFileName': 'a_file_name',
  1019. 'MkTypLibCompatible': 'true',
  1020. 'OutputDirectory': 'a_string',
  1021. 'PreprocessorDefinitions': 'd1;d2;d3',
  1022. 'ProxyFileName': 'a_file_name',
  1023. 'RedirectOutputAndErrors': 'a_file_name',
  1024. 'StructMemberAlignment': '4',
  1025. 'SuppressStartupBanner': 'true',
  1026. 'TargetEnvironment': 'Win32',
  1027. 'TypeLibraryName': 'a_file_name',
  1028. 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
  1029. 'ValidateAllParameters': 'true',
  1030. 'WarnAsError': 'true',
  1031. 'WarningLevel': '4'},
  1032. 'Lib': {
  1033. 'AdditionalDependencies': 'file1;file2;file3',
  1034. 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
  1035. 'AdditionalOptions': 'a_string',
  1036. 'ExportNamedFunctions': 'd1;d2;d3',
  1037. 'ForceSymbolReferences': 'a_string',
  1038. 'IgnoreAllDefaultLibraries': 'true',
  1039. 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
  1040. 'ModuleDefinitionFile': 'a_file_name',
  1041. 'OutputFile': 'a_file_name',
  1042. 'SuppressStartupBanner': 'true',
  1043. 'UseUnicodeResponseFiles': 'true'},
  1044. 'Manifest': {
  1045. 'AdditionalManifestFiles': 'file1;file2;file3',
  1046. 'AdditionalOptions': 'a_string',
  1047. 'AssemblyIdentity': 'a_string',
  1048. 'ComponentFileName': 'a_file_name',
  1049. 'GenerateCatalogFiles': 'true',
  1050. 'InputResourceManifests': 'a_string',
  1051. 'OutputManifestFile': 'a_file_name',
  1052. 'RegistrarScriptFile': 'a_file_name',
  1053. 'ReplacementsFile': 'a_file_name',
  1054. 'SuppressStartupBanner': 'true',
  1055. 'TypeLibraryFile': 'a_file_name',
  1056. 'UpdateFileHashes': 'true',
  1057. 'UpdateFileHashesSearchPath': 'a_file_name',
  1058. 'VerboseOutput': 'true'},
  1059. 'ManifestResourceCompile': {
  1060. 'ResourceOutputFileName': 'my_name'},
  1061. 'ProjectReference': {
  1062. 'LinkLibraryDependencies': 'true',
  1063. 'UseLibraryDependencyInputs': 'false'},
  1064. '': {
  1065. 'EmbedManifest': 'true',
  1066. 'GenerateManifest': 'true',
  1067. 'IgnoreImportLibrary': 'true',
  1068. 'LinkIncremental': 'false'}}
  1069. actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
  1070. msvs_settings,
  1071. self.stderr)
  1072. self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
  1073. self._ExpectedWarnings([])
  1074. def testConvertToMSBuildSettings_actual(self):
  1075. """Tests the conversion of an actual project.
  1076. A VS2008 project with most of the options defined was created through the
  1077. VS2008 IDE. It was then converted to VS2010. The tool settings found in
  1078. the .vcproj and .vcxproj files were converted to the two dictionaries
  1079. msvs_settings and expected_msbuild_settings.
  1080. Note that for many settings, the VS2010 converter adds macros like
  1081. %(AdditionalIncludeDirectories) to make sure than inherited values are
  1082. included. Since the Gyp projects we generate do not use inheritance,
  1083. we removed these macros. They were:
  1084. ClCompile:
  1085. AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)'
  1086. AdditionalOptions: ' %(AdditionalOptions)'
  1087. AdditionalUsingDirectories: ';%(AdditionalUsingDirectories)'
  1088. DisableSpecificWarnings: ';%(DisableSpecificWarnings)',
  1089. ForcedIncludeFiles: ';%(ForcedIncludeFiles)',
  1090. ForcedUsingFiles: ';%(ForcedUsingFiles)',
  1091. PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
  1092. UndefinePreprocessorDefinitions:
  1093. ';%(UndefinePreprocessorDefinitions)',
  1094. Link:
  1095. AdditionalDependencies: ';%(AdditionalDependencies)',
  1096. AdditionalLibraryDirectories: ';%(AdditionalLibraryDirectories)',
  1097. AdditionalManifestDependencies:
  1098. ';%(AdditionalManifestDependencies)',
  1099. AdditionalOptions: ' %(Additi