summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Actions/function.py4
-rw-r--r--test/Actions/unicode-signature.py65
-rw-r--r--test/CXX/CCFLAGS.py68
-rw-r--r--test/CXX/CXXCOM.py5
-rw-r--r--test/CXX/CXXCOMSTR.py5
-rw-r--r--test/CXX/SHCXXCOM.py5
-rw-r--r--test/CXX/SHCXXCOMSTR.py5
-rw-r--r--test/Case.py4
-rw-r--r--test/Configure/VariantDir-SConscript.py2
-rw-r--r--test/Copy-Option.py12
-rw-r--r--test/Deprecated/Copy-Method.py (renamed from test/Deprecated/Copy.py)0
-rw-r--r--test/Deprecated/Options/BoolOption.py (renamed from test/Options/BoolOption.py)0
-rw-r--r--test/Deprecated/Options/EnumOption.py (renamed from test/Options/EnumOption.py)0
-rw-r--r--test/Deprecated/Options/ListOption.py (renamed from test/Options/ListOption.py)5
-rw-r--r--test/Deprecated/Options/Options.py (renamed from test/Options/Options.py)0
-rw-r--r--test/Deprecated/Options/PackageOption.py (renamed from test/Options/PackageOption.py)0
-rw-r--r--test/Deprecated/Options/PathOption.py (renamed from test/Options/PathOption.py)0
-rw-r--r--test/Deprecated/Options/chdir.py (renamed from test/Options/chdir.py)0
-rw-r--r--test/Deprecated/Options/help.py (renamed from test/Options/help.py)0
-rw-r--r--test/Deprecated/Options/import.py (renamed from test/Options/import.py)0
-rw-r--r--test/Deprecated/debug-stree.py4
-rw-r--r--test/Fortran/F77COMSTR.py2
-rw-r--r--test/Fortran/F90COMSTR.py3
-rw-r--r--test/Fortran/F95COMSTR.py2
-rw-r--r--test/Fortran/FORTRANCOMSTR.py2
-rw-r--r--test/Fortran/SHF77COMSTR.py2
-rw-r--r--test/Fortran/SHF90COMSTR.py2
-rw-r--r--test/Fortran/SHF95COMSTR.py2
-rw-r--r--test/Fortran/SHFORTRANCOMSTR.py2
-rw-r--r--test/Interactive/taskmastertrace.py23
-rw-r--r--test/Interactive/tree.py2
-rw-r--r--test/Interactive/variant_dir.py115
-rw-r--r--test/Interactive/version.py4
-rw-r--r--test/Java/multi-step.py2
-rw-r--r--test/KeyboardInterrupt.py94
-rw-r--r--test/LoadableModule.py9
-rw-r--r--test/Parallel/multiple-parents.py173
-rw-r--r--test/QT/Tool.py4
-rw-r--r--test/SConscript/Return.py12
-rw-r--r--test/SWIG/subdir.py113
-rw-r--r--test/Variables/BoolVariable.py87
-rw-r--r--test/Variables/EnumVariable.py102
-rw-r--r--test/Variables/ListVariable.py172
-rw-r--r--test/Variables/PackageVariable.py89
-rw-r--r--test/Variables/PathVariable.py285
-rw-r--r--test/Variables/Variables.py364
-rw-r--r--test/Variables/chdir.py71
-rw-r--r--test/Variables/help.py151
-rw-r--r--test/Variables/import.py69
-rw-r--r--test/YACC/live.py2
-rw-r--r--test/dependency-cycle.py5
-rw-r--r--test/duplicate-sources.py55
-rw-r--r--test/exceptions.py4
-rw-r--r--test/no-global-dependencies.py8
-rw-r--r--test/option-v.py4
-rw-r--r--test/option/d.py (renamed from test/option-d.py)13
-rw-r--r--test/option/environment-overrides.py (renamed from test/option-e.py)10
-rw-r--r--test/option/help-options.py (renamed from test/option--H.py)22
-rw-r--r--test/option/no-print-directory.py (renamed from test/option--npd.py)8
-rw-r--r--test/option/print-directory.py (renamed from test/option-w.py)10
-rw-r--r--test/option/taskmastertrace.py100
-rw-r--r--test/option/tree-all.py24
-rw-r--r--test/option/tree-lib.py4
-rw-r--r--test/symlink/dangling-include.py2
64 files changed, 2281 insertions, 132 deletions
diff --git a/test/Actions/function.py b/test/Actions/function.py
index 00aa688..5e755a8 100644
--- a/test/Actions/function.py
+++ b/test/Actions/function.py
@@ -41,8 +41,8 @@ import re
import SCons.Action
import SCons.Builder
-options = Options()
-options.AddOptions(
+options = Variables()
+options.AddVariables(
('header', 'Header string (default cell argument)', 'Head:'),
('trailer', 'Trailer string (default cell argument)', 'Tail'),
('NbDeps', 'Number of dependencies', '2'),
diff --git a/test/Actions/unicode-signature.py b/test/Actions/unicode-signature.py
new file mode 100644
index 0000000..dd7f883
--- /dev/null
+++ b/test/Actions/unicode-signature.py
@@ -0,0 +1,65 @@
+#!/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 an Action list with a string command containing a Unicode file
+name, and a Python function action, works corectly. This verifies that
+the signatures of the two actions can be concatenated without encoding
+Unicode problems.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+try:
+ unicode
+except NameError:
+ import sys
+ msg = "Unicode not supported by Python version %s; skipping test\n"
+ test.skip_test(msg % sys.version[:3])
+
+test.write('SConstruct', """
+fnode = File(u'foo.txt')
+
+def funcact(target, source, env):
+ open(str(target[0]), 'wb').write("funcact\\n")
+ for i in range(300):
+ pass
+ return 0
+
+env = Environment()
+
+env.Command(fnode, [], ["echo $TARGET", funcact])
+""")
+
+test.run(arguments = '.')
+
+test.must_match('foo.txt', "funcact\n")
+
+test.up_to_date(arguments = '.')
+
+test.pass_test()
diff --git a/test/CXX/CCFLAGS.py b/test/CXX/CCFLAGS.py
new file mode 100644
index 0000000..a559de3
--- /dev/null
+++ b/test/CXX/CCFLAGS.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__"
+
+"""
+Verify that we can set both $CCFLAGS and $CXXFLAGS and have them
+both show up on the compilation lines for C++ source files.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+foo = Environment(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX')
+bar = Environment(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)
+bar.Program(target = 'bar', source = bar_obj)
+""")
+
+test.write('prog.cpp', r"""
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+#ifdef FOO
+ printf("prog.c: FOO\n");
+#endif
+#ifdef BAR
+ printf("prog.c: BAR\n");
+#endif
+ exit (0);
+}
+""")
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
+test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+
+test.pass_test()
diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py
index c98fb8c..5fc40d0 100644
--- a/test/CXX/CXXCOM.py
+++ b/test/CXX/CXXCOM.py
@@ -49,10 +49,7 @@ for l in filter(lambda l: l[:7] != '/*c++*/', infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cpp_suffix = '.cpp'
-else:
- alt_cpp_suffix = '.C'
+alt_cpp_suffix=test.get_alt_cpp_suffix()
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE',
diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py
index 23bd3e6..df4a87b 100644
--- a/test/CXX/CXXCOMSTR.py
+++ b/test/CXX/CXXCOMSTR.py
@@ -50,10 +50,7 @@ for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cpp_suffix = '.cpp'
-else:
- alt_cpp_suffix = '.C'
+alt_cpp_suffix=test.get_alt_cpp_suffix()
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE',
diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py
index 600049e..628bc00 100644
--- a/test/CXX/SHCXXCOM.py
+++ b/test/CXX/SHCXXCOM.py
@@ -49,10 +49,7 @@ for l in filter(lambda l: l[:7] != '/*c++*/', infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cpp_suffix = '.cpp'
-else:
- alt_cpp_suffix = '.C'
+alt_cpp_suffix=test.get_alt_cpp_suffix()
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE',
diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py
index 8e55441..dd92541 100644
--- a/test/CXX/SHCXXCOMSTR.py
+++ b/test/CXX/SHCXXCOMSTR.py
@@ -50,10 +50,7 @@ for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cpp_suffix = '.cpp'
-else:
- alt_cpp_suffix = '.C'
+alt_cpp_suffix=test.get_alt_cpp_suffix()
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE',
diff --git a/test/Case.py b/test/Case.py
index 663aa40..4f08927 100644
--- a/test/Case.py
+++ b/test/Case.py
@@ -65,8 +65,8 @@ void bar() {
}
""")
-if sys.platform == 'darwin':
- test.skip_test("Skipping test on Darwin/OSX; it has partial case sensitivity.")
+if sys.platform[:6] == 'darwin':
+ test.skip_test("Skipping test on Darwin/OSX; it has partial case sensitivity.\n")
if sys.platform in ['cygwin', 'win32']:
sys.stdout.write("Using case-insensitive filesystem, testing for failure\n")
diff --git a/test/Configure/VariantDir-SConscript.py b/test/Configure/VariantDir-SConscript.py
index a9371f9..1fffacf 100644
--- a/test/Configure/VariantDir-SConscript.py
+++ b/test/Configure/VariantDir-SConscript.py
@@ -45,7 +45,7 @@ NCF = test.NCF # non-cached build failure
CF = test.CF # cached build failure
test.write('SConstruct', """\
-opts = Options()
+opts = Variables()
opts.Add('chdir')
env = Environment(options=opts)
if env['chdir'] == 'yes':
diff --git a/test/Copy-Option.py b/test/Copy-Option.py
index 25b6054..9896762 100644
--- a/test/Copy-Option.py
+++ b/test/Copy-Option.py
@@ -25,7 +25,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Test that setting Options in an Environment doesn't prevent the
+Test that setting Variables in an Environment doesn't prevent the
Environment from being copied.
"""
@@ -37,11 +37,11 @@ test.write('SConstruct', """
gpib_options = ['NI_GPIB', 'NI_ENET']
gpib_include = '/'
-#0.96 broke copying ListOptions ???
-opts = Options('config.py', ARGUMENTS)
-opts.AddOptions(
- BoolOption('gpib', 'enable gpib support', 1),
- ListOption('gpib_options',
+#0.96 broke copying ListVariables ???
+opts = Variables('config.py', ARGUMENTS)
+opts.AddVariables(
+ BoolVariable('gpib', 'enable gpib support', 1),
+ ListVariable('gpib_options',
'whether and what kind of gpib support shall be enabled',
'all',
gpib_options),
diff --git a/test/Deprecated/Copy.py b/test/Deprecated/Copy-Method.py
index f17fc9f..f17fc9f 100644
--- a/test/Deprecated/Copy.py
+++ b/test/Deprecated/Copy-Method.py
diff --git a/test/Options/BoolOption.py b/test/Deprecated/Options/BoolOption.py
index 38b30d5..38b30d5 100644
--- a/test/Options/BoolOption.py
+++ b/test/Deprecated/Options/BoolOption.py
diff --git a/test/Options/EnumOption.py b/test/Deprecated/Options/EnumOption.py
index 610a485..610a485 100644
--- a/test/Options/EnumOption.py
+++ b/test/Deprecated/Options/EnumOption.py
diff --git a/test/Options/ListOption.py b/test/Deprecated/Options/ListOption.py
index 5611e40..68d2ee8 100644
--- a/test/Options/ListOption.py
+++ b/test/Deprecated/Options/ListOption.py
@@ -34,6 +34,7 @@ import string
import TestSCons
+
test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
@@ -80,7 +81,9 @@ 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)
+test.must_match(test.workpath('scons.options'),
+ "shared = 'all'"+os.linesep,
+ mode='r')
check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
"['gl ical qt x11']"])
diff --git a/test/Options/Options.py b/test/Deprecated/Options/Options.py
index 11452b1..11452b1 100644
--- a/test/Options/Options.py
+++ b/test/Deprecated/Options/Options.py
diff --git a/test/Options/PackageOption.py b/test/Deprecated/Options/PackageOption.py
index 79d4dda..79d4dda 100644
--- a/test/Options/PackageOption.py
+++ b/test/Deprecated/Options/PackageOption.py
diff --git a/test/Options/PathOption.py b/test/Deprecated/Options/PathOption.py
index 23fec6e..23fec6e 100644
--- a/test/Options/PathOption.py
+++ b/test/Deprecated/Options/PathOption.py
diff --git a/test/Options/chdir.py b/test/Deprecated/Options/chdir.py
index 7ba85ea..7ba85ea 100644
--- a/test/Options/chdir.py
+++ b/test/Deprecated/Options/chdir.py
diff --git a/test/Options/help.py b/test/Deprecated/Options/help.py
index d3fa9ad..d3fa9ad 100644
--- a/test/Options/help.py
+++ b/test/Deprecated/Options/help.py
diff --git a/test/Options/import.py b/test/Deprecated/Options/import.py
index 0a3d367..0a3d367 100644
--- a/test/Options/import.py
+++ b/test/Deprecated/Options/import.py
diff --git a/test/Deprecated/debug-stree.py b/test/Deprecated/debug-stree.py
index 8907c6c..9b6e067 100644
--- a/test/Deprecated/debug-stree.py
+++ b/test/Deprecated/debug-stree.py
@@ -100,7 +100,7 @@ stree = """
test.run(arguments = "--debug=stree foo.xxx",
stderr = stderr)
-test.fail_test(string.find(test.stdout(), stree) == -1)
+test.fail_test(string.count(test.stdout(), stree) != 1)
stree2 = """
E = exists
@@ -132,6 +132,6 @@ test.run(arguments = '-c foo.xxx')
test.run(arguments = "--no-exec --debug=stree foo.xxx",
stderr = stderr)
-test.fail_test(string.find(test.stdout(), stree2) == -1)
+test.fail_test(string.count(test.stdout(), stree2) != 1)
test.pass_test()
diff --git a/test/Fortran/F77COMSTR.py b/test/Fortran/F77COMSTR.py
index 7f6f1a1..b8a5e44 100644
--- a/test/Fortran/F77COMSTR.py
+++ b/test/Fortran/F77COMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f77pp = 'f77'
else:
f77pp = 'f77pp'
diff --git a/test/Fortran/F90COMSTR.py b/test/Fortran/F90COMSTR.py
index e2e3cf5..27fd332 100644
--- a/test/Fortran/F90COMSTR.py
+++ b/test/Fortran/F90COMSTR.py
@@ -45,12 +45,11 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f90pp = 'f90'
else:
f90pp = 'f90pp'
-
test.write('SConstruct', """
env = Environment(F90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES',
F90COMSTR = 'Building f90 $TARGET from $SOURCES',
diff --git a/test/Fortran/F95COMSTR.py b/test/Fortran/F95COMSTR.py
index ed7d1e8..371fbd5 100644
--- a/test/Fortran/F95COMSTR.py
+++ b/test/Fortran/F95COMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f95pp = 'f95'
else:
f95pp = 'f95pp'
diff --git a/test/Fortran/FORTRANCOMSTR.py b/test/Fortran/FORTRANCOMSTR.py
index fd318c3..f942669 100644
--- a/test/Fortran/FORTRANCOMSTR.py
+++ b/test/Fortran/FORTRANCOMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
fortranpp = 'fortran'
else:
fortranpp = 'fortranpp'
diff --git a/test/Fortran/SHF77COMSTR.py b/test/Fortran/SHF77COMSTR.py
index 2bedb48..4f08e26 100644
--- a/test/Fortran/SHF77COMSTR.py
+++ b/test/Fortran/SHF77COMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f77pp = 'f77'
else:
f77pp = 'f77pp'
diff --git a/test/Fortran/SHF90COMSTR.py b/test/Fortran/SHF90COMSTR.py
index 08208fa..2d512a5 100644
--- a/test/Fortran/SHF90COMSTR.py
+++ b/test/Fortran/SHF90COMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f90pp = 'f90'
else:
f90pp = 'f90pp'
diff --git a/test/Fortran/SHF95COMSTR.py b/test/Fortran/SHF95COMSTR.py
index 71a5627..ebefac4 100644
--- a/test/Fortran/SHF95COMSTR.py
+++ b/test/Fortran/SHF95COMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
f95pp = 'f95'
else:
f95pp = 'f95pp'
diff --git a/test/Fortran/SHFORTRANCOMSTR.py b/test/Fortran/SHFORTRANCOMSTR.py
index 52b20c2..13e76e3 100644
--- a/test/Fortran/SHFORTRANCOMSTR.py
+++ b/test/Fortran/SHFORTRANCOMSTR.py
@@ -45,7 +45,7 @@ for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
sys.exit(0)
""")
-if os.path.normcase('.f') == os.path.normcase('.F'):
+if not TestSCons.case_sensitive_suffixes('.f','.F'):
fortranpp = 'fortran'
else:
fortranpp = 'fortranpp'
diff --git a/test/Interactive/taskmastertrace.py b/test/Interactive/taskmastertrace.py
index 23b9ad9..f0ff81f 100644
--- a/test/Interactive/taskmastertrace.py
+++ b/test/Interactive/taskmastertrace.py
@@ -69,15 +69,22 @@ scons.send("build foo.out\n")
expect_stdout = """\
scons>>> Copy("foo.out", "foo.in")
Touch("1")
-scons>>> Taskmaster: 'foo.out': children:
- ['foo.in']
- waiting on unfinished children:
- ['foo.in']
-Taskmaster: 'foo.in': evaluating foo.in
-Taskmaster: 'foo.out': children:
- ['foo.in']
- evaluating foo.out
+scons>>>
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'foo.out'> and its children:
+Taskmaster: <no_state 'foo.in'>
+Taskmaster: Considering node <no_state 'foo.in'> and its children:
+Taskmaster: Evaluating <pending 'foo.in'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <pending 'foo.out'> and its children:
+Taskmaster: <up_to_date 'foo.in'>
+Taskmaster: Evaluating <pending 'foo.out'>
Copy("foo.out", "foo.in")
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: No candidate anymore.
+
scons>>> Touch("2")
scons>>> scons: `foo.out' is up to date.
scons>>>
diff --git a/test/Interactive/tree.py b/test/Interactive/tree.py
index 96e7d4a..fcf35c6 100644
--- a/test/Interactive/tree.py
+++ b/test/Interactive/tree.py
@@ -79,8 +79,6 @@ scons>>> Copy("foo.out", "foo.in")
+-foo.in
scons>>> Touch("2")
scons>>> scons: `foo.out' is up to date.
-+-foo.out
- +-foo.in
scons>>>
"""
diff --git a/test/Interactive/variant_dir.py b/test/Interactive/variant_dir.py
new file mode 100644
index 0000000..7de25cc
--- /dev/null
+++ b/test/Interactive/variant_dir.py
@@ -0,0 +1,115 @@
+#!/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__"
+
+"""
+XXX Put a description of the test here.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('markers',
+ 'work',
+ ['work', 'sub1'])
+
+marker_1 = test.workpath('markers', '1')
+marker_2 = test.workpath('markers', '2')
+
+test.write(['work', 'SConstruct'], """\
+# build the plugin binaries
+basepath = str(Dir('#').abspath)
+env = Environment()
+env.Append(BASEPATH=basepath)
+env.Append(ENV = {'BASEPATH' : str(Dir('#').abspath)})
+SConscript( 'sub1/SConscript',
+ variant_dir = 'build',
+ duplicate=False,
+ exports='env')
+Command(r'%(marker_1)s', [], Touch('$TARGET'))
+Command(r'%(marker_2)s', [], Touch('$TARGET'))
+""" % locals())
+
+test.write(['work', 'sub1', 'SConscript'], """\
+Import('env')
+env.Program('hello.c')
+""")
+
+test.write(['work', 'sub1', 'hello.c'], """\
+#include <stdio.h>
+#include <stdlib.h>
+int main( int iArgC, char *cpArgV[] )
+{
+ printf("hello\\n");
+ exit (0);
+}
+""")
+
+
+
+# The "chdir =" keyword argument in the test.start() call has no effect.
+# Work around it for now.
+import os
+os.chdir('work/sub1')
+scons = test.start(chdir = 'work/sub1', arguments = '-Q -u --interactive')
+
+scons.send("shell pwd\n")
+
+scons.send("build\n")
+
+scons.send("build %s\n" % marker_1)
+
+test.wait_for(marker_1)
+
+test.run(program = test.workpath('work/build/hello'), stdout="hello\n")
+
+
+
+test.write(['work', 'sub1', 'hello.c'], """\
+#include <stdio.h>
+#include <stdlib.h>
+int main( int iArgC, char *cpArgV[] )
+{
+ printf("hello 2\\n");
+ exit (0);
+}
+""")
+
+scons.send("build\n")
+
+scons.send("build %s\n" % marker_2)
+
+test.wait_for(marker_2)
+
+test.run(program = test.workpath('work/build/hello'), stdout="hello 2\n")
+
+
+
+test.finish(scons)
+
+
+
+test.pass_test()
diff --git a/test/Interactive/version.py b/test/Interactive/version.py
index 84f70e8..37163a3 100644
--- a/test/Interactive/version.py
+++ b/test/Interactive/version.py
@@ -40,11 +40,9 @@ test.write('SConstruct', "")
# by the packaging build.
copyright_marker = '__' + 'COPYRIGHT' + '__'
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007'
-
fmt = '(%s|Copyright \\(c\\) %s The SCons Foundation)\n'
-copyright_line = fmt % (copyright_marker, copyright_years)
+copyright_line = fmt % (copyright_marker, TestSCons.copyright_years)
diff --git a/test/Java/multi-step.py b/test/Java/multi-step.py
index cfa6906..b5f24f9 100644
--- a/test/Java/multi-step.py
+++ b/test/Java/multi-step.py
@@ -83,7 +83,7 @@ env.Append(CPPPATH='.')
env.VariantDir('buildout', 'src', duplicate=0)
-if sys.platform=='darwin':
+if sys.platform[:6]=='darwin':
env.Append(CPPPATH=['/System/Library/Frameworks/JavaVM.framework/Headers'])
#If you do not have swig on your system please remove 'buildout/jni/SConscript' line from next call
diff --git a/test/KeyboardInterrupt.py b/test/KeyboardInterrupt.py
new file mode 100644
index 0000000..25239b5
--- /dev/null
+++ b/test/KeyboardInterrupt.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 handle keyboard interrupts (CTRL-C) correctly.
+"""
+
+import os
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+if 'killpg' not in dir(os) or 'setpgrp' not in dir(os):
+ test.skip_test("This Python version does not support killing process groups; skipping test.\n")
+
+test.write('toto.c', r"""
+void foo()
+{}
+""")
+
+test.write('SConstruct', r"""
+import os
+import signal
+
+# Make sure that SCons is a process group leader.
+os.setpgrp()
+
+all = []
+
+def explode(env, target, source):
+ os.killpg(0, signal.SIGINT)
+
+for i in xrange(40):
+ all += Object('toto%5d' % i, 'toto.c')
+
+all+= Command( 'broken', 'toto.c', explode)
+
+Default( Alias('all', all))
+"""
+)
+
+interruptedStr = """\
+.*\
+scons: Build interrupted\\.
+.*\
+scons: building terminated because of errors\\.
+.*\
+scons: writing .sconsign file\\.
+.*\
+"""
+
+def runtest(arguments):
+ test.run(arguments='-c')
+ test.run(arguments=arguments, status=2,
+ stdout=interruptedStr, stderr=r'.*', match=TestSCons.match_re_dotall)
+
+for i in range(2):
+ runtest('-j1')
+ runtest('-j4')
+ runtest('-j8')
+ runtest('-j16')
+ runtest('-j32')
+ runtest('-j64')
+
+ runtest('-j1 --random')
+ runtest('-j4 --random')
+ runtest('-j8 --random')
+ runtest('-j16 --random')
+ runtest('-j32 --random')
+ runtest('-j64 --random')
diff --git a/test/LoadableModule.py b/test/LoadableModule.py
index 4a8e1ed..1c4ae31 100644
--- a/test/LoadableModule.py
+++ b/test/LoadableModule.py
@@ -42,6 +42,7 @@ use_dl_lib = "env.Program(target = 'dlopenprog', source = 'dlopenprog.c', LIBS=[
dlopen_line = {
'darwin' : no_dl_lib,
+ 'darwin8' : no_dl_lib, # ONLY NEEDED FOR 1.5.2
'freebsd4' : no_dl_lib,
'linux2' : use_dl_lib,
}
@@ -53,7 +54,7 @@ env = Environment()
env.LoadableModule(target = 'foo1', source = 'f1.c')
""" + dlopen_line.get(sys.platform, ''))
-
+
test.write('f1.c', r"""
#include <stdio.h>
@@ -91,9 +92,9 @@ main(int argc, char *argv[])
}
"""
-# Darwin dlopen()s a bundle name "foo1",
+# Darwin dlopen()s a bundle named "foo1",
# other systems dlopen() a traditional libfoo1.so file.
-foo1_name = {'darwin' : 'foo1'}.get(sys.platform, dll_+'foo1'+_dll)
+foo1_name = {'darwin' : 'foo1'}.get(sys.platform[:6], dll_+'foo1'+_dll)
test.write('dlopenprog.c',
string.replace(dlopenprog, '__foo1_name__', foo1_name))
@@ -112,7 +113,7 @@ if sys.platform in platforms_with_dlopen:
os.environ['LD_LIBRARY_PATH'] = test.workpath()
test.run(program = test.workpath('dlopenprog'),
stdout = "f1.c\ndlopenprog.c\n")
-
+
test.pass_test()
diff --git a/test/Parallel/multiple-parents.py b/test/Parallel/multiple-parents.py
new file mode 100644
index 0000000..f81adf5
--- /dev/null
+++ b/test/Parallel/multiple-parents.py
@@ -0,0 +1,173 @@
+#!/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.
+#
+
+"""
+Verify that a failed build action with -j works as expected.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+try:
+ import threading
+except ImportError:
+ # if threads are not supported, then
+ # there is nothing to test
+ TestCmd.no_result()
+ sys.exit()
+
+
+test = TestSCons.TestSCons()
+
+# Test that we can handle parallel builds with a dependency graph
+# where:
+# a) Some nodes have multiple parents
+# b) Some targets fail building
+# c) Some targets succeed building
+# d) Some children are ignored
+# e) Some children are pre-requesites
+# f) Some sources are missing
+
+test.write('SConstruct', """
+def fail_action(target = None, source = None, env = None):
+ return 2
+
+failed0 = Command(target='failed00', source='', action=fail_action)
+ok0 = Command(target='ok00', source='', action=Touch('${TARGET}'))
+prereq0 = Command(target='prereq00', source='', action=Touch('${TARGET}'))
+ignore0 = Command(target='ignore00', source='', action=Touch('${TARGET}'))
+igreq0 = Command(target='igreq00', source='', action=Touch('${TARGET}'))
+missing0 = Command(target='missing00', source='MissingSrc', action=Touch('${TARGET}'))
+
+prev_level = failed0 + ok0 + ignore0
+prev_prereq = prereq0
+prev_ignore = ignore0
+prev_igreq = igreq0
+
+for i in range(1,20):
+
+ failed = Command(target='failed%02d' % i, source='', action=fail_action)
+ ok = Command(target='ok%02d' % i, source='', action=Touch('${TARGET}'))
+ prereq = Command(target='prereq%02d' % i, source='', action=Touch('${TARGET}'))
+ ignore = Command(target='ignore%02d' % i, source='', action=Touch('${TARGET}'))
+ igreq = Command(target='igreq%02d' % i, source='', action=Touch('${TARGET}'))
+ missing = Command(target='missing%02d' %i, source='MissingSrc', action=Touch('${TARGET}'))
+
+ next_level = failed + ok + ignore + igreq + missing
+
+ for j in range(1,10):
+ a = Alias('a%02d%02d' % (i,j), prev_level)
+
+ Requires(a, prev_prereq)
+ Ignore(a, prev_ignore)
+
+ Requires(a, prev_igreq)
+ Ignore(a, prev_igreq)
+
+ next_level = next_level + a
+
+ prev_level = next_level
+ prev_prereq = prereq
+ prev_ignore = ignore
+ prev_igreq = igreq
+
+all = Alias('all', prev_level)
+
+Requires(all, prev_prereq)
+Ignore(all, prev_ignore)
+
+Requires(all, prev_igreq)
+Ignore(all, prev_igreq)
+
+Default(all)
+""")
+
+re_error = """\
+(scons: \\*\\*\\* \\[failed\\d+] Error 2\\n)|\
+(scons: \\*\\*\\* Source `MissingSrc' not found, needed by target `missing\\d+'\\.( Stop\\.)?\\n)\
+"""
+
+re_errors = "(" + re_error + ")+"
+
+test.run(arguments = 'all',
+ status = 2,
+ stderr = "scons: *** [failed19] Error 2\n")
+test.must_not_exist(test.workpath('ok'))
+
+
+for i in range(5):
+ test.run(arguments = '-c all')
+
+ test.run(arguments = '-j8 all',
+ status = 2,
+ stderr = re_errors,
+ match=TestSCons.match_re_dotall)
+
+
+for i in range(5):
+ test.run(arguments = '-c all')
+
+ test.run(arguments = '-j 8 -k all',
+ status = 2,
+ stderr = re_errors,
+ match=TestSCons.match_re_dotall)
+ for i in range(20):
+ test.must_exist(test.workpath('ok%02d' % i))
+ test.must_exist(test.workpath('prereq%02d' % i))
+ test.must_not_exist(test.workpath('ignore%02d' % i))
+ test.must_exist(test.workpath('igreq%02d' % i))
+
+
+for i in range(5):
+ test.run(arguments = 'all --random',
+ status = 2,
+ stderr = re_errors,
+ match=TestSCons.match_re_dotall)
+ test.must_not_exist(test.workpath('ok'))
+
+for i in range(5):
+ test.run(arguments = '-c all')
+
+ test.run(arguments = '-j8 --random all',
+ status = 2,
+ stderr = re_errors,
+ match=TestSCons.match_re_dotall)
+
+for i in range(5):
+ test.run(arguments = '-c all')
+
+ test.run(arguments = '-j 8 -k --random all',
+ status = 2,
+ stderr = re_errors,
+ match=TestSCons.match_re_dotall)
+ for i in range(20):
+ test.must_exist(test.workpath('ok%02d' % i))
+ test.must_exist(test.workpath('prereq%02d' % i))
+ test.must_not_exist(test.workpath('ignore%02d' % i))
+ test.must_exist(test.workpath('igreq%02d' % i))
+
+test.pass_test()
diff --git a/test/QT/Tool.py b/test/QT/Tool.py
index 3ccabf7..6c4a2eb 100644
--- a/test/QT/Tool.py
+++ b/test/QT/Tool.py
@@ -133,8 +133,8 @@ def AttemptLinkWithVariables(context, variables, code, extension, prefix):
env = Environment(CPPPATH=['.'], LIBPATH=['.'], LIBS=[])
-opts = Options('lprof.conf')
-opts.Add(PathOption("qt_directory", "Path to Qt directory", "/"))
+opts = Variables('lprof.conf')
+opts.Add(PathVariable("qt_directory", "Path to Qt directory", "/"))
opts.Update(env)
env['QT_LIB'] = 'qt-mt'
diff --git a/test/SConscript/Return.py b/test/SConscript/Return.py
index 453c0b8..2ef4559 100644
--- a/test/SConscript/Return.py
+++ b/test/SConscript/Return.py
@@ -38,11 +38,14 @@ SConscript('SConscript1')
x = SConscript('SConscript2')
y, z = SConscript('SConscript3')
a4, b4 = SConscript('SConscript4')
+foo, bar = SConscript('SConscript5')
print "x =", x
print "y =", y
print "z =", z
print "a4 =", a4
print "b4 =", b4
+print "foo =", foo
+print "bar =", bar
""")
test.write('SConscript1', """\
@@ -75,6 +78,13 @@ b4 = 'b-after'
print "line 8"
""")
+test.write('SConscript5', """\
+foo = 'foo'
+bar = 'bar'
+Return(["foo", "bar"])
+print "line 9"
+""")
+
expect = """\
line 1
line 3
@@ -86,6 +96,8 @@ y = 8
z = 9
a4 = aaa
b4 = bbb
+foo = foo
+bar = bar
"""
test.run(arguments = '-q -Q', stdout=expect)
diff --git a/test/SWIG/subdir.py b/test/SWIG/subdir.py
new file mode 100644
index 0000000..4905d3e
--- /dev/null
+++ b/test/SWIG/subdir.py
@@ -0,0 +1,113 @@
+#!/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 expect the .py file created by the -python flag to be in
+the same subdirectory as the taget.
+"""
+
+import os
+import sys
+
+import TestSCons
+
+# swig-python expects specific filenames.
+# the platform specific suffix won't necessarily work.
+if sys.platform == 'win32':
+ _dll = '.dll'
+else:
+ _dll = '.so'
+
+test = TestSCons.TestSCons()
+
+test.subdir('sub')
+
+swig = test.where_is('swig')
+
+if not swig:
+ test.skip_test('Can not find installed "swig", skipping test.\n')
+
+python = test.get_platform_python()
+_python_ = test.get_quoted_platform_python()
+
+# handle testing on other platforms:
+ldmodule_prefix = '_'
+
+python_include_dir = test.get_python_inc()
+
+Python_h = os.path.join(python_include_dir, 'Python.h')
+
+if not os.path.exists(Python_h):
+ test.skip_test('Can not find %s, skipping test.\n' % Python_h)
+
+python_frameworks_flags = test.get_python_frameworks_flags()
+
+test.write('SConstruct', """
+env = Environment(SWIGFLAGS='-python',
+ CPPPATH='%(python_include_dir)s/',
+ LDMODULEPREFIX='%(ldmodule_prefix)s',
+ LDMODULESUFFIX='%(_dll)s',
+ FRAMEWORKSFLAGS='%(python_frameworks_flags)s',
+ )
+
+import sys
+if sys.version[0] == '1':
+ # SWIG requires the -classic flag on pre-2.0 Python versions.
+ env.Append(SWIGFLAGS = ' -classic')
+
+env.LoadableModule('sub/_foo',
+ ['sub/foo.i', 'sub/foo.c'],
+ LDMODULEPREFIX='')
+""" % locals())
+
+test.write(['sub', 'foo.i'], """\
+%module foo
+%{
+/* Put header files here (optional) */
+/*
+ * This duplication shouldn't be necessary, I guess, but it seems
+ * to suppress "cast to pointer from integer of different size"
+ * warning messages on some systems.
+ */
+extern char *foo_string();
+%}
+
+extern char *foo_string();
+""")
+
+test.write(['sub', 'foo.c'], """\
+char *
+foo_string()
+{
+ return "This is foo.c!";
+}
+""")
+
+test.run(arguments = '.')
+
+test.up_to_date(options = '--debug=explain', arguments = '.')
+
+test.pass_test()
diff --git a/test/Variables/BoolVariable.py b/test/Variables/BoolVariable.py
new file mode 100644
index 0000000..1bda19b
--- /dev/null
+++ b/test/Variables/BoolVariable.py
@@ -0,0 +1,87 @@
+#!/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 the BoolVariable canned Variable type.
+"""
+
+import os.path
+import string
+
+try:
+ True, False
+except NameError:
+ True = (0 == 0)
+ False = (0 != 0)
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
+
+
+
+test.write(SConstruct_path, """\
+from SCons.Variables import BoolVariable
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ BoolVariable('warnings', 'compilation with -Wall and similiar', 1),
+ BoolVariable('profile', 'create profiling informations', 0),
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['warnings']
+print env['profile']
+
+Default(env.Alias('dummy', None))
+""")
+
+
+
+test.run()
+check([str(True), str(False)])
+
+test.run(arguments='warnings=0 profile=no profile=true')
+check([str(False), str(True)])
+
+expect_stderr = """
+scons: *** Error converting option: warnings
+Invalid value for boolean option: irgendwas
+""" + test.python_file_line(SConstruct_path, 9)
+
+test.run(arguments='warnings=irgendwas', stderr = expect_stderr, status=2)
+
+
+
+test.pass_test()
diff --git a/test/Variables/EnumVariable.py b/test/Variables/EnumVariable.py
new file mode 100644
index 0000000..6966509
--- /dev/null
+++ b/test/Variables/EnumVariable.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__"
+
+"""
+Test the EnumVariable canned Variable type.
+"""
+
+import os.path
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
+
+
+
+test.write(SConstruct_path, """\
+from SCons.Variables import EnumVariable
+
+list_of_libs = Split('x11 gl qt ical')
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ EnumVariable('debug', 'debug output and symbols', 'no',
+ allowed_values=('yes', 'no', 'full'),
+ map={}, ignorecase=0), # case sensitive
+ EnumVariable('guilib', 'gui lib to use', 'gtk',
+ allowed_values=('motif', 'gtk', 'kde'),
+ map={}, ignorecase=1), # case insensitive
+ EnumVariable('some', 'some option', 'xaver',
+ allowed_values=('xaver', 'eins'),
+ map={}, ignorecase=2), # make lowercase
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['debug']
+print env['guilib']
+print env['some']
+
+Default(env.Alias('dummy', None))
+""")
+
+
+test.run(); check(['no', 'gtk', 'xaver'])
+
+test.run(arguments='debug=yes guilib=Motif some=xAVER')
+check(['yes', 'Motif', 'xaver'])
+
+test.run(arguments='debug=full guilib=KdE some=EiNs')
+check(['full', 'KdE', 'eins'])
+
+expect_stderr = """
+scons: *** Invalid value for option debug: FULL
+""" + test.python_file_line(SConstruct_path, 18)
+
+test.run(arguments='debug=FULL', stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Invalid value for option guilib: irgendwas
+""" + test.python_file_line(SConstruct_path, 18)
+
+test.run(arguments='guilib=IrGeNdwas', stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Invalid value for option some: irgendwas
+""" + test.python_file_line(SConstruct_path, 18)
+
+test.run(arguments='some=IrGeNdwas', stderr=expect_stderr, status=2)
+
+
+test.pass_test()
diff --git a/test/Variables/ListVariable.py b/test/Variables/ListVariable.py
new file mode 100644
index 0000000..90d80ed
--- /dev/null
+++ b/test/Variables/ListVariable.py
@@ -0,0 +1,172 @@
+#!/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 the ListVariable canned Variable type.
+"""
+
+import os
+import os.path
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ r = result[1:len(expect)+1]
+ assert r == expect, (r, expect)
+
+
+
+test.write(SConstruct_path, """\
+from SCons.Variables import ListVariable
+
+list_of_libs = Split('x11 gl qt ical')
+
+optsfile = 'scons.variables'
+opts = Variables(optsfile, args=ARGUMENTS)
+opts.AddVariables(
+ ListVariable('shared',
+ 'libraries to build as shared libraries',
+ 'all',
+ names = list_of_libs,
+ map = {'GL':'gl', 'QT':'qt'}),
+ )
+
+env = Environment(variables=opts)
+opts.Save(optsfile, env)
+Help(opts.GenerateHelpText(env))
+
+print env['shared']
+if 'ical' in env['shared']: print '1'
+else: print '0'
+for x in env['shared']:
+ print x,
+print
+print env.subst('$shared')
+# Test subst_path() because it's used in $CPPDEFINES expansions.
+print env.subst_path('$shared')
+Default(env.Alias('dummy', None))
+""")
+
+test.run()
+check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
+ "['gl ical qt x11']"])
+
+test.must_match(test.workpath('scons.variables'), "shared = 'all'"+os.linesep)
+
+check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
+ "['gl ical qt x11']"])
+
+test.run(arguments='shared=none')
+check(['none', '0', '', '', "['']"])
+
+test.run(arguments='shared=')
+check(['none', '0', '', '', "['']"])
+
+test.run(arguments='shared=x11,ical')
+check(['ical,x11', '1', 'ical x11', 'ical x11',
+ "['ical x11']"])
+
+test.run(arguments='shared=x11,,ical,,')
+check(['ical,x11', '1', 'ical x11', 'ical x11',
+ "['ical x11']"])
+
+test.run(arguments='shared=GL')
+check(['gl', '0', 'gl', 'gl'])
+
+test.run(arguments='shared=QT,GL')
+check(['gl,qt', '0', 'gl qt', 'gl qt', "['gl qt']"])
+
+
+expect_stderr = """
+scons: *** Error converting option: shared
+Invalid value(s) for option: foo
+""" + test.python_file_line(SConstruct_path, 15)
+
+test.run(arguments='shared=foo', stderr=expect_stderr, status=2)
+
+# be paranoid in testing some more combinations
+
+expect_stderr = """
+scons: *** Error converting option: shared
+Invalid value(s) for option: foo
+""" + test.python_file_line(SConstruct_path, 15)
+
+test.run(arguments='shared=foo,ical', stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Error converting option: shared
+Invalid value(s) for option: foo
+""" + test.python_file_line(SConstruct_path, 15)
+
+test.run(arguments='shared=ical,foo', stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Error converting option: shared
+Invalid value(s) for option: foo
+""" + test.python_file_line(SConstruct_path, 15)
+
+test.run(arguments='shared=ical,foo,x11', stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Error converting option: shared
+Invalid value(s) for option: foo,bar
+""" + test.python_file_line(SConstruct_path, 15)
+
+test.run(arguments='shared=foo,x11,,,bar', stderr=expect_stderr, status=2)
+
+
+
+test.write('SConstruct', """
+from SCons.Variables import ListVariable
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ ListVariable('gpib',
+ 'comment',
+ ['ENET', 'GPIB'],
+ names = ['ENET', 'GPIB', 'LINUX_GPIB', 'NO_GPIB']),
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['gpib']
+Default(env.Alias('dummy', None))
+""")
+
+test.run(stdout=test.wrap_stdout(read_str="ENET,GPIB\n", build_str="""\
+scons: Nothing to be done for `dummy'.
+"""))
+
+
+
+test.pass_test()
diff --git a/test/Variables/PackageVariable.py b/test/Variables/PackageVariable.py
new file mode 100644
index 0000000..4d36252
--- /dev/null
+++ b/test/Variables/PackageVariable.py
@@ -0,0 +1,89 @@
+#!/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 the PackageVariable canned Variable type.
+"""
+
+import os.path
+import string
+
+try:
+ True, False
+except NameError:
+ True = (0 == 0)
+ False = (0 != 0)
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
+
+
+
+test.write(SConstruct_path, """\
+from SCons.Variables import PackageVariable
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PackageVariable('x11',
+ 'use X11 installed here (yes = search some places',
+ 'yes'),
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['x11']
+Default(env.Alias('dummy', None))
+""")
+
+test.run()
+check([str(True)])
+
+test.run(arguments='x11=no')
+check([str(False)])
+
+test.run(arguments='x11=0')
+check([str(False)])
+
+test.run(arguments=['x11=%s' % test.workpath()])
+check([test.workpath()])
+
+expect_stderr = """
+scons: *** Path does not exist for option x11: /non/existing/path/
+""" + test.python_file_line(SConstruct_path, 10)
+
+test.run(arguments='x11=/non/existing/path/', stderr=expect_stderr, status=2)
+
+
+
+test.pass_test()
diff --git a/test/Variables/PathVariable.py b/test/Variables/PathVariable.py
new file mode 100644
index 0000000..a2f96a7
--- /dev/null
+++ b/test/Variables/PathVariable.py
@@ -0,0 +1,285 @@
+#!/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 the PathVariable canned option type, with tests for its
+various canned validators.
+"""
+
+import os.path
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+SConstruct_path = test.workpath('SConstruct')
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
+
+#### test PathVariable ####
+
+test.subdir('lib', 'qt', ['qt', 'lib'], 'nolib' )
+workpath = test.workpath()
+libpath = os.path.join(workpath, 'lib')
+
+test.write(SConstruct_path, """\
+from SCons.Variables import PathVariable
+
+qtdir = r'%s'
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
+ PathVariable('qt_libraries', 'where the Qt library is installed', r'%s'),
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['qtdir']
+print env['qt_libraries']
+print env.subst('$qt_libraries')
+
+Default(env.Alias('dummy', None))
+""" % (workpath, os.path.join('$qtdir', 'lib') ))
+
+qtpath = workpath
+libpath = os.path.join(qtpath, 'lib')
+test.run()
+check([qtpath, os.path.join('$qtdir', 'lib'), libpath])
+
+qtpath = os.path.join(workpath, 'qt')
+libpath = os.path.join(qtpath, 'lib')
+test.run(arguments=['qtdir=%s' % qtpath])
+check([qtpath, os.path.join('$qtdir', 'lib'), libpath])
+
+qtpath = workpath
+libpath = os.path.join(qtpath, 'nolib')
+test.run(arguments=['qt_libraries=%s' % libpath])
+check([qtpath, libpath, libpath])
+
+qtpath = os.path.join(workpath, 'qt')
+libpath = os.path.join(workpath, 'nolib')
+test.run(arguments=['qtdir=%s' % qtpath, 'qt_libraries=%s' % libpath])
+check([qtpath, libpath, libpath])
+
+qtpath = os.path.join(workpath, 'non', 'existing', 'path')
+SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 11)[:-1]
+
+expect_stderr = """
+scons: *** Path for option qtdir does not exist: %(qtpath)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['qtdir=%s' % qtpath], stderr=expect_stderr, status=2)
+
+expect_stderr = """
+scons: *** Path for option qt_libraries does not exist: %(qtpath)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['qt_libraries=%s' % qtpath], stderr=expect_stderr, status=2)
+
+
+
+default_file = test.workpath('default_file')
+default_subdir = test.workpath('default_subdir')
+
+existing_subdir = test.workpath('existing_subdir')
+test.subdir(existing_subdir)
+
+existing_file = test.workpath('existing_file')
+test.write(existing_file, "existing_file\n")
+
+non_existing_subdir = test.workpath('non_existing_subdir')
+non_existing_file = test.workpath('non_existing_file')
+
+
+
+test.write('SConstruct', """\
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PathVariable('X', 'X variable', r'%s', validator=PathVariable.PathAccept),
+ )
+
+env = Environment(variables=opts)
+
+print env['X']
+
+Default(env.Alias('dummy', None))
+""" % default_subdir)
+
+test.run()
+check([default_subdir])
+
+test.run(arguments=['X=%s' % existing_file])
+check([existing_file])
+
+test.run(arguments=['X=%s' % non_existing_file])
+check([non_existing_file])
+
+test.run(arguments=['X=%s' % existing_subdir])
+check([existing_subdir])
+
+test.run(arguments=['X=%s' % non_existing_subdir])
+check([non_existing_subdir])
+
+test.must_not_exist(non_existing_file)
+test.must_not_exist(non_existing_subdir)
+
+
+
+test.write(SConstruct_path, """\
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PathVariable('X', 'X variable', r'%s', validator=PathVariable.PathIsFile),
+ )
+
+env = Environment(variables=opts)
+
+print env['X']
+
+Default(env.Alias('dummy', None))
+""" % default_file)
+
+SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 6)[:-1]
+
+expect_stderr = """
+scons: *** File path for option X does not exist: %(default_file)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(status=2, stderr=expect_stderr)
+
+test.write(default_file, "default_file\n")
+
+test.run()
+check([default_file])
+
+expect_stderr = """
+scons: *** File path for option X is a directory: %(existing_subdir)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['X=%s' % existing_subdir], status=2, stderr=expect_stderr)
+
+test.run(arguments=['X=%s' % existing_file])
+check([existing_file])
+
+expect_stderr = """
+scons: *** File path for option X does not exist: %(non_existing_file)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['X=%s' % non_existing_file], status=2, stderr=expect_stderr)
+
+
+
+test.write('SConstruct', """\
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PathVariable('X', 'X variable', r'%s', validator=PathVariable.PathIsDir),
+ )
+
+env = Environment(variables=opts)
+
+print env['X']
+
+Default(env.Alias('dummy', None))
+""" % default_subdir)
+
+expect_stderr = """
+scons: *** Directory path for option X does not exist: %(default_subdir)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(status=2, stderr=expect_stderr)
+
+test.subdir(default_subdir)
+
+test.run()
+check([default_subdir])
+
+expect_stderr = """
+scons: *** Directory path for option X is a file: %(existing_file)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['X=%s' % existing_file],
+ status=2,
+ stderr=expect_stderr)
+
+test.run(arguments=['X=%s' % existing_subdir])
+check([existing_subdir])
+
+expect_stderr = """
+scons: *** Directory path for option X does not exist: %(non_existing_subdir)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['X=%s' % non_existing_subdir],
+ status=2,
+ stderr=expect_stderr)
+
+
+
+test.write('SConstruct', """\
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ PathVariable('X', 'X variable', r'%s', validator=PathVariable.PathIsDirCreate),
+ )
+
+env = Environment(variables=opts)
+
+print env['X']
+
+Default(env.Alias('dummy', None))
+""" % default_subdir)
+
+test.run()
+check([default_subdir])
+
+expect_stderr = """
+scons: *** Path for option X is a file, not a directory: %(existing_file)s
+%(SConstruct_file_line)s
+""" % locals()
+
+test.run(arguments=['X=%s' % existing_file], status=2, stderr=expect_stderr)
+
+test.run(arguments=['X=%s' % existing_subdir])
+check([existing_subdir])
+
+test.run(arguments=['X=%s' % non_existing_subdir])
+check([non_existing_subdir])
+
+test.must_exist(non_existing_subdir)
+
+
+
+test.pass_test()
diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py
new file mode 100644
index 0000000..8f32f61
--- /dev/null
+++ b/test/Variables/Variables.py
@@ -0,0 +1,364 @@
+#!/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__"
+
+import TestSCons
+import string
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import string
+env = Environment()
+print env['CC']
+print string.join(env['CCFLAGS'])
+Default(env.Alias('dummy', None))
+""")
+test.run()
+cc, ccflags = string.split(test.stdout(), '\n')[1:3]
+
+test.write('SConstruct', """
+import string
+
+# test validator. Change a key and add a new one to the environment
+def validator(key, value, environ):
+ environ[key] = "v"
+ environ["valid_key"] = "v"
+
+
+def old_converter (value):
+ return "old_converter"
+
+def new_converter (value, env):
+ return "new_converter"
+
+
+opts = Variables('custom.py')
+opts.Add('RELEASE_BUILD',
+ 'Set to 1 to build a release build',
+ 0,
+ None,
+ int)
+
+opts.Add('DEBUG_BUILD',
+ 'Set to 1 to build a debug build',
+ 1,
+ None,
+ int)
+
+opts.Add('CC',
+ 'The C compiler')
+
+opts.Add('VALIDATE',
+ 'An option for testing validation',
+ "notset",
+ validator,
+ None)
+
+opts.Add('OLD_CONVERTER',
+ 'An option for testing converters that take one parameter',
+ "foo",
+ None,
+ old_converter)
+
+opts.Add('NEW_CONVERTER',
+ 'An option for testing converters that take two parameters',
+ "foo",
+ None,
+ new_converter)
+
+opts.Add('UNSPECIFIED',
+ 'An option with no value')
+
+def test_tool(env):
+ if env['RELEASE_BUILD']:
+ env.Append(CCFLAGS = '-O')
+ if env['DEBUG_BUILD']:
+ env.Append(CCFLAGS = '-g')
+
+
+env = Environment(variables=opts, tools=['default', test_tool])
+
+Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env))
+
+print env['RELEASE_BUILD']
+print env['DEBUG_BUILD']
+print env['CC']
+print string.join(env['CCFLAGS'])
+print env['VALIDATE']
+print env['valid_key']
+
+# unspecified variables should not be set:
+assert not env.has_key('UNSPECIFIED')
+
+# undeclared variables should be ignored:
+assert not env.has_key('UNDECLARED')
+
+# calling Update() should not effect variables that
+# are not declared on the variables object:
+r = env['RELEASE_BUILD']
+opts = Variables()
+opts.Update(env)
+assert env['RELEASE_BUILD'] == r
+
+Default(env.Alias('dummy', None))
+
+""")
+
+def check(expect):
+ result = string.split(test.stdout(), '\n')
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
+
+test.run()
+check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+
+test.run(arguments='RELEASE_BUILD=1')
+check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+
+test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0')
+check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+
+test.run(arguments='CC=not_a_c_compiler')
+check(['0', '1', 'not_a_c_compiler', string.strip(ccflags + ' -g'), 'v', 'v'])
+
+test.run(arguments='UNDECLARED=foo')
+check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+
+test.run(arguments='CCFLAGS=--taco')
+check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+
+test.write('custom.py', """
+DEBUG_BUILD=0
+RELEASE_BUILD=1
+""")
+
+test.run()
+check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+
+test.run(arguments='DEBUG_BUILD=1')
+check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+
+test.run(arguments='-h',
+ stdout = """\
+scons: Reading SConscript files ...
+1
+0
+%s
+%s
+v
+v
+scons: done reading SConscript files.
+Variables settable in custom.py or on the command line:
+
+RELEASE_BUILD: Set to 1 to build a release build
+ default: 0
+ actual: 1
+
+DEBUG_BUILD: Set to 1 to build a debug build
+ default: 1
+ actual: 0
+
+CC: The C compiler
+ default: None
+ actual: %s
+
+VALIDATE: An option for testing validation
+ default: notset
+ actual: v
+
+OLD_CONVERTER: An option for testing converters that take one parameter
+ default: foo
+ actual: old_converter
+
+NEW_CONVERTER: An option for testing converters that take two parameters
+ default: foo
+ actual: new_converter
+
+UNSPECIFIED: An option with no value
+ default: None
+ actual: None
+
+Use scons -H for help about command-line options.
+"""%(cc, ccflags and ccflags + ' -O' or '-O', cc))
+
+# Test saving of variables and multi loading
+#
+test.write('SConstruct', """
+opts = Variables(['custom.py', 'variables.saved'])
+opts.Add('RELEASE_BUILD',
+ 'Set to 1 to build a release build',
+ 0,
+ None,
+ int)
+
+opts.Add('DEBUG_BUILD',
+ 'Set to 1 to build a debug build',
+ 1,
+ None,
+ int)
+
+opts.Add('UNSPECIFIED',
+ 'An option with no value')
+
+env = Environment(variables = opts)
+
+print env['RELEASE_BUILD']
+print env['DEBUG_BUILD']
+
+opts.Save('variables.saved', env)
+""")
+
+# Check the save file by executing and comparing against
+# the expected dictionary
+def checkSave(file, expected):
+ gdict = {}
+ ldict = {}
+ execfile(file, gdict, ldict)
+ assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict)
+
+# First test with no command line variables
+# This should just leave the custom.py settings
+test.run()
+check(['1','0'])
+checkSave('variables.saved', { 'RELEASE_BUILD':1, 'DEBUG_BUILD':0})
+
+# Override with command line arguments
+test.run(arguments='DEBUG_BUILD=3')
+check(['1','3'])
+checkSave('variables.saved', {'RELEASE_BUILD':1, 'DEBUG_BUILD':3})
+
+# Now make sure that saved variables are overridding the custom.py
+test.run()
+check(['1','3'])
+checkSave('variables.saved', {'DEBUG_BUILD':3, 'RELEASE_BUILD':1})
+
+# Load no variables from file(s)
+# Used to test for correct output in save option file
+test.write('SConstruct', """
+opts = Variables()
+opts.Add('RELEASE_BUILD',
+ 'Set to 1 to build a release build',
+ '0',
+ None,
+ int)
+
+opts.Add('DEBUG_BUILD',
+ 'Set to 1 to build a debug build',
+ '1',
+ None,
+ int)
+
+opts.Add('UNSPECIFIED',
+ 'An option with no value')
+
+opts.Add('LISTOPTION_TEST',
+ 'testing list option persistence',
+ 'none',
+ names = ['a','b','c',])
+
+env = Environment(variables = opts)
+
+print env['RELEASE_BUILD']
+print env['DEBUG_BUILD']
+print env['LISTOPTION_TEST']
+
+opts.Save('variables.saved', env)
+""")
+
+# First check for empty output file when nothing is passed on command line
+test.run()
+check(['0','1'])
+checkSave('variables.saved', {})
+
+# Now specify one option the same as default and make sure it doesn't write out
+test.run(arguments='DEBUG_BUILD=1')
+check(['0','1'])
+checkSave('variables.saved', {})
+
+# Now specify same option non-default and make sure only it is written out
+test.run(arguments='DEBUG_BUILD=0 LISTOPTION_TEST=a,b')
+check(['0','0'])
+checkSave('variables.saved',{'DEBUG_BUILD':0, 'LISTOPTION_TEST':'a,b'})
+
+test.write('SConstruct', """
+opts = Variables('custom.py')
+opts.Add('RELEASE_BUILD',
+ 'Set to 1 to build a release build',
+ 0,
+ None,
+ int)
+
+opts.Add('DEBUG_BUILD',
+ 'Set to 1 to build a debug build',
+ 1,
+ None,
+ int)
+
+opts.Add('CC',
+ 'The C compiler')
+
+opts.Add('UNSPECIFIED',
+ 'An option with no value')
+
+env = Environment(variables=opts)
+
+Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=cmp))
+
+""")
+
+test.run(arguments='-h',
+ stdout = """\
+scons: Reading SConscript files ...
+scons: done reading SConscript files.
+Variables settable in custom.py or on the command line:
+
+CC: The C compiler
+ default: None
+ actual: %s
+
+DEBUG_BUILD: Set to 1 to build a debug build
+ default: 1
+ actual: 0
+
+RELEASE_BUILD: Set to 1 to build a release build
+ default: 0
+ actual: 1
+
+UNSPECIFIED: An option with no value
+ default: None
+ actual: None
+
+Use scons -H for help about command-line options.
+"""%cc)
+
+test.write('SConstruct', """
+import SCons.Variables
+env1 = Environment(variables = Variables())
+env2 = Environment(variables = SCons.Variables.Variables())
+""")
+
+test.run()
+
+test.pass_test()
diff --git a/test/Variables/chdir.py b/test/Variables/chdir.py
new file mode 100644
index 0000000..ad907c6
--- /dev/null
+++ b/test/Variables/chdir.py
@@ -0,0 +1,71 @@
+#!/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 can chdir() to the directory in which an Variables
+file lives by using the __name__ value.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('bin', 'subdir')
+
+test.write('SConstruct', """\
+opts = Variables('../bin/opts.cfg', ARGUMENTS)
+opts.Add('VARIABLE')
+Export("opts")
+SConscript('subdir/SConscript')
+""")
+
+SConscript_contents = """\
+Import("opts")
+env = Environment()
+opts.Update(env)
+print "VARIABLE =", repr(env['VARIABLE'])
+"""
+
+test.write(['bin', 'opts.cfg'], """\
+import os
+import os.path
+os.chdir(os.path.split(__name__)[0])
+execfile('opts2.cfg')
+""")
+
+test.write(['bin', 'opts2.cfg'], """\
+VARIABLE = 'opts2.cfg value'
+""")
+
+test.write(['subdir', 'SConscript'], SConscript_contents)
+
+expect = """\
+VARIABLE = 'opts2.cfg value'
+"""
+
+test.run(arguments = '-q -Q .', stdout=expect)
+
+test.pass_test()
diff --git a/test/Variables/help.py b/test/Variables/help.py
new file mode 100644
index 0000000..dcea68e
--- /dev/null
+++ b/test/Variables/help.py
@@ -0,0 +1,151 @@
+#!/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 the Variables help messages.
+"""
+
+import os.path
+import string
+
+try:
+ True, False
+except NameError:
+ True = (0 == 0)
+ False = (0 != 0)
+
+str_True = str(True)
+str_False = str(False)
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+
+
+workpath = test.workpath()
+qtpath = os.path.join(workpath, 'qt')
+libpath = os.path.join(qtpath, 'lib')
+libdirvar = os.path.join('$qtdir', 'lib')
+
+test.subdir(qtpath)
+test.subdir(libpath)
+
+test.write('SConstruct', """
+from SCons.Variables import BoolVariable, EnumVariable, ListVariable, \
+ PackageVariable, PathVariable
+
+list_of_libs = Split('x11 gl qt ical')
+qtdir = r'%(qtpath)s'
+
+opts = Variables(args=ARGUMENTS)
+opts.AddVariables(
+ BoolVariable('warnings', 'compilation with -Wall and similiar', 1),
+ BoolVariable('profile', 'create profiling informations', 0),
+ EnumVariable('debug', 'debug output and symbols', 'no',
+ allowed_values=('yes', 'no', 'full'),
+ map={}, ignorecase=0), # case sensitive
+ EnumVariable('guilib', 'gui lib to use', 'gtk',
+ allowed_values=('motif', 'gtk', 'kde'),
+ map={}, ignorecase=1), # case insensitive
+ EnumVariable('some', 'some option', 'xaver',
+ allowed_values=('xaver', 'eins'),
+ map={}, ignorecase=2), # make lowercase
+ ListVariable('shared',
+ 'libraries to build as shared libraries',
+ 'all',
+ names = list_of_libs),
+ PackageVariable('x11',
+ 'use X11 installed here (yes = search some places)',
+ 'yes'),
+ PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
+ PathVariable('qt_libraries',
+ 'where the Qt library is installed',
+ r'%(libdirvar)s'),
+ )
+
+env = Environment(variables=opts)
+Help(opts.GenerateHelpText(env))
+
+print env['warnings']
+print env['profile']
+
+Default(env.Alias('dummy', None))
+""" % locals())
+
+
+test.run(arguments='-h',
+ stdout = """\
+scons: Reading SConscript files ...
+%(str_True)s
+%(str_False)s
+scons: done reading SConscript files.
+
+warnings: compilation with -Wall and similiar (yes|no)
+ default: 1
+ actual: %(str_True)s
+
+profile: create profiling informations (yes|no)
+ default: 0
+ actual: %(str_False)s
+
+debug: debug output and symbols (yes|no|full)
+ default: no
+ actual: no
+
+guilib: gui lib to use (motif|gtk|kde)
+ default: gtk
+ actual: gtk
+
+some: some option (xaver|eins)
+ default: xaver
+ actual: xaver
+
+shared: libraries to build as shared libraries
+ (all|none|comma-separated list of names)
+ allowed names: x11 gl qt ical
+ default: all
+ actual: x11 gl qt ical
+
+x11: use X11 installed here (yes = search some places)
+ ( yes | no | /path/to/x11 )
+ default: yes
+ actual: %(str_True)s
+
+qtdir: where the root of Qt is installed ( /path/to/qtdir )
+ default: %(qtpath)s
+ actual: %(qtpath)s
+
+qt_libraries: where the Qt library is installed ( /path/to/qt_libraries )
+ default: %(libdirvar)s
+ actual: %(libpath)s
+
+Use scons -H for help about command-line options.
+""" % locals())
+
+
+
+test.pass_test()
diff --git a/test/Variables/import.py b/test/Variables/import.py
new file mode 100644
index 0000000..899870b
--- /dev/null
+++ b/test/Variables/import.py
@@ -0,0 +1,69 @@
+#!/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 an Variables file in a different directory can import
+a module in that directory.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+workpath = test.workpath('')
+
+test.subdir('bin', 'subdir')
+
+test.write('SConstruct', """\
+opts = Variables('../bin/opts.cfg', ARGUMENTS)
+opts.Add('VARIABLE')
+Export("opts")
+SConscript('subdir/SConscript')
+""")
+
+SConscript_contents = """\
+Import("opts")
+env = Environment()
+opts.Update(env)
+print "VARIABLE =", env.get('VARIABLE')
+"""
+
+test.write(['bin', 'opts.cfg'], """\
+import sys
+from local_options import VARIABLE
+""" % locals())
+
+test.write(['bin', 'local_options.py'], """\
+VARIABLE = 'bin/local_options.py'
+""")
+
+test.write(['subdir', 'SConscript'], SConscript_contents)
+
+expect = "VARIABLE = bin/local_options.py\n"
+
+test.run(arguments = '-q -Q .', stdout = expect)
+
+test.pass_test()
diff --git a/test/YACC/live.py b/test/YACC/live.py
index 0e5f156..3c5050e 100644
--- a/test/YACC/live.py
+++ b/test/YACC/live.py
@@ -104,7 +104,7 @@ graph: GRAPH_T
""")
import sys
-if sys.platform == 'darwin':
+if sys.platform[:6] == 'darwin':
file_hpp = 'file.cpp.h'
else:
file_hpp = 'file.hpp'
diff --git a/test/dependency-cycle.py b/test/dependency-cycle.py
index b2a8974..3cfe697 100644
--- a/test/dependency-cycle.py
+++ b/test/dependency-cycle.py
@@ -49,7 +49,10 @@ f1(void)
""")
test.run(arguments = ".", stderr=r"""
-scons: \*\*\* Dependency cycle: .*foo1.* -> .*foo3.* -> .*foo2.* -> .*foo1.*
+scons: \*\*\* Found dependency cycle\(s\):
+ .*foo1.* -> .*foo3.* -> .*foo2.* -> .*foo1.*
+ .*foo3.* -> .*foo2.* -> .*foo1.* -> .*foo3.*
+
.*
""", status=2)
diff --git a/test/duplicate-sources.py b/test/duplicate-sources.py
new file mode 100644
index 0000000..8d517e5
--- /dev/null
+++ b/test/duplicate-sources.py
@@ -0,0 +1,55 @@
+#!/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 specifying a source file more than once works correctly
+and dos not cause a rebuild.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+def cat(target, source, env):
+ t = open(str(target[0]), 'wb')
+ for s in source:
+ t.write(open(str(s), 'rb').read())
+ t.close()
+env = Environment(BUILDERS = {'Cat' : Builder(action = cat)})
+env.Cat('out.txt', ['f1.in', 'f2.in', 'f1.in'])
+""")
+
+test.write('f1.in', "f1.in\n")
+test.write('f2.in', "f2.in\n")
+
+test.run(arguments='--debug=explain .')
+
+test.must_match('out.txt', "f1.in\nf2.in\nf1.in\n")
+
+test.up_to_date(options='--debug=explain', arguments='.')
+
+test.pass_test()
diff --git a/test/exceptions.py b/test/exceptions.py
index c4bfb37..b0939c0 100644
--- a/test/exceptions.py
+++ b/test/exceptions.py
@@ -109,7 +109,7 @@ test.run(arguments = '.', status = 2, stderr = expected_stderr)
expected_stderr_list = [
"scons: *** [out.f1] Error 1\n",
- "scons: *** Source `in.f2' not found, needed by target `out.f2'. Stop.\n",
+ "scons: *** Source `in.f2' not found, needed by target `out.f2'.\n",
"scons: *** [out.f3] Error 1\n",
]
@@ -120,7 +120,7 @@ expected_stderr_list = [
# walk of '.' and are already considered up-to-date when we kick off the
# "simultaneous" builds of the output (target) files.
-test.run(arguments = '-j7 .', status = 2, stderr = None)
+test.run(arguments = '-j7 -k .', status = 2, stderr = None)
missing = []
for es in expected_stderr_list:
diff --git a/test/no-global-dependencies.py b/test/no-global-dependencies.py
index 168a880..3b6ba97 100644
--- a/test/no-global-dependencies.py
+++ b/test/no-global-dependencies.py
@@ -45,10 +45,10 @@ test.subdir('dir1')
test.subdir('dir2')
test.write('SConstruct', """\
-opts = Options()
-opts.AddOptions(
- BoolOption('view_all_dependencies', 'View all dependencies', True),
- BoolOption('duplicate', 'Duplicate sources to variant dir', True)
+opts = Variables()
+opts.AddVariables(
+ BoolVariable('view_all_dependencies', 'View all dependencies', True),
+ BoolVariable('duplicate', 'Duplicate sources to variant dir', True)
)
env = Environment(options=opts)
diff --git a/test/option-v.py b/test/option-v.py
index 433d6d0..970dbd4 100644
--- a/test/option-v.py
+++ b/test/option-v.py
@@ -38,11 +38,9 @@ test.write('SConstruct', "")
# by the packaging build.
copyright_marker = '__' + 'COPYRIGHT' + '__'
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008'
-
fmt = '(%s|Copyright \\(c\\) %s The SCons Foundation)\n'
-copyright_line = fmt % (copyright_marker, copyright_years)
+copyright_line = fmt % (copyright_marker, TestSCons.copyright_years)
# Windows may or may not print a line for the script version
# depending on whether it's invoked through scons.py or scons.bat.
diff --git a/test/option-d.py b/test/option/d.py
index 58bc9e4..0f8a9a5 100644
--- a/test/option-d.py
+++ b/test/option/d.py
@@ -24,11 +24,22 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify that the -d option is ignored.
+"""
+
import TestSCons
test = TestSCons.TestSCons()
-test.pass_test() #XXX Short-circuit until this is supported.
+test.write('SConstruct', "")
+
+test.run(arguments = '-d .',
+ stderr = "Warning: ignoring -d option\n")
+
+test.pass_test()
+
+#
test.subdir('subdir')
diff --git a/test/option-e.py b/test/option/environment-overrides.py
index 1862ae7..078bfea 100644
--- a/test/option-e.py
+++ b/test/option/environment-overrides.py
@@ -24,19 +24,21 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify that the -e and --environment-overrides options are ignored.
+"""
+
import TestSCons
-import string
-import sys
test = TestSCons.TestSCons()
test.write('SConstruct', "")
test.run(arguments = '-e .',
- stderr = "Warning: the -e option is not yet implemented\n")
+ stderr = "Warning: ignoring -e option\n")
test.run(arguments = '--environment-overrides .',
- stderr = "Warning: the --environment-overrides option is not yet implemented\n")
+ stderr = "Warning: ignoring --environment-overrides option\n")
test.pass_test()
diff --git a/test/option--H.py b/test/option/help-options.py
index 0cf3b2b..5f8270f 100644
--- a/test/option--H.py
+++ b/test/option/help-options.py
@@ -24,9 +24,12 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import copy
+"""
+Verify behavior of the -H and --help-options options.
+"""
+
+import re
import string
-import sys
import TestSCons
@@ -41,16 +44,25 @@ test.fail_test(string.find(test.stdout(), '--debug=TYPE') == -1)
# Validate that the help output lists the options in case-insensitive
# alphabetical order.
-lines = string.split(test.stdout(), '\n')
+
+# Don't include in the sorted comparison the options that are ignored
+# for compatibility. They're all printed at the top of the list.
+ignored_re = re.compile('.*Ignored for compatibility\\.\n', re.S)
+stdout = ignored_re.sub('', test.stdout())
+
+lines = string.split(stdout, '\n')
lines = filter(lambda x: x[:3] == ' -', lines)
lines = map(lambda x: x[3:], lines)
lines = map(lambda x: x[0] == '-' and x[1:] or x, lines)
options = map(lambda x: string.split(x)[0], lines)
options = map(lambda x: x[-1] == ',' and x[:-1] or x, options)
lowered = map(lambda x: string.lower(x), options)
-sorted = copy.copy(lowered)
+sorted = lowered[:]
sorted.sort()
-test.fail_test(lowered != sorted)
+if lowered != sorted:
+ print "lowered =", lowered
+ print "sorted =", sorted
+ test.fail_test()
test.pass_test()
diff --git a/test/option--npd.py b/test/option/no-print-directory.py
index 352196a..bb0abbf 100644
--- a/test/option--npd.py
+++ b/test/option/no-print-directory.py
@@ -24,16 +24,18 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify that the --no-print-directory option is ignored.
+"""
+
import TestSCons
-import string
-import sys
test = TestSCons.TestSCons()
test.write('SConstruct', "")
test.run(arguments = '--no-print-directory .',
- stderr = "Warning: the --no-print-directory option is not yet implemented\n")
+ stderr = "Warning: ignoring --no-print-directory option\n")
test.pass_test()
diff --git a/test/option-w.py b/test/option/print-directory.py
index 759131c..a5d8fcf 100644
--- a/test/option-w.py
+++ b/test/option/print-directory.py
@@ -24,19 +24,21 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify that the -w and --print-directory options are ignored.
+"""
+
import TestSCons
-import string
-import sys
test = TestSCons.TestSCons()
test.write('SConstruct', "")
test.run(arguments = '-w .',
- stderr = "Warning: the -w option is not yet implemented\n")
+ stderr = "Warning: ignoring -w option\n")
test.run(arguments = '--print-directory .',
- stderr = "Warning: the --print-directory option is not yet implemented\n")
+ stderr = "Warning: ignoring --print-directory option\n")
test.pass_test()
diff --git a/test/option/taskmastertrace.py b/test/option/taskmastertrace.py
index 3139504..30e15aa 100644
--- a/test/option/taskmastertrace.py
+++ b/test/option/taskmastertrace.py
@@ -46,23 +46,43 @@ env.Command('Tfile.mid', 'Tfile.in', Copy('$TARGET', '$SOURCE'))
test.write('Tfile.in', "Tfile.in\n")
expect_stdout = test.wrap_stdout("""\
-Taskmaster: '.': children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
- waiting on unfinished children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
-Taskmaster: 'SConstruct': evaluating SConstruct
-Taskmaster: 'Tfile.in': evaluating Tfile.in
-Taskmaster: 'Tfile.mid': children:
- ['Tfile.in']
- evaluating Tfile.mid
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state '.'> and its children:
+Taskmaster: <no_state 'SConstruct'>
+Taskmaster: <no_state 'Tfile.in'>
+Taskmaster: <no_state 'Tfile.mid'>
+Taskmaster: <no_state 'Tfile.out'>
+Taskmaster: Considering node <no_state 'SConstruct'> and its children:
+Taskmaster: Evaluating <pending 'SConstruct'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.in'> and its children:
+Taskmaster: Evaluating <pending 'Tfile.in'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.mid'> and its children:
+Taskmaster: <up_to_date 'Tfile.in'>
+Taskmaster: Evaluating <pending 'Tfile.mid'>
Copy("Tfile.mid", "Tfile.in")
-Taskmaster: 'Tfile.out': children:
- ['Tfile.mid']
- evaluating Tfile.out
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.out'> and its children:
+Taskmaster: <executed 'Tfile.mid'>
+Taskmaster: Evaluating <pending 'Tfile.out'>
Copy("Tfile.out", "Tfile.mid")
-Taskmaster: '.': children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
- evaluating .
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <pending '.'> and its children:
+Taskmaster: <up_to_date 'SConstruct'>
+Taskmaster: <up_to_date 'Tfile.in'>
+Taskmaster: <executed 'Tfile.mid'>
+Taskmaster: <executed 'Tfile.out'>
+Taskmaster: Evaluating <pending '.'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: No candidate anymore.
+
""")
test.run(arguments='--taskmastertrace=- .', stdout=expect_stdout)
@@ -81,21 +101,41 @@ Copy("Tfile.out", "Tfile.mid")
test.run(arguments='--taskmastertrace=trace.out .', stdout=expect_stdout)
expect_trace = """\
-Taskmaster: '.': children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
- waiting on unfinished children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
-Taskmaster: 'SConstruct': evaluating SConstruct
-Taskmaster: 'Tfile.in': evaluating Tfile.in
-Taskmaster: 'Tfile.mid': children:
- ['Tfile.in']
- evaluating Tfile.mid
-Taskmaster: 'Tfile.out': children:
- ['Tfile.mid']
- evaluating Tfile.out
-Taskmaster: '.': children:
- ['SConstruct', 'Tfile.in', 'Tfile.mid', 'Tfile.out']
- evaluating .
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state '.'> and its children:
+Taskmaster: <no_state 'SConstruct'>
+Taskmaster: <no_state 'Tfile.in'>
+Taskmaster: <no_state 'Tfile.mid'>
+Taskmaster: <no_state 'Tfile.out'>
+Taskmaster: Considering node <no_state 'SConstruct'> and its children:
+Taskmaster: Evaluating <pending 'SConstruct'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.in'> and its children:
+Taskmaster: Evaluating <pending 'Tfile.in'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.mid'> and its children:
+Taskmaster: <up_to_date 'Tfile.in'>
+Taskmaster: Evaluating <pending 'Tfile.mid'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <no_state 'Tfile.out'> and its children:
+Taskmaster: <executed 'Tfile.mid'>
+Taskmaster: Evaluating <pending 'Tfile.out'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: Considering node <pending '.'> and its children:
+Taskmaster: <up_to_date 'SConstruct'>
+Taskmaster: <up_to_date 'Tfile.in'>
+Taskmaster: <executed 'Tfile.mid'>
+Taskmaster: <executed 'Tfile.out'>
+Taskmaster: Evaluating <pending '.'>
+
+Taskmaster: Looking for a node to evaluate
+Taskmaster: No candidate anymore.
+
"""
test.must_match('trace.out', expect_trace)
diff --git a/test/option/tree-all.py b/test/option/tree-all.py
index 163d286..0a0af7d 100644
--- a/test/option/tree-all.py
+++ b/test/option/tree-all.py
@@ -97,8 +97,8 @@ tree1 = """
""" % locals()
test.run(arguments = "--tree=all Foo.xxx")
-if string.find(test.stdout(), tree1) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree1) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -163,14 +163,14 @@ tree3 = """
""" % locals()
test.run(arguments = "--tree=all,prune .")
-if string.find(test.stdout(), tree3) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree3) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
test.run(arguments = "--tree=prune .")
-if string.find(test.stdout(), tree3) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree3) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -203,14 +203,14 @@ tree4 = """
test.run(arguments = '-c Foo.xxx')
test.run(arguments = "--no-exec --tree=all,status Foo.xxx")
-if string.find(test.stdout(), tree4) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree4) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
test.run(arguments = "--no-exec --tree=status Foo.xxx")
-if string.find(test.stdout(), tree4) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree4) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -226,8 +226,8 @@ THIS SHOULD CAUSE A BUILD FAILURE
test.run(arguments = "--tree=all Foo.xxx",
status = 2,
stderr = None)
-if string.find(test.stdout(), tree1) == -1:
- sys.stdout.write('Did not find expected tree in the following output:\n')
+if string.count(test.stdout(), tree1) != 1:
+ sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
diff --git a/test/option/tree-lib.py b/test/option/tree-lib.py
index fc29d50..8858b74 100644
--- a/test/option/tree-lib.py
+++ b/test/option/tree-lib.py
@@ -47,7 +47,7 @@ env = Environment(LIBPREFIX='',
EXESUFFIX='.exe')
env.AppendENVPath('PATH', '.')
l = env.Library( 'util.lib', 'util.c' )
-p = env.Program( 'test.exe', 'main.c', LIBS=l )
+p = env.Program( 'test_tree_lib.exe', 'main.c', LIBS=l )
env.Command( 'foo.h', p, '$SOURCE > $TARGET')
""")
@@ -71,7 +71,7 @@ util(void)
""")
expect = """
- +-test.exe
+ +-test_tree_lib.exe
+-main.obj
+-util.lib
+-util.obj
diff --git a/test/symlink/dangling-include.py b/test/symlink/dangling-include.py
index b5ea1e0..61ef07d 100644
--- a/test/symlink/dangling-include.py
+++ b/test/symlink/dangling-include.py
@@ -51,7 +51,7 @@ test.write('foo.c', """\
test.symlink('nonexistent', 'foo.h')
expect = """\
-scons: *** Source `foo.h' not found, needed by target `%s'. Stop.
+scons: *** Implicit dependency `foo.h' not found, needed by target `%s'. Stop.
"""% foo_obj
test.run(arguments = '.', status = 2, stderr = expect)