diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-11 14:22:43 (GMT) |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-11 14:22:43 (GMT) |
commit | 76839d932e31aeb092f31fd1d81922aba193b446 (patch) | |
tree | 251437187776e7a3bf9a495934ad6b3f348b9178 /test | |
parent | 357ce53b076feba224507053641d3de175a82429 (diff) | |
download | SCons-76839d932e31aeb092f31fd1d81922aba193b446.zip SCons-76839d932e31aeb092f31fd1d81922aba193b446.tar.gz SCons-76839d932e31aeb092f31fd1d81922aba193b446.tar.bz2 |
Update Tool/msvs.py, update MSVS tests; and add additional tests for MSVS multi-project and solution builds.
Tool/msvs.py:
* Add "projectguid" argument to MSVSProject to enable user-defined GUID assignment per-project for multiple project solutions.
* Project GUID priority: (1) MSVSProject "projectguid" argument, (2) SCons env MSVS_PROJECT_GUID value, (3) internally generated GUID. SCons env MSVS_PROJECT_GUID value should not be used for multiple project solutions without using projectguid arguments (otherwise, multiple projects will use the same GUID).
* Store the project GUID as a node Tag when generating the MSVSProject and retrieve the project GUIDs using GetTag when generating the solution.
* Move project node processing to a function so it can be called from multiple code locations.
* Filter out solution nodes from project list (bugfix: auto_build_solution enabled and returned value used as project list includes auto-generated solution as a Project in the solution file).
* Check for variant directory build of MSVSSolution and adjust src node accordingly similar to MSVSProject code. Bug fix: the solution file is generated in the build directory instead of the source directory. The placeholder solution file is now generated in the build directory and the solution file is generated in the source folder similar to the handling of project files.
* Add project dsp nodes to the dsw source node list. This appears to always cause the project files to be generated before the solution files which is necessary to retrieve the project GUIDs for use in the solution file. This does change the behavior of clean for a project generated with auto_build_solution disabled and explicit solution generation: when the solution file is cleaned, the project files are also cleaned. The tests for vs 6.0-7.1 were changed accordingly.
testing/framework/TestSConsMSVS.py:
* Add known project GUID for single project tests and two known project GUIDs for dual project tests.
* Add projectguid to MSVSProject arguments for single project test SConstruct/SConscript files.
* Add PROJECT_BASENAME replaceable field to expected generated project file templates.
* Add dual project and single solution templates.
Tests:
* Use known project guid for most tests which prevents have to hard-code generated GUIDs.
* Add 4 (2x2) tests using two projects for combinations of auto_build_solutions settings (2) and variant directories (2).
* Add 2 tests using two projects which use default GUID generation with and without variant directories.
Diffstat (limited to 'test')
-rw-r--r-- | test/MSVS/common-prefix.py | 7 | ||||
-rw-r--r-- | test/MSVS/runfile.py | 7 | ||||
-rw-r--r-- | test/MSVS/vs-6.0-clean.py | 14 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-clean.py | 13 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-files.py | 2 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-scc-files.py | 4 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-scc-legacy-files.py | 4 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-variant_dir.py | 2 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-clean.py | 16 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-files.py | 2 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-scc-files.py | 4 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-scc-legacy-files.py | 4 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-variant_dir.py | 2 | ||||
-rw-r--r-- | test/MSVS/vs-mult-auto-guid.py | 149 | ||||
-rw-r--r-- | test/MSVS/vs-mult-auto-vardir-guid.py | 185 | ||||
-rw-r--r-- | test/MSVS/vs-mult-auto-vardir.py | 177 | ||||
-rw-r--r-- | test/MSVS/vs-mult-auto.py | 141 | ||||
-rw-r--r-- | test/MSVS/vs-mult-noauto-vardir.py | 141 | ||||
-rw-r--r-- | test/MSVS/vs-mult-noauto.py | 117 | ||||
-rw-r--r-- | test/MSVS/vs-scc-files.py | 4 | ||||
-rw-r--r-- | test/MSVS/vs-scc-legacy-files.py | 4 |
21 files changed, 952 insertions, 47 deletions
diff --git a/test/MSVS/common-prefix.py b/test/MSVS/common-prefix.py index 90417a2..f511edc 100644 --- a/test/MSVS/common-prefix.py +++ b/test/MSVS/common-prefix.py @@ -38,7 +38,7 @@ if sys.platform != 'win32': msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) -msvs_project_guid = TestSConsMSVS.MSVS_PROJECT_GUID +project_guid = TestSConsMSVS.PROJECT_GUID vcproj_template = """\ <?xml version="1.0" encoding="Windows-1252"?> @@ -86,13 +86,12 @@ vcproj_template = """\ """ SConscript_contents = """\ -env=Environment(tools=['msvs'], - MSVS_VERSION = '8.0', - MSVS_PROJECT_GUID = '%(msvs_project_guid)s') +env=Environment(tools=['msvs'], MSVS_VERSION = '8.0') testsrc = %(testsrc)s env.MSVSProject(target = 'Test.vcproj', + projectguid = '%(project_guid)s', slnguid = '{SLNGUID}', srcs = testsrc, buildtarget = 'Test.exe', diff --git a/test/MSVS/runfile.py b/test/MSVS/runfile.py index bdd541d..78e2c0d 100644 --- a/test/MSVS/runfile.py +++ b/test/MSVS/runfile.py @@ -38,7 +38,7 @@ if sys.platform != 'win32': msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) -sconscript_dict = {'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +sconscript_dict = {'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} expected_vcprojfile = """\ <?xml version="1.0" encoding="Windows-1252"?> @@ -93,11 +93,10 @@ expected_vcprojfile = """\ """ SConscript_contents = """\ -env=Environment(tools=['msvs'], - MSVS_VERSION = '8.0', - MSVS_PROJECT_GUID = '%(MSVS_PROJECT_GUID)s') +env=Environment(tools=['msvs'], MSVS_VERSION = '8.0') env.MSVSProject(target = 'Test.vcproj', + projectguid = '%(PROJECT_GUID)s', slnguid = '{SLNGUID}', srcs = ['test.cpp'], buildtarget = 'Test.exe', diff --git a/test/MSVS/vs-6.0-clean.py b/test/MSVS/vs-6.0-clean.py index 0cbadba..7045daa 100644 --- a/test/MSVS/vs-6.0-clean.py +++ b/test/MSVS/vs-6.0-clean.py @@ -34,18 +34,12 @@ import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() host_arch = test.get_vs_host_arch() - - # Make the test infrastructure think we have this version of MSVS installed. test._msvs_versions = ['6.0'] - - expected_dspfile = TestSConsMSVS.expected_dspfile_6_0 expected_dswfile = TestSConsMSVS.expected_dswfile_6_0 - - test.write('SConstruct', """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='6.0',HOST_ARCH='%(HOST_ARCH)s') @@ -95,16 +89,14 @@ test.run(arguments='.') test.must_exist(test.workpath('Test.dsp')) test.must_exist(test.workpath('Test.dsw')) -test.run(arguments='-c Test.dsw') - -test.must_exist(test.workpath('Test.dsp')) -test.must_not_exist(test.workpath('Test.dsw')) - test.run(arguments='-c Test.dsp') test.must_not_exist(test.workpath('Test.dsp')) +test.must_exist(test.workpath('Test.dsw')) +test.run(arguments='-c Test.dsw') +test.must_not_exist(test.workpath('Test.dsw')) test.pass_test() diff --git a/test/MSVS/vs-7.0-clean.py b/test/MSVS/vs-7.0-clean.py index 04d8d15..603ae89 100644 --- a/test/MSVS/vs-7.0-clean.py +++ b/test/MSVS/vs-7.0-clean.py @@ -43,7 +43,6 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_0 test.write('SConstruct', """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.0', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', HOST_ARCH='%(HOST_ARCH)s') testsrc = ['test1.cpp', 'test2.cpp'] @@ -53,6 +52,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] p = env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', srcs = testsrc, incs = testincs, localincs = testlocalincs, @@ -66,7 +66,7 @@ env.MSVSSolution(target = 'Test.sln', slnguid = '{SLNGUID}', projects = [p], variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID}) +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID}) test.run(arguments=".") @@ -92,15 +92,14 @@ test.run(arguments='.') test.must_exist(test.workpath('Test.vcproj')) test.must_exist(test.workpath('Test.sln')) +test.run(arguments='-c Test.vcproj') +test.must_not_exist(test.workpath('Test.vcproj')) +test.must_exist(test.workpath('Test.sln')) + test.run(arguments='-c Test.sln') -test.must_exist(test.workpath('Test.vcproj')) test.must_not_exist(test.workpath('Test.sln')) -test.run(arguments='-c Test.vcproj') - -test.must_not_exist(test.workpath('Test.vcproj')) - test.pass_test() # Local Variables: diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py index 163f0a5..202036c 100644 --- a/test/MSVS/vs-7.0-files.py +++ b/test/MSVS/vs-7.0-files.py @@ -35,7 +35,7 @@ import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() host_arch = test.get_vs_host_arch() -sconscript_dict = {'HOST_ARCH': host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +sconscript_dict = {'HOST_ARCH': host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} # Make the test infrastructure think we have this version of MSVS installed. test._msvs_versions = ['7.0'] diff --git a/test/MSVS/vs-7.0-scc-files.py b/test/MSVS/vs-7.0-scc-files.py index b87bb9a..a517610 100644 --- a/test/MSVS/vs-7.0-scc-files.py +++ b/test/MSVS/vs-7.0-scc-files.py @@ -42,7 +42,6 @@ expected_slnfile = TestSConsMSVS.expected_slnfile_7_0 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_0 SConscript_contents = \ r"""env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.0', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_CONNECTION_ROOT='.', @@ -58,6 +57,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', slnguid = '{SLNGUID}', srcs = testsrc, incs = testincs, @@ -66,7 +66,7 @@ env.MSVSProject(target = 'Test.vcproj', misc = testmisc, buildtarget = 'Test.exe', variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} expected_sln_sccinfo = """\ \tGlobalSection(SourceCodeControl) = preSolution diff --git a/test/MSVS/vs-7.0-scc-legacy-files.py b/test/MSVS/vs-7.0-scc-legacy-files.py index 5b900f8..30f2a7c 100644 --- a/test/MSVS/vs-7.0-scc-legacy-files.py +++ b/test/MSVS/vs-7.0-scc-legacy-files.py @@ -42,7 +42,6 @@ expected_slnfile = TestSConsMSVS.expected_slnfile_7_0 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_0 SConscript_contents = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.0', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_LOCAL_PATH=r'C:\\MyMsVsProjects', @@ -56,6 +55,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', slnguid = '{SLNGUID}', srcs = testsrc, incs = testincs, @@ -64,7 +64,7 @@ env.MSVSProject(target = 'Test.vcproj', misc = testmisc, buildtarget = 'Test.exe', variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} expected_vcproj_sccinfo = """\ \tSccProjectName="Perforce Project" diff --git a/test/MSVS/vs-7.0-variant_dir.py b/test/MSVS/vs-7.0-variant_dir.py index 5ec3b55..f83d0ab 100644 --- a/test/MSVS/vs-7.0-variant_dir.py +++ b/test/MSVS/vs-7.0-variant_dir.py @@ -33,7 +33,7 @@ import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() host_arch = test.get_vs_host_arch() -sconscript_dict = {'HOST_ARCH': host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +sconscript_dict = {'HOST_ARCH': host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} # Make the test infrastructure think we have this version of MSVS installed. test._msvs_versions = ['7.0'] diff --git a/test/MSVS/vs-7.1-clean.py b/test/MSVS/vs-7.1-clean.py index 665871c..4561557 100644 --- a/test/MSVS/vs-7.1-clean.py +++ b/test/MSVS/vs-7.1-clean.py @@ -43,7 +43,6 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_1 test.write('SConstruct', """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.1', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', HOST_ARCH='%(HOST_ARCH)s') testsrc = ['test1.cpp', 'test2.cpp'] @@ -53,6 +52,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] p = env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', srcs = testsrc, incs = testincs, localincs = testlocalincs, @@ -66,7 +66,7 @@ env.MSVSSolution(target = 'Test.sln', slnguid = '{SLNGUID}', projects = [p], variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID}) +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID}) test.run(arguments=".") @@ -92,14 +92,20 @@ test.run(arguments='.') test.must_exist(test.workpath('Test.vcproj')) test.must_exist(test.workpath('Test.sln')) -test.run(arguments='-c Test.sln') +test.run(arguments='-c Test.vcproj') + +test.must_not_exist(test.workpath('Test.vcproj')) +test.must_exist(test.workpath('Test.sln')) + +test.run(arguments='.') test.must_exist(test.workpath('Test.vcproj')) -test.must_not_exist(test.workpath('Test.sln')) +test.must_exist(test.workpath('Test.sln')) -test.run(arguments='-c Test.vcproj') +test.run(arguments='-c Test.sln') test.must_not_exist(test.workpath('Test.vcproj')) +test.must_not_exist(test.workpath('Test.sln')) test.pass_test() diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py index e372fe0..9fcea6d 100644 --- a/test/MSVS/vs-7.1-files.py +++ b/test/MSVS/vs-7.1-files.py @@ -35,7 +35,7 @@ import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() host_arch = test.get_vs_host_arch() -sconscript_dict = {'HOST_ARCH': host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +sconscript_dict = {'HOST_ARCH': host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} # Make the test infrastructure think we have this version of MSVS installed. test._msvs_versions = ['7.1'] diff --git a/test/MSVS/vs-7.1-scc-files.py b/test/MSVS/vs-7.1-scc-files.py index 3af668f..7ffbd8c 100644 --- a/test/MSVS/vs-7.1-scc-files.py +++ b/test/MSVS/vs-7.1-scc-files.py @@ -42,7 +42,6 @@ expected_slnfile = TestSConsMSVS.expected_slnfile_7_1 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_1 SConscript_contents = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.1', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_CONNECTION_ROOT='.', @@ -58,6 +57,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', slnguid = '{SLNGUID}', srcs = testsrc, incs = testincs, @@ -66,7 +66,7 @@ env.MSVSProject(target = 'Test.vcproj', misc = testmisc, buildtarget = 'Test.exe', variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} expected_sln_sccinfo = """\ \tGlobalSection(SourceCodeControl) = preSolution diff --git a/test/MSVS/vs-7.1-scc-legacy-files.py b/test/MSVS/vs-7.1-scc-legacy-files.py index 9e0d0ea..2178eda 100644 --- a/test/MSVS/vs-7.1-scc-legacy-files.py +++ b/test/MSVS/vs-7.1-scc-legacy-files.py @@ -42,7 +42,6 @@ expected_slnfile = TestSConsMSVS.expected_slnfile_7_1 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_1 SConscript_contents = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.1', - MSVS_PROJECT_GUID='%(MSVS_PROJECT_GUID)s', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_LOCAL_PATH=r'C:\\MyMsVsProjects', @@ -56,6 +55,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = 'Test.vcproj', + projectguid='%(PROJECT_GUID)s', slnguid = '{SLNGUID}', srcs = testsrc, incs = testincs, @@ -64,7 +64,7 @@ env.MSVSProject(target = 'Test.vcproj', misc = testmisc, buildtarget = 'Test.exe', variant = 'Release') -""" % {'HOST_ARCH':host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +""" % {'HOST_ARCH':host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} expected_vcproj_sccinfo = """\ \tSccProjectName="Perforce Project" diff --git a/test/MSVS/vs-7.1-variant_dir.py b/test/MSVS/vs-7.1-variant_dir.py index b4de417..df337ae 100644 --- a/test/MSVS/vs-7.1-variant_dir.py +++ b/test/MSVS/vs-7.1-variant_dir.py @@ -33,7 +33,7 @@ import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() host_arch = test.get_vs_host_arch() -sconscript_dict = {'HOST_ARCH': host_arch, 'MSVS_PROJECT_GUID': TestSConsMSVS.MSVS_PROJECT_GUID} +sconscript_dict = {'HOST_ARCH': host_arch, 'PROJECT_GUID': TestSConsMSVS.PROJECT_GUID} # Make the test infrastructure think we have this version of MSVS installed. test._msvs_versions = ['7.1'] diff --git a/test/MSVS/vs-mult-auto-guid.py b/test/MSVS/vs-mult-auto-guid.py new file mode 100644 index 0000000..a69629b --- /dev/null +++ b/test/MSVS/vs-mult-auto-guid.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and three solution (.sln) file. +""" + +import TestSConsMSVS + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + solution_file_1 = 'Test_1.sln' + solution_file_2 = 'Test_2.sln' + + if major >= 10: + project_guid_1 = "{F7D7CE55-37BF-51DE-8942-9377B2BE8387}" + project_guid_2 = "{8D17BC73-09FD-5B69-BBBF-1E40E0C63456}" + else: + project_guid_1 = "{53EE9FA7-6300-55B8-8A0E-A3DC40983390}" + project_guid_2 = "{57358E9B-126D-53F6-AD5A-559AB4A8EE62}" + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + expected_slnfile_1 = test.get_expected_sln_file_contents( + vc_version, + project_file_1, + ) + + expected_slnfile_2 = test.get_expected_sln_file_contents( + vc_version, + project_file_2, + ) + + SConstruct_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=1, + default_guids=True, + ) + + test.write('SConstruct', SConstruct_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath(project_file_1)) + vcproj = test.read(project_file_1, 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(project_file_2)) + vcproj = test.read(project_file_2, 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(solution_file)) + sln = test.read(solution_file, 'r') + expect = test.msvs_substitute_projects( + expected_slnfile, subdir='src', + project_guid_1=project_guid_1, project_guid_2=project_guid_2 + ) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath(solution_file_1)) + sln = test.read(solution_file_1, 'r') + expect = test.msvs_substitute(expected_slnfile_1, vc_version, subdir='src', project_guid=project_guid_1) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath(solution_file_2)) + sln = test.read(solution_file_2, 'r') + expect = test.msvs_substitute(expected_slnfile_2, vc_version, subdir='src', project_guid=project_guid_2) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath(filters_file_1)) + test.must_exist(test.workpath(filters_file_2)) + else: + test.must_not_exist(test.workpath(filters_file_1)) + test.must_not_exist(test.workpath(filters_file_2)) + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-mult-auto-vardir-guid.py b/test/MSVS/vs-mult-auto-vardir-guid.py new file mode 100644 index 0000000..f4d4979 --- /dev/null +++ b/test/MSVS/vs-mult-auto-vardir-guid.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and three solution (.sln) file. +""" + +import TestSConsMSVS + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + solution_file_1 = 'Test_1.sln' + solution_file_2 = 'Test_2.sln' + + if major >= 10: + project_guid_1 = "{5A243E49-07F0-54C3-B3FD-1DBDF1BA5C9E}" + project_guid_2 = "{E20E17C7-251E-5246-8FD1-5D51978A0A5D}" + else: + project_guid_1 = "{AB46DD68-8CD8-5832-B784-65B216B94739}" + project_guid_2 = "{03EB0BC3-DA68-5825-9EBB-D8713304E739}" + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + expected_slnfile_1 = test.get_expected_sln_file_contents( + vc_version, + project_file_1, + ) + + expected_slnfile_2 = test.get_expected_sln_file_contents( + vc_version, + project_file_2, + ) + + SConscript_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=1, + default_guids=True, + ) + + test.subdir('src') + + test.write('SConstruct', """\ +SConscript('src/SConscript', variant_dir='build') +""") + + test.write(['src', 'SConscript'], SConscript_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath('src', project_file_1)) + vcproj = test.read(['src', project_file_1], 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', project_file_2)) + vcproj = test.read(['src', project_file_2], 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', solution_file)) + sln = test.read(['src', solution_file], 'r') + expect = test.msvs_substitute_projects( + expected_slnfile, subdir='src', + project_guid_1=project_guid_1, project_guid_2=project_guid_2 + ) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath('src', solution_file_1)) + sln = test.read(['src', solution_file_1], 'r') + expect = test.msvs_substitute(expected_slnfile_1, vc_version, subdir='src', project_guid=project_guid_1) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath('src', solution_file_2)) + sln = test.read(['src', solution_file_2], 'r') + expect = test.msvs_substitute(expected_slnfile_2, vc_version, subdir='src', project_guid=project_guid_2) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath('src', filters_file_1)) + test.must_exist(test.workpath('src', filters_file_2)) + else: + test.must_not_exist(test.workpath('src', filters_file_1)) + test.must_not_exist(test.workpath('src', filters_file_2)) + + test.must_match(['build', project_file_1], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_1), mode='r') + + test.must_match(['build', project_file_2], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_2), mode='r') + + test.must_match(['build', solution_file], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file), mode='r') + + test.must_match(['build', solution_file_1], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file_1), mode='r') + + test.must_match(['build', solution_file_2], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file_2), mode='r') + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-mult-auto-vardir.py b/test/MSVS/vs-mult-auto-vardir.py new file mode 100644 index 0000000..06aebdd --- /dev/null +++ b/test/MSVS/vs-mult-auto-vardir.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and three solution (.sln) file. +""" + +import TestSConsMSVS + +project_guid_1 = TestSConsMSVS.PROJECT_GUID_1 +project_guid_2 = TestSConsMSVS.PROJECT_GUID_2 + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + solution_file_1 = 'Test_1.sln' + solution_file_2 = 'Test_2.sln' + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + expected_slnfile_1 = test.get_expected_sln_file_contents( + vc_version, + project_file_1, + ) + + expected_slnfile_2 = test.get_expected_sln_file_contents( + vc_version, + project_file_2, + ) + + SConscript_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=1, + ) + + test.subdir('src') + + test.write('SConstruct', """\ +SConscript('src/SConscript', variant_dir='build') +""") + + test.write(['src', 'SConscript'], SConscript_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath('src', project_file_1)) + vcproj = test.read(['src', project_file_1], 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', project_file_2)) + vcproj = test.read(['src', project_file_2], 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', solution_file)) + sln = test.read(['src', solution_file], 'r') + expect = test.msvs_substitute_projects(expected_slnfile, subdir='src') + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath('src', solution_file_1)) + sln = test.read(['src', solution_file_1], 'r') + expect = test.msvs_substitute(expected_slnfile_1, vc_version, subdir='src', project_guid=project_guid_1) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath('src', solution_file_2)) + sln = test.read(['src', solution_file_2], 'r') + expect = test.msvs_substitute(expected_slnfile_2, vc_version, subdir='src', project_guid=project_guid_2) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath('src', filters_file_1)) + test.must_exist(test.workpath('src', filters_file_2)) + else: + test.must_not_exist(test.workpath('src', filters_file_1)) + test.must_not_exist(test.workpath('src', filters_file_2)) + + test.must_match(['build', project_file_1], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_1), mode='r') + + test.must_match(['build', project_file_2], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_2), mode='r') + + test.must_match(['build', solution_file], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file), mode='r') + + test.must_match(['build', solution_file_1], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file_1), mode='r') + + test.must_match(['build', solution_file_2], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file_2), mode='r') + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-mult-auto.py b/test/MSVS/vs-mult-auto.py new file mode 100644 index 0000000..bb6a4c4 --- /dev/null +++ b/test/MSVS/vs-mult-auto.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and three solution (.sln) file. +""" + +import TestSConsMSVS + +project_guid_1 = TestSConsMSVS.PROJECT_GUID_1 +project_guid_2 = TestSConsMSVS.PROJECT_GUID_2 + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + solution_file_1 = 'Test_1.sln' + solution_file_2 = 'Test_2.sln' + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + expected_slnfile_1 = test.get_expected_sln_file_contents( + vc_version, + project_file_1, + ) + + expected_slnfile_2 = test.get_expected_sln_file_contents( + vc_version, + project_file_2, + ) + + SConstruct_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=1, + ) + + test.write('SConstruct', SConstruct_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath(project_file_1)) + vcproj = test.read(project_file_1, 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(project_file_2)) + vcproj = test.read(project_file_2, 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(solution_file)) + sln = test.read(solution_file, 'r') + expect = test.msvs_substitute_projects(expected_slnfile, subdir='src') + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath(solution_file_1)) + sln = test.read(solution_file_1, 'r') + expect = test.msvs_substitute(expected_slnfile_1, vc_version, subdir='src', project_guid=project_guid_1) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + test.must_exist(test.workpath(solution_file_2)) + sln = test.read(solution_file_2, 'r') + expect = test.msvs_substitute(expected_slnfile_2, vc_version, subdir='src', project_guid=project_guid_2) + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath(filters_file_1)) + test.must_exist(test.workpath(filters_file_2)) + else: + test.must_not_exist(test.workpath(filters_file_1)) + test.must_not_exist(test.workpath(filters_file_2)) + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-mult-noauto-vardir.py b/test/MSVS/vs-mult-noauto-vardir.py new file mode 100644 index 0000000..459d57a --- /dev/null +++ b/test/MSVS/vs-mult-noauto-vardir.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and a solution (.sln) file. +""" + +import TestSConsMSVS + +project_guid_1 = TestSConsMSVS.PROJECT_GUID_1 +project_guid_2 = TestSConsMSVS.PROJECT_GUID_2 + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + SConscript_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=0, + ) + + test.subdir('src') + + test.write('SConstruct', """\ +SConscript('src/SConscript', variant_dir='build') +""") + + test.write(['src', 'SConscript'], SConscript_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath('src', project_file_1)) + vcproj = test.read(['src', project_file_1], 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', project_file_2)) + vcproj = test.read(['src', project_file_2], 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath('src', solution_file)) + sln = test.read(['src', solution_file], 'r') + expect = test.msvs_substitute_projects(expected_slnfile, subdir='src') + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath('src', filters_file_1)) + test.must_exist(test.workpath('src', filters_file_2)) + else: + test.must_not_exist(test.workpath('src', filters_file_1)) + test.must_not_exist(test.workpath('src', filters_file_2)) + + test.must_match(['build', project_file_1], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_1), mode='r') + + test.must_match(['build', project_file_2], """\ +This is just a placeholder file. +The real project file is here: +%s +""" % test.workpath('src', project_file_2), mode='r') + + test.must_match(['build', solution_file], """\ +This is just a placeholder file. +The real workspace file is here: +%s +""" % test.workpath('src', solution_file), mode='r') + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-mult-noauto.py b/test/MSVS/vs-mult-noauto.py new file mode 100644 index 0000000..7554673 --- /dev/null +++ b/test/MSVS/vs-mult-noauto.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test two project files (.vcxproj) and a solution (.sln) file. +""" + +import TestSConsMSVS + +project_guid_1 = TestSConsMSVS.PROJECT_GUID_1 +project_guid_2 = TestSConsMSVS.PROJECT_GUID_2 + +test = None + +for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): + test = TestSConsMSVS.TestSConsMSVS() + + # Make the test infrastructure think we have this version of MSVS installed. + test._msvs_versions = [vc_version] + + dirs = ['inc1', 'inc2'] + major, minor = test.parse_vc_version(vc_version) + project_ext = '.vcproj' if major <= 9 else '.vcxproj' + + project_file_1 = 'Test_1' + project_ext + project_file_2 = 'Test_2' + project_ext + + filters_file_1 = project_file_1 + '.filters' + filters_file_2 = project_file_2 + '.filters' + filters_file_expected = major >= 10 + + solution_file = 'Test.sln' + + expected_vcprojfile_1 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_1, project_guid_1, + ) + + expected_vcprojfile_2 = test.get_expected_projects_proj_file_contents( + vc_version, dirs, project_file_2, project_guid_2, + ) + + expected_slnfile = test.get_expected_projects_sln_file_contents( + vc_version, + project_file_1, + project_file_2, + ) + + SConstruct_contents = test.get_expected_projects_sconscript_file_contents( + vc_version=vc_version, + project_file_1=project_file_1, + project_file_2=project_file_2, + solution_file=solution_file, + autobuild_solution=0, + ) + + test.write('SConstruct', SConstruct_contents) + + test.run(arguments=".") + + test.must_exist(test.workpath(project_file_1)) + vcproj = test.read(project_file_1, 'r') + expect = test.msvs_substitute(expected_vcprojfile_1, vc_version, None, 'SConstruct', project_guid=project_guid_1) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(project_file_2)) + vcproj = test.read(project_file_2, 'r') + expect = test.msvs_substitute(expected_vcprojfile_2, vc_version, None, 'SConstruct', project_guid=project_guid_2) + # don't compare the pickled data + assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + + test.must_exist(test.workpath(solution_file)) + sln = test.read(solution_file, 'r') + expect = test.msvs_substitute_projects(expected_slnfile, subdir='src') + # don't compare the pickled data + assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + if filters_file_expected: + test.must_exist(test.workpath(filters_file_1)) + test.must_exist(test.workpath(filters_file_2)) + else: + test.must_not_exist(test.workpath(filters_file_1)) + test.must_not_exist(test.workpath(filters_file_2)) + + # TODO: clean tests + +if test: + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-scc-files.py b/test/MSVS/vs-scc-files.py index 1b4ad22..d5e66d5 100644 --- a/test/MSVS/vs-scc-files.py +++ b/test/MSVS/vs-scc-files.py @@ -49,7 +49,6 @@ for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): expected_vcprojfile = test.get_expected_proj_file_contents(vc_version, dirs, project_file) SConscript_contents = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='{vc_version}', - MSVS_PROJECT_GUID='{project_guid}', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_CONNECTION_ROOT='.', @@ -64,6 +63,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = '{project_file}', + projectguid='{project_guid}', srcs = testsrc, incs = testincs, localincs = testlocalincs, @@ -73,7 +73,7 @@ env.MSVSProject(target = '{project_file}', variant = 'Release') """.format( vc_version=vc_version, project_file=project_file, - host_arch=host_arch, project_guid=TestSConsMSVS.MSVS_PROJECT_GUID, + host_arch=host_arch, project_guid=TestSConsMSVS.PROJECT_GUID, ) expected_sln_sccinfo = """\ diff --git a/test/MSVS/vs-scc-legacy-files.py b/test/MSVS/vs-scc-legacy-files.py index 49ea2ac..cb2cca2 100644 --- a/test/MSVS/vs-scc-legacy-files.py +++ b/test/MSVS/vs-scc-legacy-files.py @@ -50,7 +50,6 @@ for vc_version in TestSConsMSVS.get_tested_proj_file_vc_versions(): SConscript_contents = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='{vc_version}', - MSVS_PROJECT_GUID='{project_guid}', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], CPPPATH=['inc1', 'inc2'], MSVS_SCC_LOCAL_PATH=r'C:\\MyMsVsProjects', @@ -64,6 +63,7 @@ testresources = ['test.rc'] testmisc = ['readme.txt'] env.MSVSProject(target = '{project_file}', + projectguid='{project_guid}', srcs = testsrc, incs = testincs, localincs = testlocalincs, @@ -73,7 +73,7 @@ env.MSVSProject(target = '{project_file}', variant = 'Release') """.format( vc_version=vc_version, project_file=project_file, - host_arch=host_arch, project_guid=TestSConsMSVS.MSVS_PROJECT_GUID, + host_arch=host_arch, project_guid=TestSConsMSVS.PROJECT_GUID, ) if major < 10: |