summaryrefslogtreecommitdiffstats
path: root/test/option
diff options
context:
space:
mode:
Diffstat (limited to 'test/option')
-rw-r--r--test/option/d.py144
-rw-r--r--test/option/environment-overrides.py44
-rw-r--r--test/option/help-options.py68
-rw-r--r--test/option/no-print-directory.py41
-rw-r--r--test/option/print-directory.py44
-rw-r--r--test/option/taskmastertrace.py100
-rw-r--r--test/option/tree-all.py24
-rw-r--r--test/option/tree-lib.py4
8 files changed, 425 insertions, 44 deletions
diff --git a/test/option/d.py b/test/option/d.py
new file mode 100644
index 0000000..0f8a9a5
--- /dev/null
+++ b/test/option/d.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the -d option is ignored.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '-d .',
+ stderr = "Warning: ignoring -d option\n")
+
+test.pass_test()
+
+#
+
+test.subdir('subdir')
+
+test.write('SConstruct', """
+env = Environment()
+env.Program(target = 'aaa', source = 'aaa.c')
+env.Program(target = 'bbb', source = 'bbb.c')
+SConscript('subdir/SConscript')
+""")
+
+test.write(['subdir', 'SConscript'], """
+env = Environment()
+env.Program(target = 'ccc', source = 'ccc.c')
+env.Program(target = 'ddd', source = 'ddd.c')
+""")
+
+test.write('aaa.c', """
+int
+main(int argc, char *argv)
+{
+ argv[argc++] = "--";
+ printf("aaa.c\n");
+ exit (0);
+}
+""")
+
+test.write('bbb.c', """
+int
+main(int argc, char *argv)
+{
+ argv[argc++] = "--";
+ printf("bbb.c\n");
+ exit (0);
+}
+""")
+
+test.write(['subdir', 'ccc.c'], """
+int
+main(int argc, char *argv)
+{
+ argv[argc++] = "--";
+ printf("subdir/ccc.c\n");
+ exit (0);
+}
+""")
+
+test.write(['subdir', 'ddd.c'], """
+int
+main(int argc, char *argv)
+{
+ argv[argc++] = "--";
+ printf("subdir/ddd.c\n");
+ exit (0);
+}
+""")
+
+test.run(arguments = '-d .', stdout = """
+Target aaa: aaa.o
+Checking aaa
+ Checking aaa.o
+ Checking aaa.c
+ Rebuilding aaa.o: out of date.
+cc -c -o aaa.o aaa.c
+Rebuilding aaa: out of date.
+cc -o aaa aaa.o
+Target aaa.o: aaa.c
+Target bbb: bbb.o
+Checking bbb
+ Checking bbb.o
+ Checking bbb.c
+ Rebuilding bbb.o: out of date.
+cc -c -o bbb.o bbb.c
+Rebuilding bbb: out of date.
+cc -o bbb bbb.o
+Target bbb.o: bbb.c
+Target subdir/ccc/g: subdir/ccc.o
+Checking subdir/ccc/g
+ Checking subdir/ccc/g.o
+ Checking subdir/ccc/g.c
+ Rebuilding subdir/ccc/g.o: out of date.
+cc -c -o subdir/ccc/g.o subdir/ccc.c
+Rebuilding subdir/ccc/g: out of date.
+cc -o subdir/ccc/g subdir/ccc.o
+Target subdir/ccc/g.o: subdir/ccc.c
+Target subdir/ddd/g: subdir/ddd.o
+Checking subdir/ddd/g
+ Checking subdir/ddd/g.o
+ Checking subdir/ddd/g.c
+ Rebuilding subdir/ddd/g.o: out of date.
+cc -c -o subdir/ddd/g.o subdir/ddd.c
+Rebuilding subdir/ddd/g: out of date.
+cc -o subdir/ddd/g subdir/ddd.o
+Target subdir/ddd/g.o: subdir/ddd.c
+""")
+
+test.run(program = test.workpath('aaa'), stdout = "aaa.c\n")
+test.run(program = test.workpath('bbb'), stdout = "bbb.c\n")
+test.run(program = test.workpath('subdir/ccc'), stdout = "subdir/ccc.c\n")
+test.run(program = test.workpath('subdir/ddd'), stdout = "subdir/ddd.c\n")
+
+test.pass_test()
+
diff --git a/test/option/environment-overrides.py b/test/option/environment-overrides.py
new file mode 100644
index 0000000..078bfea
--- /dev/null
+++ b/test/option/environment-overrides.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the -e and --environment-overrides options are ignored.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '-e .',
+ stderr = "Warning: ignoring -e option\n")
+
+test.run(arguments = '--environment-overrides .',
+ stderr = "Warning: ignoring --environment-overrides option\n")
+
+test.pass_test()
+
diff --git a/test/option/help-options.py b/test/option/help-options.py
new file mode 100644
index 0000000..5f8270f
--- /dev/null
+++ b/test/option/help-options.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 behavior of the -H and --help-options options.
+"""
+
+import re
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '-H')
+
+test.fail_test(string.find(test.stdout(), '-H, --help-options') == -1)
+test.fail_test(string.find(test.stdout(), '--debug=TYPE') == -1)
+
+# Validate that the help output lists the options in case-insensitive
+# alphabetical order.
+
+# 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 = lowered[:]
+sorted.sort()
+if lowered != sorted:
+ print "lowered =", lowered
+ print "sorted =", sorted
+ test.fail_test()
+
+test.pass_test()
+
diff --git a/test/option/no-print-directory.py b/test/option/no-print-directory.py
new file mode 100644
index 0000000..bb0abbf
--- /dev/null
+++ b/test/option/no-print-directory.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the --no-print-directory option is ignored.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '--no-print-directory .',
+ stderr = "Warning: ignoring --no-print-directory option\n")
+
+test.pass_test()
+
diff --git a/test/option/print-directory.py b/test/option/print-directory.py
new file mode 100644
index 0000000..a5d8fcf
--- /dev/null
+++ b/test/option/print-directory.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the -w and --print-directory options are ignored.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '-w .',
+ stderr = "Warning: ignoring -w option\n")
+
+test.run(arguments = '--print-directory .',
+ 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