diff options
author | Steven Knight <knight@baldmt.com> | 2005-10-06 17:15:02 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-10-06 17:15:02 (GMT) |
commit | 401ef15c42e9df4f60103dc52b806b3c8ab259fb (patch) | |
tree | 5b83b7fdbc9e3f19a418d0560efba1b3493f46bf /test/MSVS/vs-6.0-files.py | |
parent | 94210da347b187979caa2c5c5b4542455eee8c24 (diff) | |
download | SCons-401ef15c42e9df4f60103dc52b806b3c8ab259fb.zip SCons-401ef15c42e9df4f60103dc52b806b3c8ab259fb.tar.gz SCons-401ef15c42e9df4f60103dc52b806b3c8ab259fb.tar.bz2 |
Refactor MSVS tests to separate file-generation tests (which can be executed on any Windows system) from Visual Studio execution tests (which need a specific VS version installed).
Diffstat (limited to 'test/MSVS/vs-6.0-files.py')
-rw-r--r-- | test/MSVS/vs-6.0-files.py | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/test/MSVS/vs-6.0-files.py b/test/MSVS/vs-6.0-files.py new file mode 100644 index 0000000..fdc8ef2 --- /dev/null +++ b/test/MSVS/vs-6.0-files.py @@ -0,0 +1,236 @@ +#!/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 that we can generate Visual Studio 6 project (.dsp) and solution +(.dsw) files that look correct. +""" + +import os +import sys + +import TestCmd +import TestSCons + +test = TestSCons.TestSCons(match = TestCmd.match_re) + +if sys.platform != 'win32': + msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform + test.skip_test(msg) + + + +expected_dspfile = '''\ +# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=Test - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(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 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 Bsc_Name "" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "Test - Win32 Release" + +!IF "$(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" +# Begin Source File + +SOURCE="sdk.h" +# End Source File +# End Group +# Begin Group "Local Headers" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE="test.h" +# End Source File +# End Group +# Begin Group "Other Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE="readme.txt" +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE="test.rc" +# End Source File +# End Group +# Begin Source File + +SOURCE="<WORKPATH>\SConstruct" +# End Source File +# End Target +# End Project +''' + +expected_dswfile = '''\ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Test"="<WORKPATH>\Test.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### +''' + + +test.subdir('work1') + +test.write(['work1', 'SConstruct'], """\ +env=Environment(MSVS_VERSION = '6.0') + +testsrc = ['test.c'] +testincs = ['sdk.h'] +testlocalincs = ['test.h'] +testresources = ['test.rc'] +testmisc = ['readme.txt'] + +env.MSVSProject(target = 'Test.dsp', + srcs = testsrc, + incs = testincs, + localincs = testlocalincs, + resources = testresources, + misc = testmisc, + buildtarget = 'Test.exe', + variant = 'Release') +""") + +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') +# 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') +assert dsw == expect, test.diff_substr(expect, dsw) + +test.run(chdir='work1', arguments='-c .') + +test.must_not_exist(test.workpath('work1', 'Test.dsp')) +test.must_not_exist(test.workpath('work1', 'Test.dsw')) + +test.run(chdir='work1', arguments='Test.dsp') + +test.must_exist(test.workpath('work1', 'Test.dsp')) +test.must_exist(test.workpath('work1', 'Test.dsw')) + +test.run(chdir='work1', arguments='-c Test.dsw') + +test.must_not_exist(test.workpath('work1', 'Test.dsp')) +test.must_not_exist(test.workpath('work1', 'Test.dsw')) + + + +test.pass_test() |