summaryrefslogtreecommitdiffstats
path: root/test/Configure
diff options
context:
space:
mode:
Diffstat (limited to 'test/Configure')
-rw-r--r--test/Configure/Action-error.py54
-rw-r--r--test/Configure/Builder-call.py63
-rw-r--r--test/Configure/CONFIGUREDIR.py57
-rw-r--r--test/Configure/CONFIGURELOG.py68
-rw-r--r--test/Configure/ConfigureDryRunError.py109
-rw-r--r--test/Configure/SConscript.py80
-rw-r--r--test/Configure/Streamer1.py85
-rw-r--r--test/Configure/VariantDir-SConscript.py165
-rw-r--r--test/Configure/VariantDir.py97
-rw-r--r--test/Configure/VariantDir2.py49
-rw-r--r--test/Configure/basic.py91
-rw-r--r--test/Configure/build-fail.py97
-rw-r--r--test/Configure/cache-not-ok.py102
-rw-r--r--test/Configure/cache-ok.py126
-rw-r--r--test/Configure/clean.py84
-rw-r--r--test/Configure/config-h.py186
-rw-r--r--test/Configure/custom-tests.py201
-rw-r--r--test/Configure/from-SConscripts.py63
-rw-r--r--test/Configure/help.py94
-rw-r--r--test/Configure/implicit-cache.py109
-rw-r--r--test/Configure/option--Q.py52
-rw-r--r--test/Configure/option--config.py131
22 files changed, 2163 insertions, 0 deletions
diff --git a/test/Configure/Action-error.py b/test/Configure/Action-error.py
new file mode 100644
index 0000000..90ba1ee
--- /dev/null
+++ b/test/Configure/Action-error.py
@@ -0,0 +1,54 @@
+#!/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 calling Configure from an Action results in a readable error.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+def ConfigureAction(target, source, env):
+ env.Configure()
+ return 0
+env = Environment(BUILDERS = {'MyAction' :
+ Builder(action=Action(ConfigureAction))})
+env.MyAction('target', [])
+""")
+
+expect = "scons: *** [target] Calling Configure from Builders is not supported.\n"
+
+test.run(status=2, stderr=expect)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/Builder-call.py b/test/Configure/Builder-call.py
new file mode 100644
index 0000000..037a2c7
--- /dev/null
+++ b/test/Configure/Builder-call.py
@@ -0,0 +1,63 @@
+#!/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 calling normal Builders from an actual Configure
+context environment works correctly.
+"""
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+test.write('mycommand.py', r"""
+import sys
+sys.stderr.write( 'Hello World on stderr\n' )
+sys.stdout.write( 'Hello World on stdout\n' )
+open(sys.argv[1], 'w').write( 'Hello World\n' )
+""")
+
+test.write('SConstruct', """\
+env = Environment()
+def CustomTest(*args):
+ return 0
+conf = env.Configure(custom_tests = {'MyTest' : CustomTest})
+if not conf.MyTest():
+ env.Command("hello", [], '%(_python_)s mycommand.py $TARGET')
+env = conf.Finish()
+""" % locals())
+
+test.run(stderr="Hello World on stderr\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/CONFIGUREDIR.py b/test/Configure/CONFIGUREDIR.py
new file mode 100644
index 0000000..4b5a02e
--- /dev/null
+++ b/test/Configure/CONFIGUREDIR.py
@@ -0,0 +1,57 @@
+#!/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 the configure context directory can be specified by
+setting the $CONFIGUREDIR construction variable.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write("SConstruct", """\
+def CustomTest(context):
+ context.Message('Executing Custom Test ... ')
+ context.Result(1)
+
+env = Environment(CONFIGUREDIR = 'custom_config_dir')
+conf = Configure(env, custom_tests = {'CustomTest' : CustomTest})
+conf.CustomTest();
+env = conf.Finish()
+""")
+
+test.run()
+
+test.must_exist('custom_config_dir')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/CONFIGURELOG.py b/test/Configure/CONFIGURELOG.py
new file mode 100644
index 0000000..9b6221b
--- /dev/null
+++ b/test/Configure/CONFIGURELOG.py
@@ -0,0 +1,68 @@
+#!/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 the configure context log file name can be specified by
+setting the $CONFIGURELOG construction variable.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+test.write(SConstruct_path, """\
+def CustomTest(context):
+ context.Message('Executing Custom Test ...')
+ context.Result(1)
+
+env = Environment(CONFIGURELOG = 'custom.logfile')
+conf = Configure(env, custom_tests = {'CustomTest' : CustomTest})
+conf.CustomTest();
+env = conf.Finish()
+""")
+
+test.run()
+
+expect = """\
+file %(SConstruct_path)s,line 6:
+\tConfigure(confdir = .sconf_temp)
+scons: Configure: Executing Custom Test ...
+scons: Configure: (cached) yes
+
+
+""" % locals()
+
+test.must_match('custom.logfile', expect, mode='r')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/ConfigureDryRunError.py b/test/Configure/ConfigureDryRunError.py
new file mode 100644
index 0000000..b4be67e
--- /dev/null
+++ b/test/Configure/ConfigureDryRunError.py
@@ -0,0 +1,109 @@
+#!/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 the ConfigureDryRunError.
+"""
+
+import os
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons()
+
+lib = test.Configure_lib
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+SConstruct_path = test.workpath('SConstruct')
+
+test.write(SConstruct_path, """
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env)
+r1 = conf.CheckLib('%s') # will pass
+r2 = conf.CheckLib('hopefullynolib') # will fail
+env = conf.Finish()
+if not (r1 and not r2):
+ Exit(1)
+""" % (lib))
+
+expect = """
+scons: *** Cannot create configure directory ".sconf_temp" within a dry-run.
+""" + test.python_file_line(SConstruct_path, 5)
+
+test.run(arguments='-n', status=2, stderr=expect)
+
+test.must_not_exist('config.log')
+test.subdir('.sconf_temp')
+
+conftest_0_c = os.path.join(".sconf_temp", "conftest_0.c")
+SConstruct_file_line = test.python_file_line(SConstruct_path, 6)[:-1]
+
+expect = """
+scons: *** Cannot update configure test "%(conftest_0_c)s" within a dry-run.
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments='-n', status=2, stderr=expect)
+
+test.run()
+test.checkLogAndStdout( ["Checking for C library %s... " % lib,
+ "Checking for C library hopefullynolib... "],
+ ["yes", "no"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+oldLog = test.read(test.workpath('config.log'))
+
+test.run(arguments='-n')
+test.checkLogAndStdout( ["Checking for C library %s... " % lib,
+ "Checking for C library hopefullynolib... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ "config.log", ".sconf_temp", "SConstruct",
+ doCheckLog=0)
+
+newLog = test.read(test.workpath('config.log'))
+if newLog != oldLog:
+ print "Unexpected update of log file within a dry run"
+ test.fail_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/Configure/SConscript.py b/test/Configure/SConscript.py
new file mode 100644
index 0000000..73afef7
--- /dev/null
+++ b/test/Configure/SConscript.py
@@ -0,0 +1,80 @@
+#!/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 contexts from multiple subsidiary SConscript
+files work without error.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir(['dir1'],
+ ['dir2'],
+ ['dir2', 'sub1'],
+ ['dir2', 'sub1', 'sub2'])
+
+test.write('SConstruct', """\
+env = Environment()
+SConscript(dirs=['dir1', 'dir2'], exports="env")
+""")
+
+test.write(['dir1', 'SConscript'], """
+Import("env")
+conf = env.Configure()
+conf.Finish()
+""")
+
+test.write(['dir2', 'SConscript'], """
+Import("env")
+conf = env.Configure()
+conf.Finish()
+SConscript(dirs=['sub1'], exports="env")
+""")
+
+test.write(['dir2', 'sub1', 'SConscript'], """
+Import("env")
+conf = env.Configure()
+conf.Finish()
+SConscript(dirs=['sub2'], exports="env")
+""")
+
+test.write(['dir2', 'sub1', 'sub2', 'SConscript'], """
+Import("env")
+conf = env.Configure()
+conf.Finish()
+""")
+
+test.run()
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/Streamer1.py b/test/Configure/Streamer1.py
new file mode 100644
index 0000000..8f35308
--- /dev/null
+++ b/test/Configure/Streamer1.py
@@ -0,0 +1,85 @@
+#!/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 for BitBucket PR 126:
+
+SConf doesn't work well with 'io' module on pre-3.0 Python. This is because
+io.StringIO (used by SCons.SConf.Streamer) accepts only unicode strings.
+Non-unicode input causes it to raise an exception.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+# SConstruct
+#
+# The CheckHello should return 'yes' if everything works fine. Otherwise it
+# returns 'failed'.
+#
+def hello(target, source, env):
+ import traceback
+ try:
+ print 'hello!\\n' # this breaks the script
+ with open(env.subst('$TARGET', target = target),'w') as f:
+ f.write('yes')
+ except:
+ # write to file, as stdout/stderr is broken
+ traceback.print_exc(file=open('traceback','w'))
+ return 0
+
+def CheckHello(context):
+ import sys
+ context.Display('Checking whether hello works... ')
+ stat,out = context.TryAction(hello,'','.in')
+ if stat and out:
+ context.Result(out)
+ else:
+ context.Result('failed')
+ return out
+
+env = Environment()
+cfg = Configure(env)
+
+cfg.AddTest('CheckHello', CheckHello)
+cfg.CheckHello()
+
+env = cfg.Finish()
+""")
+
+test.run(arguments = '.')
+test.must_contain_all_lines(test.stdout(), ['Checking whether hello works... yes'])
+test.must_not_exist('traceback')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/VariantDir-SConscript.py b/test/Configure/VariantDir-SConscript.py
new file mode 100644
index 0000000..c82778a
--- /dev/null
+++ b/test/Configure/VariantDir-SConscript.py
@@ -0,0 +1,165 @@
+#!/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 calls in SConscript files work when used
+with VariantDir.
+"""
+
+import os.path
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+test.subdir( 'sub', ['sub', 'local'] )
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+test.write('SConstruct', """\
+opts = Variables()
+opts.Add('chdir')
+env = Environment(options=opts)
+if env['chdir'] == 'yes':
+ SConscriptChdir(1)
+else:
+ SConscriptChdir(0)
+VariantDir( 'build', '.' )
+SConscript( 'build/SConscript' )
+""")
+
+test.write(['sub', 'local', 'local_header.h'], "/* Hello World */" )
+
+test.write('SConscript', """\
+SConscript( 'sub/SConscript' )
+""")
+
+test.write(['sub', 'SConscript'], """\
+def CustomTest(context):
+ context.Message('Executing Custom Test ... ')
+ ret = context.TryCompile('#include "local_header.h"', '.c')
+ context.Result(ret)
+ return ret
+
+env = Environment(FOO='fff')
+env.Append( CPPPATH='local' )
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure( env, custom_tests = {'CustomTest' : CustomTest,
+ '$FOO' : CustomTest} )
+if hasattr(conf, 'fff'):
+ conf.Message('$FOO should not have been expanded!')
+ Exit(1)
+if not conf.CheckCHeader( 'math.h' ):
+ Exit(1)
+if conf.CheckCHeader( 'no_std_c_header.h' ):
+ Exit(1)
+if not conf.CustomTest():
+ Exit(1)
+env = conf.Finish()
+env.Program( 'TestProgram', 'TestProgram.c' )
+""")
+
+test.write(['sub', 'TestProgram.h'], """\
+/* Just a test header */
+""")
+
+test.write(['sub', 'TestProgram.c'], """\
+#include "TestProgram.h"
+#include <stdio.h>
+
+int main() {
+ printf( "Hello\\n" );
+}
+""")
+
+# first with SConscriptChdir(0)
+test.run(arguments='chdir=no')
+test.checkLogAndStdout( ["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... ",
+ "Executing Custom Test ... "],
+ ["yes", "no", "yes"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))],
+ [((".c", NCR), (_obj, NCR))]],
+ "config.log",
+ ".sconf_temp",
+ os.path.join("build", "sub", "SConscript"))
+
+test.run(arguments='chdir=no')
+test.checkLogAndStdout( ["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... ",
+ "Executing Custom Test ... "],
+ ["yes", "no", "yes"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))],
+ [((".c", CR), (_obj, CR))]],
+ "config.log",
+ ".sconf_temp",
+ os.path.join("build", "sub", "SConscript"))
+
+import shutil
+shutil.rmtree(test.workpath(".sconf_temp"))
+test.unlink(".sconsign.dblite")
+
+# now with SConscriptChdir(1)
+test.run(arguments='chdir=yes')
+test.checkLogAndStdout( ["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... ",
+ "Executing Custom Test ... "],
+ ["yes", "no", "yes"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))],
+ [((".c", NCR), (_obj, NCR))]],
+ "config.log",
+ ".sconf_temp",
+ os.path.join("build", "sub", "SConscript"))
+
+test.run(arguments='chdir=yes')
+test.checkLogAndStdout( ["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... ",
+ "Executing Custom Test ... "],
+ ["yes", "no", "yes"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))],
+ [((".c", CR), (_obj, CR))]],
+ "config.log",
+ ".sconf_temp",
+ os.path.join("build", "sub", "SConscript"))
+
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/VariantDir.py b/test/Configure/VariantDir.py
new file mode 100644
index 0000000..01df276
--- /dev/null
+++ b/test/Configure/VariantDir.py
@@ -0,0 +1,97 @@
+#!/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 contexts work with basic use of VariantDir.
+"""
+
+import os
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+test.write('SConstruct', """\
+env = Environment(LOGFILE='build/config.log')
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+VariantDir( 'build', '.' )
+conf = env.Configure(conf_dir='build/config.tests', log_file='$LOGFILE')
+r1 = conf.CheckCHeader( 'math.h' )
+r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
+env = conf.Finish()
+Export( 'env' )
+# print open( 'build/config.log' ).readlines()
+SConscript( 'build/SConscript' )
+""")
+
+test.write('SConscript', """\
+Import( 'env' )
+env.Program( 'TestProgram', 'TestProgram.c' )
+""")
+
+test.write('TestProgram.c', """\
+#include <stdio.h>
+
+int main() {
+ printf( "Hello\\n" );
+}
+""")
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "],
+ ["yes", "no"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))]],
+ os.path.join("build", "config.log"),
+ os.path.join("build", "config.tests"),
+ "SConstruct")
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ os.path.join("build", "config.log"),
+ os.path.join("build", "config.tests"),
+ "SConstruct")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/VariantDir2.py b/test/Configure/VariantDir2.py
new file mode 100644
index 0000000..62b832f
--- /dev/null
+++ b/test/Configure/VariantDir2.py
@@ -0,0 +1,49 @@
+#!/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 contexts work with SConstruct/SConscript structure
+"""
+
+import os
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+SConscript('SConscript', variant_dir='build', src='.')
+""")
+
+test.write('SConscript', """\
+env = Environment()
+config = env.Configure(conf_dir='sconf', log_file='config.log')
+config.TryRun("int main() {}", ".c")
+config.Finish()
+""")
+
+test.run()
+test.pass_test()
diff --git a/test/Configure/basic.py b/test/Configure/basic.py
new file mode 100644
index 0000000..4344941
--- /dev/null
+++ b/test/Configure/basic.py
@@ -0,0 +1,91 @@
+#!/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 basic builds work with Configure contexts.
+"""
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+test.write('SConstruct', """\
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+# Throw in a bad variable name intentionally used by Ubuntu packaging.
+env['ENV']['HASH(0x12345678)'] = 'Bad variable name!'
+conf = Configure(env)
+r1 = conf.CheckCHeader( 'math.h' )
+r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
+env = conf.Finish()
+Export( 'env' )
+SConscript( 'SConscript' )
+""")
+
+test.write('SConscript', """\
+Import( 'env' )
+env.Program( 'TestProgram', 'TestProgram.c' )
+""")
+
+test.write('TestProgram.c', """\
+#include <stdio.h>
+
+int main() {
+ printf( "Hello\\n" );
+}
+""")
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "],
+ ["yes", "no"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/build-fail.py b/test/Configure/build-fail.py
new file mode 100644
index 0000000..74609f6
--- /dev/null
+++ b/test/Configure/build-fail.py
@@ -0,0 +1,97 @@
+#!/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 re
+
+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" % re.escape(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" % re.escape(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()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/cache-not-ok.py b/test/Configure/cache-not-ok.py
new file mode 100644
index 0000000..ccbb7d5
--- /dev/null
+++ b/test/Configure/cache-not-ok.py
@@ -0,0 +1,102 @@
+#!/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 the cache mechanism works when checks are not ok.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons()
+
+lib = test.Configure_lib
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+test.write('SConstruct', """\
+if not int(ARGUMENTS.get('target_signatures_content', 0)):
+ Decider('timestamp-newer')
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = env.Configure()
+r1 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
+r2 = conf.CheckLib( 'no_c_library_SAFFDG' ) # leads to link error
+env = conf.Finish()
+if not (not r1 and not r2):
+ print "FAIL: ", r1, r2
+ Exit(1)
+""")
+
+# Verify correct behavior when we call Decider('timestamp-newer').
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ",
+ "Checking for C library no_c_library_SAFFDG... "],
+ ["no"]*2,
+ [[((".c", NCR), (_obj, NCF))],
+ [((".c", NCR), (_obj, NCR), (_exe, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run()
+test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ",
+ "Checking for C library no_c_library_SAFFDG... "],
+ ["no"]*2,
+ [[((".c", CR), (_obj, NCF))],
+ [((".c", CR), (_obj, CR), (_exe, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+# Same should be true for the default behavior of Decider('content').
+
+test.run(arguments='target_signatures_content=1 --config=force')
+test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ",
+ "Checking for C library no_c_library_SAFFDG... "],
+ ["no"]*2,
+ [[((".c", NCR), (_obj, NCF))],
+ [((".c", NCR), (_obj, NCR), (_exe, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='target_signatures_content=1')
+test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ",
+ "Checking for C library no_c_library_SAFFDG... "],
+ ["no"]*2,
+ [[((".c", CR), (_obj, CF))],
+ [((".c", CR), (_obj, CR), (_exe, CF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/cache-ok.py b/test/Configure/cache-ok.py
new file mode 100644
index 0000000..93d1308
--- /dev/null
+++ b/test/Configure/cache-ok.py
@@ -0,0 +1,126 @@
+#!/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 the cache mechanism works when checks are ok.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons(match = TestSCons.match_re)
+
+lib = test.Configure_lib
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+test.write('SConstruct', """\
+if not int(ARGUMENTS.get('target_signatures_content', 0)):
+ Decider('timestamp-newer')
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env)
+r1 = conf.CheckLibWithHeader( '%(lib)s', 'math.h', 'c' )
+r2 = conf.CheckLibWithHeader( None, 'math.h', 'c' )
+r3 = conf.CheckLib( '%(lib)s', autoadd=0 )
+r4 = conf.CheckLib( None, autoadd=0 )
+r5 = conf.CheckCHeader( 'math.h' )
+r6 = conf.CheckCXXHeader( 'vector' )
+env = conf.Finish()
+if not (r1 and r2 and r3 and r4 and r5 and r6):
+ Exit(1)
+""" % locals())
+
+# Verify correct behavior when we call Decider('timestamp-newer')
+
+test.run()
+test.checkLogAndStdout(["Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C header file math.h... ",
+ "Checking for C++ header file vector... "],
+ ["yes"]*6,
+ [[((".c", NCR), (_obj, NCR), (_exe, NCR))]]*4 +
+ [[((".c", NCR), (_obj, NCR))]] +
+ [[((".cpp", NCR), (_obj, NCR))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+
+test.run()
+test.checkLogAndStdout(["Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C header file math.h... ",
+ "Checking for C++ header file vector... "],
+ ["yes"]*6,
+ [[((".c", CR), (_obj, CR), (_exe, CR))]]*4 +
+ [[((".c", CR), (_obj, CR))]] +
+ [[((".cpp", CR), (_obj, CR))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+# same should be true for the default behavior of Decider('content')
+
+test.run(arguments='target_signatures_content=1 --config=force')
+test.checkLogAndStdout(["Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C header file math.h... ",
+ "Checking for C++ header file vector... "],
+ ["yes"]*6,
+ [[((".c", NCR), (_obj, NCR), (_exe, NCR))]]*4 +
+ [[((".c", NCR), (_obj, NCR))]] +
+ [[((".cpp", NCR), (_obj, NCR))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='target_signatures_content=1')
+test.checkLogAndStdout(["Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C library %s... " % lib,
+ "Checking for C library None... ",
+ "Checking for C header file math.h... ",
+ "Checking for C++ header file vector... "],
+ ["yes"]*6,
+ [[((".c", CR), (_obj, CR), (_exe, CR))]]*4 +
+ [[((".c", CR), (_obj, CR))]] +
+ [[((".cpp", CR), (_obj, CR))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/clean.py b/test/Configure/clean.py
new file mode 100644
index 0000000..bb15165
--- /dev/null
+++ b/test/Configure/clean.py
@@ -0,0 +1,84 @@
+#!/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 we don't perform Configure context actions when the
+-c or --clean options have been specified.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+test.write('SConstruct', """\
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env, clean=int(ARGUMENTS['clean']))
+r1 = conf.CheckCHeader( 'math.h' )
+r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
+env = conf.Finish()
+Export( 'env' )
+SConscript( 'SConscript' )
+""")
+
+test.write('SConscript', """\
+Import( 'env' )
+env.Program( 'TestProgram', 'TestProgram.c' )
+""")
+
+test.write('TestProgram.c', """\
+#include <stdio.h>
+
+int main() {
+ printf( "Hello\\n" );
+}
+""")
+
+lines = [
+ "Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "
+]
+
+test.run(arguments = '-c clean=0')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+test.run(arguments = '-c clean=1')
+test.must_contain_all_lines(test.stdout(), lines)
+
+test.run(arguments = '--clean clean=0')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+test.run(arguments = '--clean clean=1')
+test.must_contain_all_lines(test.stdout(), lines)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/config-h.py b/test/Configure/config-h.py
new file mode 100644
index 0000000..cda6c3b
--- /dev/null
+++ b/test/Configure/config-h.py
@@ -0,0 +1,186 @@
+#!/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 creation of a config.h file from a Configure context.
+"""
+
+import os
+import re
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_exact)
+
+lib = test.Configure_lib
+LIB = "LIB" + lib.upper()
+
+test.write('SConstruct', """\
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env, config_h = 'config.h')
+r1 = conf.CheckFunc('printf')
+r2 = conf.CheckFunc('noFunctionCall')
+r3 = conf.CheckType('int')
+r4 = conf.CheckType('noType')
+r5 = conf.CheckCHeader('stdio.h', '<>')
+r6 = conf.CheckCHeader('hopefullynoc-header.h')
+r7 = conf.CheckCXXHeader('vector', '<>')
+r8 = conf.CheckCXXHeader('hopefullynocxx-header.h')
+env = conf.Finish()
+conf = Configure(env, config_h = 'config.h')
+r9 = conf.CheckLib('%(lib)s', 'sin')
+r10 = conf.CheckLib('hopefullynolib', 'sin')
+r11 = conf.CheckLibWithHeader('%(lib)s', 'math.h', 'c')
+r12 = conf.CheckLibWithHeader('%(lib)s', 'hopefullynoheader2.h', 'c')
+r13 = conf.CheckLibWithHeader('hopefullynolib2', 'math.h', 'c')
+env = conf.Finish()
+""" % locals())
+
+expected_read_str = """\
+Checking for C function printf()... yes
+Checking for C function noFunctionCall()... no
+Checking for C type int... yes
+Checking for C type noType... no
+Checking for C header file stdio.h... yes
+Checking for C header file hopefullynoc-header.h... no
+Checking for C++ header file vector... yes
+Checking for C++ header file hopefullynocxx-header.h... no
+Checking for sin() in C library %(lib)s... yes
+Checking for sin() in C library hopefullynolib... no
+Checking for C library %(lib)s... yes
+Checking for C library %(lib)s... no
+Checking for C library hopefullynolib2... no
+""" % locals()
+
+expected_build_str = """\
+scons: Configure: creating config.h
+"""
+
+expected_stdout = test.wrap_stdout(build_str=expected_build_str,
+ read_str=expected_read_str)
+
+expected_config_h = ("""\
+#ifndef CONFIG_H_SEEN
+#define CONFIG_H_SEEN
+
+
+/* Define to 1 if the system has the function `printf'. */
+#define HAVE_PRINTF 1
+
+/* Define to 1 if the system has the function `noFunctionCall'. */
+/* #undef HAVE_NOFUNCTIONCALL */
+
+/* Define to 1 if the system has the type `int'. */
+#define HAVE_INT 1
+
+/* Define to 1 if the system has the type `noType'. */
+/* #undef HAVE_NOTYPE */
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <hopefullynoc-header.h> header file. */
+/* #undef HAVE_HOPEFULLYNOC_HEADER_H */
+
+/* Define to 1 if you have the <vector> header file. */
+#define HAVE_VECTOR 1
+
+/* Define to 1 if you have the <hopefullynocxx-header.h> header file. */
+/* #undef HAVE_HOPEFULLYNOCXX_HEADER_H */
+
+/* Define to 1 if you have the `%(lib)s' library. */
+#define HAVE_%(LIB)s 1
+
+/* Define to 1 if you have the `hopefullynolib' library. */
+/* #undef HAVE_LIBHOPEFULLYNOLIB */
+
+/* Define to 1 if you have the `%(lib)s' library. */
+#define HAVE_%(LIB)s 1
+
+/* Define to 1 if you have the `%(lib)s' library. */
+/* #undef HAVE_%(LIB)s */
+
+/* Define to 1 if you have the `hopefullynolib2' library. */
+/* #undef HAVE_LIBHOPEFULLYNOLIB2 */
+
+#endif /* CONFIG_H_SEEN */
+""" % locals()).replace("\n", os.linesep)
+
+test.run(stdout=expected_stdout)
+
+config_h = test.read(test.workpath('config.h'))
+if expected_config_h != config_h:
+ print "Unexpected config.h"
+ print "Expected: "
+ print "---------------------------------------------------------"
+ print repr(expected_config_h)
+ print "---------------------------------------------------------"
+ print "Found: "
+ print "---------------------------------------------------------"
+ print repr(config_h)
+ print "---------------------------------------------------------"
+ print "Stdio: "
+ print "---------------------------------------------------------"
+ print test.stdout()
+ print "---------------------------------------------------------"
+ test.fail_test()
+
+expected_read_str = re.sub(r'\b((yes)|(no))\b',
+ r'(cached) \1',
+ expected_read_str)
+expected_build_str = "scons: `.' is up to date.\n"
+expected_stdout = test.wrap_stdout(build_str=expected_build_str,
+ read_str=expected_read_str)
+#expected_stdout = expected_stdout.replace("\n", os.linesep)
+
+test.run(stdout=expected_stdout)
+
+config_h = test.read(test.workpath('config.h'))
+if expected_config_h != config_h:
+ print "Unexpected config.h"
+ print "Expected: "
+ print "---------------------------------------------------------"
+ print repr(expected_config_h)
+ print "---------------------------------------------------------"
+ print "Found: "
+ print "---------------------------------------------------------"
+ print repr(config_h)
+ print "---------------------------------------------------------"
+ print "Stdio: "
+ print "---------------------------------------------------------"
+ print test.stdout()
+ print "---------------------------------------------------------"
+ test.fail_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/Configure/custom-tests.py b/test/Configure/custom-tests.py
new file mode 100644
index 0000000..687ba48
--- /dev/null
+++ b/test/Configure/custom-tests.py
@@ -0,0 +1,201 @@
+#!/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 execution of custom test cases.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+_obj = TestSCons._obj
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+compileOK = '#include <stdio.h>\\nint main() {printf("Hello");return 0;}'
+compileFAIL = "syntax error"
+linkOK = compileOK
+linkFAIL = "void myFunc(); int main() { myFunc(); }"
+runOK = compileOK
+runFAIL = "int main() { return 1; }"
+
+test.write('pyAct.py', """\
+import sys
+print sys.argv[1]
+sys.exit(int(sys.argv[1]))
+""")
+
+test.write('SConstruct', """\
+def CheckCustom(test):
+ test.Message( 'Executing MyTest ... ' )
+ retCompileOK = test.TryCompile( '%(compileOK)s', '.c' )
+ retCompileFAIL = test.TryCompile( '%(compileFAIL)s', '.c' )
+ retLinkOK = test.TryLink( '%(linkOK)s', '.c' )
+ retLinkFAIL = test.TryLink( '%(linkFAIL)s', '.c' )
+ (retRunOK, outputRunOK) = test.TryRun( '%(runOK)s', '.c' )
+ (retRunFAIL, outputRunFAIL) = test.TryRun( '%(runFAIL)s', '.c' )
+ (retActOK, outputActOK) = test.TryAction( '%(_python_)s pyAct.py 0 > $TARGET' )
+ (retActFAIL, outputActFAIL) = test.TryAction( '%(_python_)s pyAct.py 1 > $TARGET' )
+ resOK = retCompileOK and retLinkOK and retRunOK and outputRunOK=="Hello"
+ resOK = resOK and retActOK and int(outputActOK)==0
+ resFAIL = retCompileFAIL or retLinkFAIL or retRunFAIL or outputRunFAIL!=""
+ resFAIL = resFAIL or retActFAIL or outputActFAIL!=""
+ test.Result( resOK and not resFAIL )
+ return resOK and not resFAIL
+
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure( env, custom_tests={'CheckCustom' : CheckCustom} )
+conf.CheckCustom()
+env = conf.Finish()
+""" % locals())
+
+test.run()
+
+test.checkLogAndStdout(["Executing MyTest ... "],
+ ["yes"],
+ [[(('.c', NCR), (_obj, NCR)),
+ (('.c', NCR), (_obj, NCF)),
+ (('.c', NCR), (_obj, NCR), (_exe, NCR)),
+ (('.c', NCR), (_obj, NCR), (_exe, NCF)),
+ (('.c', NCR), (_obj, NCR), (_exe, NCR), (_exe + '.out', NCR)),
+ (('.c', NCR), (_obj, NCR), (_exe, NCR), (_exe + '.out', NCF)),
+ (('', NCR),),
+ (('', NCF),)]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run()
+
+# Try again to check caching
+test.checkLogAndStdout(["Executing MyTest ... "],
+ ["yes"],
+ [[(('.c', CR), (_obj, CR)),
+ (('.c', CR), (_obj, CF)),
+ (('.c', CR), (_obj, CR), (_exe, CR)),
+ (('.c', CR), (_obj, CR), (_exe, CF)),
+ (('.c', CR), (_obj, CR), (_exe, CR), (_exe + '.out', CR)),
+ (('.c', CR), (_obj, CR), (_exe, CR), (_exe + '.out', CF)),
+ (('', CR),),
+ (('', CF),)]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+# Test other customs:
+test.write('SConstruct', """\
+def CheckList(test):
+ test.Message( 'Display of list ...' )
+ res = [1, 2, 3, 4]
+ test.Result( res )
+ return res
+
+def CheckEmptyList(test):
+ test.Message( 'Display of empty list ...' )
+ res = list()
+ test.Result( res )
+ return res
+
+def CheckRandomStr(test):
+ test.Message( 'Display of random string ...' )
+ res = "a random string"
+ test.Result( res )
+ return res
+
+def CheckEmptyStr(test):
+ test.Message( 'Display of empty string ...' )
+ res = ""
+ test.Result( res )
+ return res
+
+def CheckDict(test):
+ test.Message( 'Display of dictionary ...' )
+ res = {"key1" : 1, "key2" : "text"}
+ test.Result( res )
+ return res
+
+def CheckEmptyDict(test):
+ test.Message( 'Display of empty dictionary ...' )
+ res = dict
+ test.Result( res )
+ return res
+
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure( env, custom_tests={'CheckList' : CheckList,
+ 'CheckEmptyList' : CheckEmptyList,
+ 'CheckRandomStr' : CheckRandomStr,
+ 'CheckEmptyStr' : CheckEmptyStr,
+ 'CheckDict' : CheckDict,
+ 'CheckEmptyDict' : CheckEmptyDict} )
+conf.CheckList()
+conf.CheckEmptyList()
+conf.CheckRandomStr()
+conf.CheckEmptyStr()
+conf.CheckDict()
+conf.CheckEmptyDict()
+env = conf.Finish()
+""" % locals())
+
+test.run()
+
+test.must_match('config.log',
+""".*
+.*
+scons: Configure: Display of list ...
+scons: Configure: \(cached\) yes
+
+scons: Configure: Display of empty list ...
+scons: Configure: \(cached\) no
+
+scons: Configure: Display of random string ...
+scons: Configure: \(cached\) a random string
+
+scons: Configure: Display of empty string ...
+scons: Configure: \(cached\) *
+
+scons: Configure: Display of dictionary ...
+scons: Configure: \(cached\) yes
+
+scons: Configure: Display of empty dictionary ...
+scons: Configure: \(cached\) yes
+
+
+""",
+match=TestSCons.match_re)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/from-SConscripts.py b/test/Configure/from-SConscripts.py
new file mode 100644
index 0000000..59eba53
--- /dev/null
+++ b/test/Configure/from-SConscripts.py
@@ -0,0 +1,63 @@
+#!/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__"
+
+"""
+Make sure we can call Configure() from subsidiary SConscript calls.
+
+This was broken at one point when we were using the internal
+sconscript_reading flag (which is basically a hint for whether or not
+we're in a Builder call) as a semaphore, not a counter.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+env = SConscript('x.scons')
+""")
+
+test.write('x.scons', """\
+env = SConscript('y.scons')
+config = env.Configure()
+env = config.Finish()
+Return('env')
+""")
+
+test.write('y.scons', """\
+env = Environment()
+Return('env')
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/help.py b/test/Configure/help.py
new file mode 100644
index 0000000..f42088b
--- /dev/null
+++ b/test/Configure/help.py
@@ -0,0 +1,94 @@
+#!/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 we don't perform Configure context actions when the
+-H, -h or --help options have been specified.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+
+test.write('SConstruct', """\
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env, help=int(ARGUMENTS['help']))
+r1 = conf.CheckCHeader( 'math.h' )
+r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
+env = conf.Finish()
+Export( 'env' )
+SConscript( 'SConscript' )
+""")
+
+test.write('SConscript', """\
+Import( 'env' )
+env.Program( 'TestProgram', 'TestProgram.c' )
+""")
+
+test.write('TestProgram.c', """\
+#include <stdio.h>
+
+int main() {
+ printf( "Hello\\n" );
+}
+""")
+
+lines = [
+ "Checking for C header file math.h... ",
+ "Checking for C header file no_std_c_header.h... "
+]
+
+# The help setting should have no effect on -H, so the -H output
+# should never contain the lines.
+test.run(arguments = '-H help=0')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+test.run(arguments = '-H help=1')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+# For -h and --help, the lines appear or not depending on how Configure()
+# is initialized.
+test.run(arguments = '-h help=0')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+test.run(arguments = '-h help=1')
+test.must_contain_all_lines(test.stdout(), lines)
+
+test.run(arguments = '--help help=0')
+test.must_not_contain_any_line(test.stdout(), lines)
+
+test.run(arguments = '--help help=1')
+test.must_contain_all_lines(test.stdout(), lines)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/implicit-cache.py b/test/Configure/implicit-cache.py
new file mode 100644
index 0000000..0f04b1e
--- /dev/null
+++ b/test/Configure/implicit-cache.py
@@ -0,0 +1,109 @@
+#!/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()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/option--Q.py b/test/Configure/option--Q.py
new file mode 100644
index 0000000..198e94f
--- /dev/null
+++ b/test/Configure/option--Q.py
@@ -0,0 +1,52 @@
+#!/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 the -Q option suppresses Configure context output.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+env = Environment()
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env)
+r1 = conf.CheckCHeader('stdio.h')
+env = conf.Finish()
+""")
+
+test.run(arguments='-Q', stdout="scons: `.' is up to date.\n", stderr="")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py
new file mode 100644
index 0000000..1f40a80
--- /dev/null
+++ b/test/Configure/option--config.py
@@ -0,0 +1,131 @@
+#!/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 the --config=<auto|force|cache> option.
+"""
+
+import os.path
+
+import TestSCons
+
+_obj = TestSCons._obj
+
+test = TestSCons.TestSCons()
+
+test.subdir('include')
+
+NCR = test.NCR # non-cached rebuild
+CR = test.CR # cached rebuild (up to date)
+NCF = test.NCF # non-cached build failure
+CF = test.CF # cached build failure
+
+SConstruct_path = test.workpath('SConstruct')
+
+test.write(SConstruct_path, """
+env = Environment(CPPPATH='#/include')
+import os
+env.AppendENVPath('PATH', os.environ['PATH'])
+conf = Configure(env)
+conf.CheckCHeader('non_system_header0.h')
+conf.CheckCHeader('non_system_header1.h')
+env = conf.Finish()
+""")
+
+test.write(['include', 'non_system_header0.h'], """
+/* A header */
+""")
+
+conftest_0_c = os.path.join(".sconf_temp", "conftest_0.c")
+SConstruct_file_line = test.python_file_line(SConstruct_path, 6)[:-1]
+
+expect = """
+scons: *** "%(conftest_0_c)s" is not yet built and cache is forced.
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments='--config=cache', status=2, stderr=expect)
+
+test.run(arguments='--config=auto')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["yes", "no"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='--config=auto')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='--config=force')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["yes", "no"],
+ [[((".c", NCR), (_obj, NCR))],
+ [((".c", NCR), (_obj, NCF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='--config=cache')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.write(['include', 'non_system_header1.h'], """
+/* Another header */
+""")
+test.unlink(['include', 'non_system_header0.h'])
+
+test.run(arguments='--config=cache')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["yes", "no"],
+ [[((".c", CR), (_obj, CR))],
+ [((".c", CR), (_obj, CF))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.run(arguments='--config=auto')
+test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ",
+ "Checking for C header file non_system_header1.h... "],
+ ["no", "yes"],
+ [[((".c", CR), (_obj, NCF))],
+ [((".c", CR), (_obj, NCR))]],
+ "config.log", ".sconf_temp", "SConstruct")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: