summaryrefslogtreecommitdiff
path: root/test/Configure
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-05-18 05:12:35 +0000
committerSteven Knight <knight@baldmt.com>2008-05-18 05:12:35 +0000
commit0a485d8a5008c6ffb36917b479ff5375d8368d73 (patch)
tree97e2df9b08fd971d661d41e0ce1bc169c4d7efa7 /test/Configure
parent021b8aded04786b919094399c938e4a5b1c48878 (diff)
downloadscons-0a485d8a5008c6ffb36917b479ff5375d8368d73.tar.gz
Merged revisions 2928-2932,2934-2946 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r2932 | garyo | 2008-04-30 09:14:38 -0700 (Wed, 30 Apr 2008) | 1 line Add doc for site_scons dir and related options. Closes issue #1996. ........ r2934 | stevenknight | 2008-04-30 22:05:38 -0700 (Wed, 30 Apr 2008) | 3 lines Issue 2039: Fix a syntax error in Intel C compiler support on Windows. (Jonas Olsson) ........ r2935 | belley | 2008-05-01 06:59:21 -0700 (Thu, 01 May 2008) | 10 lines test/KeyboardInterrupt.py no longer hangs under Cygwin. There seems to be a bug on Cygwin where the compiler process hangs after sending the SIGINT signal to the process group. It is probably a bug in cygwin1.dll, or maybe in the Python 'C' code or the Python subprocess module. We therefore do not use 'killpg' on Cygwin. Benoit ........ r2936 | belley | 2008-05-01 07:10:23 -0700 (Thu, 01 May 2008) | 12 lines cell_contents not defined in python < 2.5. [Issue 2035] Some versions of Python supports lexical scoping of local variables (aka closures) but not the cell_contents attribute that would allow the FunctionAction signature that take the content of these closure cells into account. The access to the cell_contents attribute is now protected with a try/except AttributeError so that at least the other parts of the function signature are properly computed. Benoit ........ r2937 | stevenknight | 2008-05-01 12:08:25 -0700 (Thu, 01 May 2008) | 3 lines When running tests, allow the user to set the $SCONSIGN variable to pick a specific sconsign script to execute. ........ r2938 | stevenknight | 2008-05-02 19:13:14 -0700 (Fri, 02 May 2008) | 2 lines Set svn:ignore to '*.py[co]'. ........ r2939 | stevenknight | 2008-05-08 21:07:18 -0700 (Thu, 08 May 2008) | 4 lines Issue 2033: Fix excessive memory use when a Python Value node's representation is stored in a .sconsign file and then re-stored after being interpreted with escaped backslashes and quotes. ........ r2940 | cournape | 2008-05-16 03:56:49 -0700 (Fri, 16 May 2008) | 1 line Fix issue 2054. ........ r2941 | stevenknight | 2008-05-16 12:02:45 -0700 (Fri, 16 May 2008) | 8 lines Issue 2045: After a Node has failed its build and we're propagating the failure to other Nodes on the candidate list, don't marke candidate Nodes as FAILED if they've already been visited and been determined to be up-to-date. This avoids problems with Configure tests not running because failure of an earlier Configure tests caused (e.g.) /usr/bin/g++ to get marked as FAILED, making SCons think it doesn't need to bother trying to rebuild anything that will use it... ........ r2942 | stevenknight | 2008-05-16 12:10:14 -0700 (Fri, 16 May 2008) | 8 lines Improve the regular expressions used by the test infrastructure to examine SCons output to decide if a list of targets are considered up-to-date or not. The new code uses the re.escape() function instead of hand-escaping '.' and '\n'. This required a little restructuring in the not_up_to_date() method to escape the characters within the arguments themselves, but not the surrounding characters we use to construct the regex that makes sure those strings *don't* exist in the output. ........ r2943 | stevenknight | 2008-05-16 14:04:23 -0700 (Fri, 16 May 2008) | 3 lines Issue 2049: Handle multiple pipe-separated values in Visual Studio for INCLUDE, LIB and PATH. Still only uses Win32, not any other values. ........ r2944 | stevenknight | 2008-05-16 18:36:27 -0700 (Fri, 16 May 2008) | 2 lines Record changes by David Cournapeau and Benoit Belley. ........ r2945 | stevenknight | 2008-05-17 07:13:46 -0700 (Sat, 17 May 2008) | 3 lines Pass in dc as a keyword argument to _smartLink for older Python versions without nested scopes. ........ r2946 | stevenknight | 2008-05-17 07:14:01 -0700 (Sat, 17 May 2008) | 3 lines Expect a warning about shadowing global variables on Python 2.1. (This code can go away after we release 1.0.) ........
Diffstat (limited to 'test/Configure')
-rw-r--r--test/Configure/build-fail.py90
-rw-r--r--test/Configure/implicit-cache.py103
2 files changed, 193 insertions, 0 deletions
diff --git a/test/Configure/build-fail.py b/test/Configure/build-fail.py
new file mode 100644
index 00000000..2facb810
--- /dev/null
+++ b/test/Configure/build-fail.py
@@ -0,0 +1,90 @@
+#!/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 that Configure tests work even after an earlier test fails.
+
+This was broken in 0.98.3 because we'd mark the /usr/bin/g++ compiler
+as having failed (because it was on the candidates list as the implicit
+command dependency for both the object file and executable generated
+for the configuration test) and then avoid trying to rebuild anything
+else that used the "failed" Node.
+
+Thanks to Ben Webb for the test case.
+"""
+
+import os
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+test.subdir('a', 'b')
+
+a_boost_hpp = os.path.join('..', 'a', 'boost.hpp')
+b_boost_hpp = os.path.join('..', 'b', 'boost.hpp')
+
+test.write('SConstruct', """\
+import os
+def _check(context):
+ for dir in ['a', 'b']:
+ inc = os.path.join('..', dir, 'boost.hpp')
+ result = context.TryRun('''
+ #include "%s"
+
+ int main() { return 0; }
+ ''' % inc, '.cpp')[0]
+ if result:
+ import sys
+ sys.stdout.write('%s: ' % inc)
+ break
+ context.Result(result)
+ return result
+env = Environment()
+conf = env.Configure(custom_tests={'CheckBoost':_check})
+conf.CheckBoost()
+conf.Finish()
+""")
+
+test.write(['b', 'boost.hpp'], """#define FILE "b/boost.hpp"\n""")
+
+expect = test.wrap_stdout(read_str = "%s: yes\n" % b_boost_hpp,
+ build_str = "scons: `.' is up to date.\n")
+
+test.run(arguments='--config=force', stdout=expect)
+
+expect = test.wrap_stdout(read_str = "%s: yes\n" % a_boost_hpp,
+ build_str = "scons: `.' is up to date.\n")
+
+test.write(['a', 'boost.hpp'], """#define FILE "a/boost.hpp"\n""")
+
+test.run(arguments='--config=force', stdout=expect)
+
+test.run()
+
+test.pass_test()
diff --git a/test/Configure/implicit-cache.py b/test/Configure/implicit-cache.py
new file mode 100644
index 00000000..58ae7c9c
--- /dev/null
+++ b/test/Configure/implicit-cache.py
@@ -0,0 +1,103 @@
+#!/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 that use of --implicit-cache with the Python Value Nodes
+used by the Configure subsystem generate the same .sconsign file
+and don't cause it to grow without limit.
+
+This was reported as issue 2033 in the tigris.org bug tracker, by the
+Ardour project. Prior to 0.98.4, the Value implementation would actually
+return the repr() of its value as the str(). This was done because
+it made saving a Value in a file and reading it back in kind of work,
+because a print a string Value into a file (for example) would in fact
+put quotes around it and be assignable in that file.
+
+The problem is that this would get stored in a .sconsign file as its
+repr(), with the specific problem being that Values with embedded newlines
+would get stored as strings containing backslash+n digraphs *and* the
+quotes at beginning and end of the string::
+
+ '\n#include <math.h>\n\n': {<.sconsign info>}
+
+Then, when we read that back in from the .sconsign file, we would store
+that repr() as a string Value itself, escaping the backslashes and
+including the quotes, so when we stored it the second time it would end
+up looking like:
+
+ "'\\n#include <math.h>\\n\\n'": {<.sconsign info>}
+
+Every time that we would read this value and store it again (because
+something else changed in the .sconf_temp directory), the string would
+get longer and longer until it blew out the users's memory.
+"""
+
+import TestSConsign
+
+test = TestSConsign.TestSConsign()
+
+test.write('SConstruct', """
+env = Environment(CPPPATH=['.'])
+conf = Configure(env)
+conf.CheckHeader( 'math.h' )
+if ARGUMENTS.get('USE_FOO'):
+ conf.CheckHeader( 'foo.h' )
+env = conf.Finish()
+""")
+
+test.write('foo.h', "#define FOO 1\n")
+
+# First run: Have the configure subsystem only look for math.h, and
+# squirrel away the .sconsign info for the conftest_0.c file that's
+# generated from the Python Value Node that we're using for our test.
+
+test.run(arguments = '.')
+
+test.run_sconsign('-d .sconf_temp -e conftest_0.c --raw .sconsign.dblite')
+old_sconsign_dblite = test.stdout()
+
+# Second run: Have the configure subsystem also look for foo.h, so
+# that there's a change in the .sconf_temp directory that will cause its
+# .sconsign information to get rewritten from disk. Squirrel away the
+# .sconsign info for the conftest_0.c file. The now-fixed bug would show
+# up because the entry would change with the additional string-escaping
+# described above. The now-correct behavior is that the re-stored value
+# for conftest_0.c doesn't change.
+
+test.run(arguments = '--implicit-cache USE_FOO=1 .')
+
+test.run_sconsign('-d .sconf_temp -e conftest_0.c --raw .sconsign.dblite')
+new_sconsign_dblite = test.stdout()
+
+if old_sconsign_dblite != new_sconsign_dblite:
+ print ".sconsign.dblite did not match:"
+ print "FIRST RUN =========="
+ print old_sconsign_dblite
+ print "SECOND RUN =========="
+ print new_sconsign_dblite
+ test.fail_test()
+
+test.pass_test()