summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-10-08 15:31:13 (GMT)
committerSteven Knight <knight@baldmt.com>2005-10-08 15:31:13 (GMT)
commite664e763f95c2e24f1f08f11e61828c68baf9854 (patch)
treebfe0b21a2202526bf29df983e32dde3f8b16173a /test
parentee11284e78bb1405e112a594ba36ef4a2c14c481 (diff)
downloadSCons-e664e763f95c2e24f1f08f11e61828c68baf9854.zip
SCons-e664e763f95c2e24f1f08f11e61828c68baf9854.tar.gz
SCons-e664e763f95c2e24f1f08f11e61828c68baf9854.tar.bz2
MSVC.py improvements: new MSVSSolution() Builder, new variables to contro generation of project and solution files. (Stanislav Baranov)
Diffstat (limited to 'test')
-rw-r--r--test/MSVS/vs-6.0-files.py123
-rw-r--r--test/MSVS/vs-7.0-files.py115
-rw-r--r--test/MSVS/vs-7.1-files.py115
3 files changed, 265 insertions, 88 deletions
diff --git a/test/MSVS/vs-6.0-files.py b/test/MSVS/vs-6.0-files.py
index 8792cb0..e3f2994 100644
--- a/test/MSVS/vs-6.0-files.py
+++ b/test/MSVS/vs-6.0-files.py
@@ -75,20 +75,20 @@ CFG=Test - Win32 Release
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "<WORKPATH>"
-# PROP BASE Intermediate_Dir "<WORKPATH>"
-# PROP BASE Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-# PROP BASE Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-# PROP BASE Target_File "<WORKPATH>\Test.exe"
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir ""
+# PROP BASE Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct Test.exe"
+# PROP BASE Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct Test.exe"
+# PROP BASE Target_File "Test.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "<WORKPATH>"
-# PROP Intermediate_Dir "<WORKPATH>"
-# PROP Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-# PROP Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-# PROP Target_File "<WORKPATH>\Test.exe"
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct Test.exe"
+# PROP Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C <WORKPATH> -f SConstruct Test.exe"
+# PROP Target_File "Test.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
@@ -102,14 +102,6 @@ CFG=Test - Win32 Release
!ENDIF
-# Begin Group " Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;l;y;def;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="test.c"
-# End Source File
-# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
@@ -142,6 +134,14 @@ SOURCE="readme.txt"
SOURCE="test.rc"
# End Source File
# End Group
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;l;y;def;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="test.c"
+# End Source File
+# End Group
# Begin Source File
SOURCE="<SCONSCRIPT>"
@@ -156,7 +156,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
-Project: "Test"="<WORKPATH>\Test.dsp" - Package Owner=<4>
+Project: "Test"="Test.dsp" - Package Owner=<4>
Package=<5>
{{{
@@ -212,15 +212,13 @@ test.run(chdir='work1', arguments="Test.dsp")
test.must_exist(test.workpath('work1', 'Test.dsp'))
dsp = test.read(['work1', 'Test.dsp'], 'r')
-expect = test.msvs_substitute(expected_dspfile, '6.0', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_dspfile, '6.0', 'work1', 'SConstruct')
# don't compare the pickled data
assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
test.must_exist(test.workpath('work1', 'Test.dsw'))
dsw = test.read(['work1', 'Test.dsw'], 'r')
-expect = test.msvs_substitute(expected_dswfile, '6.0', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_dswfile, '6.0', 'work1', 'SConstruct')
assert dsw == expect, test.diff_substr(expect, dsw)
test.run(chdir='work1', arguments='-c .')
@@ -250,6 +248,17 @@ test.write(['work2', 'src', 'SConscript'], SConscript_contents)
test.run(chdir='work2', arguments=".")
+dsp = test.read(['work2', 'src', 'Test.dsp'], 'r')
+expect = test.msvs_substitute(expected_dspfile, '6.0', 'work2', 'SConstruct')
+# don't compare the pickled data
+assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
+
+test.must_exist(test.workpath('work2', 'src', 'Test.dsw'))
+dsw = test.read(['work2', 'src', 'Test.dsw'], 'r')
+expect = test.msvs_substitute(expected_dswfile, '6.0',
+ os.path.join('work2', 'src'))
+assert dsw == expect, test.diff_substr(expect, dsw)
+
test.must_match(['work2', 'build', 'Test.dsp'], """\
This is just a placeholder file.
The real project file is here:
@@ -257,12 +266,6 @@ The real project file is here:
""" % test.workpath('work2', 'src', 'Test.dsp'),
mode='r')
-dsp = test.read(['work2', 'src', 'Test.dsp'], 'r')
-expect = test.msvs_substitute(expected_dspfile, '6.0', 'work2',
- test.workpath('work2', 'src', 'SConscript'))
-# don't compare the pickled data
-assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
-
test.must_match(['work2', 'build', 'Test.dsw'], """\
This is just a placeholder file.
The real workspace file is here:
@@ -270,11 +273,67 @@ The real workspace file is here:
""" % test.workpath('work2', 'src', 'Test.dsw'),
mode='r')
-test.must_exist(test.workpath('work2', 'src', 'Test.dsw'))
-dsw = test.read(['work2', 'src', 'Test.dsw'], 'r')
-expect = test.msvs_substitute(expected_dswfile, '6.0', 'work2\\src')
+
+
+test.subdir('work3')
+
+test.write(['work3', 'SConstruct'], """\
+env=Environment(MSVS_VERSION = '6.0')
+
+testsrc = ['test.c']
+testincs = ['sdk.h']
+testlocalincs = ['test.h']
+testresources = ['test.rc']
+testmisc = ['readme.txt']
+
+p = env.MSVSProject(target = 'Test.dsp',
+ srcs = testsrc,
+ incs = testincs,
+ localincs = testlocalincs,
+ resources = testresources,
+ misc = testmisc,
+ buildtarget = 'Test.exe',
+ variant = 'Release',
+ auto_build_solution = 0)
+
+env.MSVSSolution(target = 'Test.dsw',
+ slnguid = '{SLNGUID}',
+ projects = [p],
+ variant = 'Release')
+""")
+
+test.run(chdir='work3', arguments=".")
+
+test.must_exist(test.workpath('work3', 'Test.dsp'))
+dsp = test.read(['work3', 'Test.dsp'], 'r')
+expect = test.msvs_substitute(expected_dspfile, '6.0', 'work3', 'SConstruct')
+# don't compare the pickled data
+assert dsp[:len(expect)] == expect, test.diff_substr(expect, dsp)
+
+test.must_exist(test.workpath('work3', 'Test.dsw'))
+dsw = test.read(['work3', 'Test.dsw'], 'r')
+expect = test.msvs_substitute(expected_dswfile, '6.0', 'work3', 'SConstruct')
assert dsw == expect, test.diff_substr(expect, dsw)
+test.run(chdir='work3', arguments='-c .')
+
+test.must_not_exist(test.workpath('work3', 'Test.dsp'))
+test.must_not_exist(test.workpath('work3', 'Test.dsw'))
+
+test.run(chdir='work3', arguments='.')
+
+test.must_exist(test.workpath('work3', 'Test.dsp'))
+test.must_exist(test.workpath('work3', 'Test.dsw'))
+
+test.run(chdir='work3', arguments='-c Test.dsw')
+
+test.must_exist(test.workpath('work3', 'Test.dsp'))
+test.must_not_exist(test.workpath('work3', 'Test.dsw'))
+
+test.run(chdir='work3', arguments='-c Test.dsp')
+
+test.must_not_exist(test.workpath('work3', 'Test.dsp'))
+
test.pass_test()
diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py
index 9144537..409501d 100644
--- a/test/MSVS/vs-7.0-files.py
+++ b/test/MSVS/vs-7.0-files.py
@@ -79,28 +79,21 @@ expected_vcprojfile = """\
\t<Configurations>
\t\t<Configuration
\t\t\tName="Release|Win32"
-\t\t\tOutputDirectory="<WORKPATH>"
-\t\t\tIntermediateDirectory="<WORKPATH>"
+\t\t\tOutputDirectory=""
+\t\t\tIntermediateDirectory=""
\t\t\tConfigurationType="0"
\t\t\tUseOfMFC="0"
\t\t\tATLMinimizesCRunTimeLibraryUsage="FALSE">
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct -c <WORKPATH>\Test.exe"
-\t\t\t\tRebuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-\t\t\t\tOutput="<WORKPATH>\Test.exe"/>
+\t\t\t\tBuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct Test.exe"
+\t\t\t\tCleanCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct -c Test.exe"
+\t\t\t\tRebuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct Test.exe"
+\t\t\t\tOutput="Test.exe"/>
\t\t</Configuration>
\t</Configurations>
\t<Files>
\t\t<Filter
-\t\t\tName=" Source Files"
-\t\t\tFilter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat">
-\t\t\t<File
-\t\t\t\tRelativePath="test.cpp">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
\t\t\tName="Header Files"
\t\t\tFilter="h;hpp;hxx;hm;inl">
\t\t\t<File
@@ -128,6 +121,13 @@ expected_vcprojfile = """\
\t\t\t\tRelativePath="test.rc">
\t\t\t</File>
\t\t</Filter>
+\t\t<Filter
+\t\t\tName="Source Files"
+\t\t\tFilter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat">
+\t\t\t<File
+\t\t\t\tRelativePath="test.cpp">
+\t\t\t</File>
+\t\t</Filter>
\t\t<File
\t\t\tRelativePath="<SCONSCRIPT>">
\t\t</File>
@@ -169,15 +169,13 @@ test.run(chdir='work1', arguments="Test.vcproj")
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1', 'SConstruct')
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
test.must_exist(test.workpath('work1', 'Test.sln'))
sln = test.read(['work1', 'Test.sln'], 'r')
-expect = test.msvs_substitute(expected_slnfile, '7.0', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_slnfile, '7.0', 'work1', 'SConstruct')
# don't compare the pickled data
assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
@@ -208,8 +206,7 @@ python = os.path.join('$(PYTHON_ROOT)', os.path.split(sys.executable)[1])
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1',
- test.workpath('work1', 'SConstruct'),
+expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1', 'SConstruct',
python=python)
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
@@ -228,6 +225,18 @@ test.write(['work2', 'src', 'SConscript'], SConscript_contents)
test.run(chdir='work2', arguments=".")
+vcproj = test.read(['work2', 'src', 'Test.vcproj'], 'r')
+expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work2', 'SConstruct')
+# don't compare the pickled data
+assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
+
+test.must_exist(test.workpath('work2', 'src', 'Test.sln'))
+sln = test.read(['work2', 'src', 'Test.sln'], 'r')
+expect = test.msvs_substitute(expected_slnfile, '7.0',
+ os.path.join('work2', 'src'))
+# don't compare the pickled data
+assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
+
test.must_match(['work2', 'build', 'Test.vcproj'], """\
This is just a placeholder file.
The real project file is here:
@@ -235,12 +244,6 @@ The real project file is here:
""" % test.workpath('work2', 'src', 'Test.vcproj'),
mode='r')
-vcproj = test.read(['work2', 'src', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work2',
- test.workpath('work2', 'src', 'SConscript'))
-# don't compare the pickled data
-assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
-
test.must_match(['work2', 'build', 'Test.sln'], """\
This is just a placeholder file.
The real workspace file is here:
@@ -248,12 +251,68 @@ The real workspace file is here:
""" % test.workpath('work2', 'src', 'Test.sln'),
mode='r')
-test.must_exist(test.workpath('work2', 'src', 'Test.sln'))
-sln = test.read(['work2', 'src', 'Test.sln'], 'r')
-expect = test.msvs_substitute(expected_slnfile, '7.0', 'work2\\src')
+
+
+test.subdir('work3')
+
+test.write(['work3', 'SConstruct'], """\
+env=Environment(MSVS_VERSION = '7.0')
+
+testsrc = ['test.cpp']
+testincs = ['sdk.h']
+testlocalincs = ['test.h']
+testresources = ['test.rc']
+testmisc = ['readme.txt']
+
+p = env.MSVSProject(target = 'Test.vcproj',
+ srcs = testsrc,
+ incs = testincs,
+ localincs = testlocalincs,
+ resources = testresources,
+ misc = testmisc,
+ buildtarget = 'Test.exe',
+ variant = 'Release',
+ auto_build_solution = 0)
+
+env.MSVSSolution(target = 'Test.sln',
+ slnguid = '{SLNGUID}',
+ projects = [p],
+ variant = 'Release')
+""")
+
+test.run(chdir='work3', arguments=".")
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+vcproj = test.read(['work3', 'Test.vcproj'], 'r')
+expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work3', 'SConstruct')
+# don't compare the pickled data
+assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
+
+test.must_exist(test.workpath('work3', 'Test.sln'))
+sln = test.read(['work3', 'Test.sln'], 'r')
+expect = test.msvs_substitute(expected_slnfile, '7.0', 'work3', 'SConstruct')
# don't compare the pickled data
assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
+test.run(chdir='work3', arguments='-c .')
+
+test.must_not_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_not_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='.')
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='-c Test.sln')
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_not_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='-c Test.vcproj')
+
+test.must_not_exist(test.workpath('work3', 'Test.vcproj'))
+
test.pass_test()
diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py
index 5b5799b..9cbab12 100644
--- a/test/MSVS/vs-7.1-files.py
+++ b/test/MSVS/vs-7.1-files.py
@@ -79,30 +79,23 @@ expected_vcprojfile = """\
\t<Configurations>
\t\t<Configuration
\t\t\tName="Release|Win32"
-\t\t\tOutputDirectory="<WORKPATH>"
-\t\t\tIntermediateDirectory="<WORKPATH>"
+\t\t\tOutputDirectory=""
+\t\t\tIntermediateDirectory=""
\t\t\tConfigurationType="0"
\t\t\tUseOfMFC="0"
\t\t\tATLMinimizesCRunTimeLibraryUsage="FALSE">
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct -c <WORKPATH>\Test.exe"
-\t\t\t\tRebuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct <WORKPATH>\Test.exe"
-\t\t\t\tOutput="<WORKPATH>\Test.exe"/>
+\t\t\t\tBuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct Test.exe"
+\t\t\t\tCleanCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct -c Test.exe"
+\t\t\t\tRebuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C <WORKPATH> -f SConstruct Test.exe"
+\t\t\t\tOutput="Test.exe"/>
\t\t</Configuration>
\t</Configurations>
\t<References>
\t</References>
\t<Files>
\t\t<Filter
-\t\t\tName=" Source Files"
-\t\t\tFilter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat">
-\t\t\t<File
-\t\t\t\tRelativePath="test.cpp">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
\t\t\tName="Header Files"
\t\t\tFilter="h;hpp;hxx;hm;inl">
\t\t\t<File
@@ -130,6 +123,13 @@ expected_vcprojfile = """\
\t\t\t\tRelativePath="test.rc">
\t\t\t</File>
\t\t</Filter>
+\t\t<Filter
+\t\t\tName="Source Files"
+\t\t\tFilter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat">
+\t\t\t<File
+\t\t\t\tRelativePath="test.cpp">
+\t\t\t</File>
+\t\t</Filter>
\t\t<File
\t\t\tRelativePath="<SCONSCRIPT>">
\t\t</File>
@@ -171,15 +171,13 @@ test.run(chdir='work1', arguments="Test.vcproj")
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1', 'SConstruct')
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
test.must_exist(test.workpath('work1', 'Test.sln'))
sln = test.read(['work1', 'Test.sln'], 'r')
-expect = test.msvs_substitute(expected_slnfile, '7.1', 'work1',
- test.workpath('work1', 'SConstruct'))
+expect = test.msvs_substitute(expected_slnfile, '7.1', 'work1', 'SConstruct')
# don't compare the pickled data
assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
@@ -210,8 +208,7 @@ python = os.path.join('$(PYTHON_ROOT)', os.path.split(sys.executable)[1])
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1',
- test.workpath('work1', 'SConstruct'),
+expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1', 'SConstruct',
python=python)
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
@@ -230,6 +227,18 @@ test.write(['work2', 'src', 'SConscript'], SConscript_contents)
test.run(chdir='work2', arguments=".")
+vcproj = test.read(['work2', 'src', 'Test.vcproj'], 'r')
+expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work2', 'SConstruct')
+# don't compare the pickled data
+assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
+
+test.must_exist(test.workpath('work2', 'src', 'Test.sln'))
+sln = test.read(['work2', 'src', 'Test.sln'], 'r')
+expect = test.msvs_substitute(expected_slnfile, '7.0',
+ os.path.join('work2', 'src'))
+# don't compare the pickled data
+assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
+
test.must_match(['work2', 'build', 'Test.vcproj'], """\
This is just a placeholder file.
The real project file is here:
@@ -237,12 +246,6 @@ The real project file is here:
""" % test.workpath('work2', 'src', 'Test.vcproj'),
mode='r')
-vcproj = test.read(['work2', 'src', 'Test.vcproj'], 'r')
-expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work2',
- test.workpath('work2', 'src', 'SConscript'))
-# don't compare the pickled data
-assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
-
test.must_match(['work2', 'build', 'Test.sln'], """\
This is just a placeholder file.
The real workspace file is here:
@@ -250,12 +253,68 @@ The real workspace file is here:
""" % test.workpath('work2', 'src', 'Test.sln'),
mode='r')
-test.must_exist(test.workpath('work2', 'src', 'Test.sln'))
-sln = test.read(['work2', 'src', 'Test.sln'], 'r')
-expect = test.msvs_substitute(expected_slnfile, '7.0', 'work2\\src')
+
+
+test.subdir('work3')
+
+test.write(['work3', 'SConstruct'], """\
+env=Environment(MSVS_VERSION = '7.1')
+
+testsrc = ['test.cpp']
+testincs = ['sdk.h']
+testlocalincs = ['test.h']
+testresources = ['test.rc']
+testmisc = ['readme.txt']
+
+p = env.MSVSProject(target = 'Test.vcproj',
+ srcs = testsrc,
+ incs = testincs,
+ localincs = testlocalincs,
+ resources = testresources,
+ misc = testmisc,
+ buildtarget = 'Test.exe',
+ variant = 'Release',
+ auto_build_solution = 0)
+
+env.MSVSSolution(target = 'Test.sln',
+ slnguid = '{SLNGUID}',
+ projects = [p],
+ variant = 'Release')
+""")
+
+test.run(chdir='work3', arguments=".")
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+vcproj = test.read(['work3', 'Test.vcproj'], 'r')
+expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work3', 'SConstruct')
+# don't compare the pickled data
+assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
+
+test.must_exist(test.workpath('work3', 'Test.sln'))
+sln = test.read(['work3', 'Test.sln'], 'r')
+expect = test.msvs_substitute(expected_slnfile, '7.1', 'work3', 'SConstruct')
# don't compare the pickled data
assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
+test.run(chdir='work3', arguments='-c .')
+
+test.must_not_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_not_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='.')
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='-c Test.sln')
+
+test.must_exist(test.workpath('work3', 'Test.vcproj'))
+test.must_not_exist(test.workpath('work3', 'Test.sln'))
+
+test.run(chdir='work3', arguments='-c Test.vcproj')
+
+test.must_not_exist(test.workpath('work3', 'Test.vcproj'))
+
test.pass_test()