3 # Copyright (c) 2001 Steven Knight
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
31 python = sys.executable
33 test = TestSCons.TestSCons()
35 test.subdir('one', 'two', 'three')
37 test.write('build.py', r"""
39 exitval = int(sys.argv[1])
41 contents = open(sys.argv[3], 'rb').read()
42 file = open(sys.argv[2], 'wb')
48 test.write(['one', 'SConstruct'], """
49 B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
50 B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
51 env = Environment(BUILDERS = [B0, B1])
52 env.B1(target = 'f1.out', source = 'f1.in')
53 env.B0(target = 'f2.out', source = 'f2.in')
54 env.B0(target = 'f3.out', source = 'f3.in')
55 """ % (python, python))
57 test.write(['one', 'f1.in'], "one/f1.in\n")
58 test.write(['one', 'f2.in'], "one/f2.in\n")
59 test.write(['one', 'f3.in'], "one/f3.in\n")
61 test.run(chdir = 'one', arguments = "f1.out f2.out f3.out",
62 stderr = "scons: *** [f1.out] Error 1\n")
64 test.fail_test(os.path.exists(test.workpath('f1.out')))
65 test.fail_test(os.path.exists(test.workpath('f2.out')))
66 test.fail_test(os.path.exists(test.workpath('f3.out')))
68 test.write(['two', 'SConstruct'], """
69 B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
70 B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
71 env = Environment(BUILDERS = [B0, B1])
72 env.B0(target = 'f1.out', source = 'f1.in')
73 env.B1(target = 'f2.out', source = 'f2.in')
74 env.B0(target = 'f3.out', source = 'f3.in')
75 """ % (python, python))
77 test.write(['two', 'f1.in'], "two/f1.in\n")
78 test.write(['two', 'f2.in'], "two/f2.in\n")
79 test.write(['two', 'f3.in'], "two/f3.in\n")
81 test.run(chdir = 'two', arguments = "f1.out f2.out f3.out",
82 stderr = "scons: *** [f2.out] Error 1\n")
84 test.fail_test(test.read(['two', 'f1.out']) != "two/f1.in\n")
85 test.fail_test(os.path.exists(test.workpath('f2.out')))
86 test.fail_test(os.path.exists(test.workpath('f3.out')))
88 test.write(['three', 'SConstruct'], """
89 B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
90 B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
91 env = Environment(BUILDERS = [B0, B1])
92 env.B0(target = 'f1.out', source = 'f1.in')
93 env.B0(target = 'f2.out', source = 'f2.in')
94 env.B1(target = 'f3.out', source = 'f3.in')
95 """ % (python, python))
97 test.write(['three', 'f1.in'], "three/f1.in\n")
98 test.write(['three', 'f2.in'], "three/f2.in\n")
99 test.write(['three', 'f3.in'], "three/f3.in\n")
101 test.run(chdir = 'three', arguments = "f1.out f2.out f3.out",
102 stderr = "scons: *** [f3.out] Error 1\n")
104 test.fail_test(test.read(['three', 'f1.out']) != "three/f1.in\n")
105 test.fail_test(test.read(['three', 'f2.out']) != "three/f2.in\n")
106 test.fail_test(os.path.exists(test.workpath('f3.out')))