diff options
author | Steven Knight <knight@baldmt.com> | 2008-04-21 06:38:31 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2008-04-21 06:38:31 (GMT) |
commit | 736666c4435e553e13b69e57339ec91c9f4f2824 (patch) | |
tree | 512353b30aa2af47f79bcd816ea27ac65cf1303f /test | |
parent | a6391f26d941d3cba4ec4bf6c499d38e2ce4a014 (diff) | |
download | SCons-736666c4435e553e13b69e57339ec91c9f4f2824.zip SCons-736666c4435e553e13b69e57339ec91c9f4f2824.tar.gz SCons-736666c4435e553e13b69e57339ec91c9f4f2824.tar.bz2 |
Merged revisions 2880-2883,2885-2895 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r2885 | stevenknight | 2008-04-18 21:38:59 -0700 (Fri, 18 Apr 2008) | 2 lines
Update troubleshooting appendix for new Taskmaster output.
........
r2886 | bdbaddog | 2008-04-19 15:15:03 -0700 (Sat, 19 Apr 2008) | 5 lines
Fix infinite loop in Fortran tool initialization.
Bug 2017.
Steven fixed, I tested.
........
r2887 | garyo | 2008-04-20 17:44:46 -0700 (Sun, 20 Apr 2008) | 1 line
Added this in two sections; simple one when discussing simple builds, and an example in the VariantDir section showing how it still works there.
........
r2888 | stevenknight | 2008-04-20 21:33:01 -0700 (Sun, 20 Apr 2008) | 4 lines
Accomodate test/MSVC/msvc.py's reliance on the Windows Platform SDK
(for now) by making use of the user's %INCLUDE% and %LIB% variables.
Split some independent embedded subtests into their own test scripts.
........
r2889 | stevenknight | 2008-04-20 21:38:05 -0700 (Sun, 20 Apr 2008) | 2 lines
Windows portability fix (line endings).
........
r2890 | stevenknight | 2008-04-20 21:44:24 -0700 (Sun, 20 Apr 2008) | 2 lines
Update Windows portion of if:-elif: block for a variable name change.
........
r2891 | stevenknight | 2008-04-20 21:52:41 -0700 (Sun, 20 Apr 2008) | 3 lines
On Windows, escape backslashes on the --interactive command line input,
so people can build targets in other directories.
........
r2892 | stevenknight | 2008-04-20 21:56:50 -0700 (Sun, 20 Apr 2008) | 3 lines
Fix ripple effects on Windows from redefining how $CXXFLAGS gets
added to C++ command lines.
........
r2893 | stevenknight | 2008-04-20 22:04:50 -0700 (Sun, 20 Apr 2008) | 4 lines
Handle a ripple effect from redefining the file() and open() builtin
functions by explicitly restoring the originals whenever we reset
the global state between tests.
........
r2894 | stevenknight | 2008-04-20 23:17:23 -0700 (Sun, 20 Apr 2008) | 2 lines
Remove by-hand backslash escaping, now that --interactive mode is handling it.
........
r2895 | stevenknight | 2008-04-20 23:23:04 -0700 (Sun, 20 Apr 2008) | 2 lines
Mention the fix for the Fortran suffix out-of-memory bug
........
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/CCFLAGS.py | 6 | ||||
-rw-r--r-- | test/Deprecated/Options/ListOption.py | 4 | ||||
-rw-r--r-- | test/Interactive/added-include.py | 7 | ||||
-rw-r--r-- | test/MSVC/PCHSTOP-errors.py | 75 | ||||
-rw-r--r-- | test/MSVC/hierarchical.py | 93 | ||||
-rw-r--r-- | test/MSVC/msvc.py | 95 | ||||
-rw-r--r-- | test/NodeOps.py | 19 | ||||
-rw-r--r-- | test/gnutools.py | 4 |
8 files changed, 190 insertions, 113 deletions
diff --git a/test/CXX/CCFLAGS.py b/test/CXX/CCFLAGS.py index a559de3..a867340 100644 --- a/test/CXX/CCFLAGS.py +++ b/test/CXX/CCFLAGS.py @@ -34,8 +34,10 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ -foo = Environment(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX') -bar = Environment(CCFLAGS = '-DBAR', CXXFLAGS = '-DCXX') +foo = Environment() +foo.Append(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX') +bar = Environment() +bar.Append(CCFLAGS = '-DBAR', CXXFLAGS = '-DCXX') foo_obj = foo.Object(target = 'foo', source = 'prog.cpp') bar_obj = bar.Object(target = 'bar', source = 'prog.cpp') foo.Program(target = 'foo', source = foo_obj) diff --git a/test/Deprecated/Options/ListOption.py b/test/Deprecated/Options/ListOption.py index 68d2ee8..1ce20a2 100644 --- a/test/Deprecated/Options/ListOption.py +++ b/test/Deprecated/Options/ListOption.py @@ -81,9 +81,7 @@ test.run() check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', "['gl ical qt x11']"]) -test.must_match(test.workpath('scons.options'), - "shared = 'all'"+os.linesep, - mode='r') +test.must_match(test.workpath('scons.options'), "shared = 'all'"+os.linesep) check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', "['gl ical qt x11']"]) diff --git a/test/Interactive/added-include.py b/test/Interactive/added-include.py index 8c30314..73f8096 100644 --- a/test/Interactive/added-include.py +++ b/test/Interactive/added-include.py @@ -60,14 +60,13 @@ Command('3', [], Touch('$TARGET')) """) foo_exe = test.workpath('foo' + TestSCons._exe) -_foo_exe_ = '"%s"' % string.replace(foo_exe, '\\', '\\\\') # Start scons, to build "foo" scons = test.start(arguments = '--interactive') -scons.send("build %(_foo_exe_)s 1\n" % locals()) +scons.send("build %(foo_exe)s 1\n" % locals()) test.wait_for(test.workpath('1'), popen=scons) @@ -91,7 +90,7 @@ int main() } """) -scons.send("build %(_foo_exe_)s 2\n" % locals()) +scons.send("build %(foo_exe)s 2\n" % locals()) test.wait_for(test.workpath('2')) @@ -106,7 +105,7 @@ test.write('foo.h.in', """ -scons.send("build %(_foo_exe_)s 3\n" % locals()) +scons.send("build %(foo_exe)s 3\n" % locals()) test.wait_for(test.workpath('3')) diff --git a/test/MSVC/PCHSTOP-errors.py b/test/MSVC/PCHSTOP-errors.py new file mode 100644 index 0000000..c0bc693 --- /dev/null +++ b/test/MSVC/PCHSTOP-errors.py @@ -0,0 +1,75 @@ +#!/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 error reporting
+"""
+
+import re
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_re)
+
+if sys.platform != 'win32':
+ msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
+ test.skip_test(msg)
+
+
+
+SConstruct_path = test.workpath('SConstruct')
+
+test.write(SConstruct_path, """\
+env = Environment()
+env['PDB'] = File('test.pdb')
+env['PCH'] = env.PCH('StdAfx.cpp')[0]
+if int(ARGUMENTS.get('SET_PCHSTOP')):
+ env['PCHSTOP'] = File('StdAfx.h')
+env.Program('test', 'test.cpp')
+""")
+
+
+
+expect_stderr = r'''
+scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined.
+File "%s", line \d+, in \?
+''' % re.escape(SConstruct_path)
+
+test.run(arguments='SET_PCHSTOP=0', status=2, stderr=expect_stderr)
+
+
+
+expect_stderr = r'''
+scons: \*\*\* The PCHSTOP construction variable must be a string: .+
+File "%s", line \d+, in \?
+''' % re.escape(SConstruct_path)
+
+test.run(arguments='SET_PCHSTOP=1', status=2, stderr=expect_stderr)
+
+
+
+test.pass_test()
diff --git a/test/MSVC/hierarchical.py b/test/MSVC/hierarchical.py new file mode 100644 index 0000000..2dece66 --- /dev/null +++ b/test/MSVC/hierarchical.py @@ -0,0 +1,93 @@ +#!/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__"
+
+"""
+Verify use of Visual Studio with a hierarchical build.
+"""
+
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_re)
+
+if sys.platform != 'win32':
+ msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
+ test.skip_test(msg)
+
+
+
+test.subdir('src', 'build', 'out')
+
+test.write('SConstruct', """
+VariantDir('build', 'src', duplicate=0)
+SConscript('build/SConscript')
+""")
+
+test.write('src/SConscript',"""
+import os
+env = Environment()
+env.Append(CPPPATH=os.environ['INCLUDE'],
+ LIBPATH=os.environ['LIB'])
+env['PCH'] = 'StdAfx.pch'
+env['PDB'] = '#out/test.pdb'
+env['PCHSTOP'] = 'StdAfx.h'
+env.PCH('StdAfx.cpp')
+env.Program('#out/test.exe', 'test.cpp')
+""")
+
+test.write('src/test.cpp', '''
+#include "StdAfx.h"
+
+int main(void)
+{
+ return 1;
+}
+''')
+
+test.write('src/StdAfx.h', '''
+#include <windows.h>
+''')
+
+test.write('src/StdAfx.cpp', '''
+#include "StdAfx.h"
+''')
+
+test.run(arguments='out', stderr=None)
+
+test.must_exist(test.workpath('out/test.pdb'))
+test.must_exist(test.workpath('build/StdAfx.pch'))
+test.must_exist(test.workpath('build/StdAfx.obj'))
+
+test.run(arguments='-c out')
+
+test.must_not_exist(test.workpath('out/test.pdb'))
+test.must_not_exist(test.workpath('build/StdAfx.pch'))
+test.must_not_exist(test.workpath('build/StdAfx.obj'))
+
+
+
+test.pass_test()
diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py index 48e47f6..552d039 100644 --- a/test/MSVC/msvc.py +++ b/test/MSVC/msvc.py @@ -25,15 +25,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os -import os.path import re import sys import time -import TestCmd import TestSCons -test = TestSCons.TestSCons(match = TestCmd.match_re) +test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform @@ -43,7 +41,10 @@ if sys.platform != 'win32': # Test the basics test.write('SConstruct',""" -env=Environment() +import os +env = Environment() +env.Append(CPPPATH=os.environ['INCLUDE'], + LIBPATH=os.environ['LIB']) env['PDB'] = File('test.pdb') env['PCHSTOP'] = 'StdAfx.h' env['PCH'] = env.PCH('StdAfx.cpp')[0] @@ -185,91 +186,5 @@ test.not_up_to_date(arguments='test.exe', stderr=None) test.run(program=test.workpath('test.exe'), stdout='2003 test 2\n') -########## -# Test a hierarchical build - -test.subdir('src', 'build', 'out') - -test.write('SConstruct',""" -VariantDir('build', 'src', duplicate=0) -SConscript('build/SConscript') -""") - -test.write('src/SConscript',""" -env=Environment() -env['PCH'] = 'StdAfx.pch' -env['PDB'] = '#out/test.pdb' -env['PCHSTOP'] = 'StdAfx.h' -env.PCH('StdAfx.cpp') -env.Program('#out/test.exe', 'test.cpp') -""") - -test.write('src/test.cpp', ''' -#include "StdAfx.h" - -int main(void) -{ - return 1; -} -''') - -test.write('src/StdAfx.h', ''' -#include <windows.h> -''') - -test.write('src/StdAfx.cpp', ''' -#include "StdAfx.h" -''') - -test.run(arguments='out', stderr=None) - -test.must_exist(test.workpath('out/test.pdb')) -test.must_exist(test.workpath('build/StdAfx.pch')) -test.must_exist(test.workpath('build/StdAfx.obj')) - -test.run(arguments='-c out') - -test.must_not_exist(test.workpath('out/test.pdb')) -test.must_not_exist(test.workpath('build/StdAfx.pch')) -test.must_not_exist(test.workpath('build/StdAfx.obj')) - -##### -# Test error reporting - -SConstruct_path = test.workpath('SConstruct') - -test.write(SConstruct_path, """\ -env = Environment() -env['PDB'] = File('test.pdb') -env['PCH'] = env.PCH('StdAfx.cpp')[0] -env.Program('test', 'test.cpp') -""") - -expect_stderr = r''' -scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined. -File "%s", line 4, in \? -''' % re.escape(SConstruct_path) - -test.run(status=2, stderr=expect_stderr) - -test.write(SConstruct_path, """\ -env = Environment() -env['PDB'] = File('test.pdb') -env['PCHSTOP'] = File('StdAfx.h') -env['PCH'] = env.PCH('StdAfx.cpp')[0] -env.Program('test', 'test.cpp') -""") - -expect_stderr = r''' -scons: \*\*\* The PCHSTOP construction variable must be a string: .+ -File "%s", line 5, in \? -''' % re.escape(SConstruct_path) - -test.run(status=2, stderr=expect_stderr) test.pass_test() - - - - - diff --git a/test/NodeOps.py b/test/NodeOps.py index d00f726..ffaeb62 100644 --- a/test/NodeOps.py +++ b/test/NodeOps.py @@ -52,15 +52,13 @@ if string.find(sys.platform, 'irix') > -1: test = TestSCons.TestSCons() -e = test.Environment() -fooflags = e['SHCXXFLAGS'] + ' -DFOO' -barflags = e['SHCXXFLAGS'] + ' -DBAR' - test.subdir('bld', 'src', ['src', 'subsrcdir']) sconstruct = r""" -foo = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(fooflags)s', WINDOWS_INSERT_DEF=1) -bar = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(barflags)s', WINDOWS_INSERT_DEF=1) +foo = Environment(SHOBJPREFIX='', WINDOWS_INSERT_DEF=1) +foo.Append(SHCXXFLAGS = '-DFOO') +bar = Environment(SHOBJPREFIX='', WINDOWS_INSERT_DEF=1) +bar.Append(SHCXXFLAGS = '-DBAR') src = Dir('src') VariantDir('bld', src, duplicate=1) Nodes=[] @@ -90,11 +88,9 @@ gooMain = foo.Clone(LIBS='goo', LIBPATH='bld') goo_obj = gooMain.Object(target='goomain', source='main.c') gooMain.Program(target='gooprog', source=goo_obj) """ - test.write('foo.def', r""" LIBRARY "foo" -DESCRIPTION "Foo Shared Library" EXPORTS doIt @@ -102,7 +98,6 @@ EXPORTS test.write('bar.def', r""" LIBRARY "bar" -DESCRIPTION "Bar Shared Library" EXPORTS doIt @@ -153,8 +148,9 @@ def exists_test(node): import sys sys.stderr.write('VariantDir exists() population did not occur! (%%s:%%s,%%s,%%s)\n'%%(str(node),before,via_node,after)) sys.exit(-2) - -goo = Environment(CPPFLAGS = '%(fooflags)s') + +goo = Environment() +goo.Append(CFLAGS = '-DFOO') goof_in = File('goof.in') if %(_E)s: exists_test(goof_in) @@ -192,7 +188,6 @@ boo_sub() """) test.write('main.c', r""" - void doIt(); int diff --git a/test/gnutools.py b/test/gnutools.py index 2180217..bf0cb5a 100644 --- a/test/gnutools.py +++ b/test/gnutools.py @@ -133,8 +133,8 @@ testObject(test, 'cppfile1.o', 'g++ -c') testObject(test, 'cppfile2.o', 'g++ -c') testObject(test, 'cfile1.os', 'gcc -c' + c_fpic) testObject(test, 'cfile2.os', 'gcc -c' + c_fpic) -testObject(test, 'cppfile1.os', 'g++ -c -fPIC') -testObject(test, 'cppfile2.os', 'g++ -c -fPIC') +testObject(test, 'cppfile1.os', 'g++ -c' + c_fpic) +testObject(test, 'cppfile2.os', 'g++ -c' + c_fpic) testObject(test, 'c-only' + _exe, 'gcc') testObject(test, 'cpp-only' + _exe, 'g++') testObject(test, 'c-and-cpp' + _exe, 'g++') |