summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-11-13 21:56:57 (GMT)
committerSteven Knight <knight@baldmt.com>2004-11-13 21:56:57 (GMT)
commit09cad6ed1ffb436742adbbf6608bb094b4a236e2 (patch)
treeb6c4b1f529c82d39dab94b26fb1440980955c8fe /test
parent206adf4366654b0c3fcf8c9131140f0c11ae0a5f (diff)
downloadSCons-09cad6ed1ffb436742adbbf6608bb094b4a236e2.zip
SCons-09cad6ed1ffb436742adbbf6608bb094b4a236e2.tar.gz
SCons-09cad6ed1ffb436742adbbf6608bb094b4a236e2.tar.bz2
Allow Alias Nodes to have Actions.
Diffstat (limited to 'test')
-rw-r--r--test/Alias/Alias.py (renamed from test/Alias.py)12
-rw-r--r--test/Alias/action.py138
-rw-r--r--test/Alias/errors.py46
-rw-r--r--test/Alias/scanner.py (renamed from test/Alias-scanner.py)0
4 files changed, 184 insertions, 12 deletions
diff --git a/test/Alias.py b/test/Alias/Alias.py
index 1facd28..56efafd 100644
--- a/test/Alias.py
+++ b/test/Alias/Alias.py
@@ -166,16 +166,4 @@ test.run(arguments = 'f1.out',
test.up_to_date(arguments = 'f1.out')
-test.write('SConstruct', """
-env=Environment()
-TargetSignatures('content')
-env.Alias('C', 'D')
-env.Alias('B', 'C')
-env.Alias('A', 'B')
-""")
-
-test.run(arguments='A',
- stderr="scons: \\*\\*\\* Source `D' not found, needed by target `C'. Stop.\n",
- status=2)
-
test.pass_test()
diff --git a/test/Alias/action.py b/test/Alias/action.py
new file mode 100644
index 0000000..ea0eac2
--- /dev/null
+++ b/test/Alias/action.py
@@ -0,0 +1,138 @@
+#!/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.
+#
+
+"""
+Test that Aliases with actions work.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import TestSCons
+import TestCmd
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+def cat(target, source, env):
+ target = str(target[0])
+ source = map(str, source)
+ f = open(target, "wb")
+ for src in source:
+ f.write(open(src, "rb").read())
+ f.close()
+
+def foo(target, source, env):
+ target = map(str, target)
+ source = map(str, source)
+ open('foo', 'wb').write("foo(%s, %s)\\n" % (target, source))
+
+def bar(target, source, env):
+ target = map(str, target)
+ source = map(str, source)
+ open('bar', 'wb').write("bar(%s, %s)\\n" % (target, source))
+
+env = Environment(BUILDERS = {'Cat':Builder(action=cat)})
+env.Alias(target = ['build-f1'], source = 'f1.out', action = foo)
+f1 = env.Cat('f1.out', 'f1.in')
+f2 = env.Cat('f2.out', 'f2.in')
+f3 = env.Cat('f3.out', 'f3.in')
+f4 = env.Cat('f4.out', 'f4.in')
+f5 = env.Cat('f5.out', 'f5.in')
+f6 = env.Cat('f6.out', 'f6.in')
+env.Alias('build-all', [f1, f2, f3], foo)
+env.Alias('build-add1', f3, foo)
+env.Alias('build-add1', f2)
+env.Alias('build-add2a', f4)
+env.Alias('build-add2b', f5)
+env.Alias(['build-add2a', 'build-add2b'], action=foo)
+env.Alias('build-add3', f6)
+env.Alias('build-add3', action=foo)
+env.Alias('build-add3', action=bar)
+""")
+
+test.write('f1.in', "f1.in 1\n")
+test.write('f2.in', "f2.in 1\n")
+test.write('f3.in', "f3.in 1\n")
+test.write('f4.in', "f4.in 1\n")
+test.write('f5.in', "f5.in 1\n")
+test.write('f6.in', "f6.in 1\n")
+
+test.run(arguments = 'build-f1')
+
+test.must_match('f1.out', "f1.in 1\n")
+test.must_match('foo', "foo(['build-f1'], ['f1.out'])\n")
+
+test.up_to_date(arguments = 'build-f1')
+
+test.write('f1.in', "f1.in 2\n")
+test.unlink('foo')
+
+test.run(arguments = 'build-f1')
+
+test.must_match('f1.out', "f1.in 2\n")
+test.must_match('foo', "foo(['build-f1'], ['f1.out'])\n")
+
+test.run(arguments = 'build-all')
+
+test.must_match('f1.out', "f1.in 2\n")
+test.must_match('f2.out', "f2.in 1\n")
+test.must_match('f3.out', "f3.in 1\n")
+test.must_match('foo', "foo(['build-all'], ['f1.out', 'f2.out', 'f3.out'])\n")
+
+test.up_to_date(arguments = 'build-all')
+test.up_to_date(arguments = 'build-add1')
+
+test.write('f1.in', "f1.in 3\n")
+test.write('f3.in', "f3.in 2\n")
+test.unlink('foo')
+
+test.run(arguments = 'build-add1')
+
+test.must_match('f1.out', "f1.in 2\n")
+test.must_match('f2.out', "f2.in 1\n")
+test.must_match('f3.out', "f3.in 2\n")
+test.must_match('foo', "foo(['build-add1'], ['f3.out', 'f2.out'])\n")
+
+test.up_to_date(arguments = 'build-add1')
+
+test.run(arguments = 'build-add2a')
+
+test.must_match('f4.out', "f4.in 1\n")
+test.must_not_exist('f5.out')
+test.must_match('foo', "foo(['build-add2a'], ['f4.out'])\n")
+
+test.run(arguments = 'build-add2b')
+
+test.must_match('f5.out', "f5.in 1\n")
+test.must_match('foo', "foo(['build-add2b'], ['f5.out'])\n")
+
+test.run(arguments = 'build-add3')
+
+test.must_match('f6.out', "f6.in 1\n")
+test.must_match('foo', "foo(['build-add3'], ['f6.out'])\n")
+test.must_match('bar', "bar(['build-add3'], ['f6.out'])\n")
+
+test.pass_test()
diff --git a/test/Alias/errors.py b/test/Alias/errors.py
new file mode 100644
index 0000000..f2ca950
--- /dev/null
+++ b/test/Alias/errors.py
@@ -0,0 +1,46 @@
+#!/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 os
+import sys
+import TestSCons
+import TestCmd
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env=Environment()
+TargetSignatures('content')
+env.Alias('C', 'D')
+env.Alias('B', 'C')
+env.Alias('A', 'B')
+""")
+
+test.run(arguments='A',
+ stderr="scons: *** Source `D' not found, needed by target `C'. Stop.\n",
+ status=2)
+
+test.pass_test()
diff --git a/test/Alias-scanner.py b/test/Alias/scanner.py
index 3ce14dd..3ce14dd 100644
--- a/test/Alias-scanner.py
+++ b/test/Alias/scanner.py