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_ = TestSCons._python_
33 test = TestSCons.TestSCons()
37 test.write('build.py', r"""
39 contents = open(sys.argv[2], 'rb').read() + open(sys.argv[3], 'rb').read()
40 file = open(sys.argv[1], 'wb')
41 for arg in sys.argv[2:]:
42 file.write(open(arg, 'rb').read())
46 SUBDIR_f3_out = os.path.join('$SUBDIR', 'f3.out')
47 SUBDIR_f3b_in = os.path.join('$SUBDIR', 'f3b.in')
49 test.write('SConstruct', """\
50 Foo = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
51 Bar = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
52 env = Environment(BUILDERS = { 'Foo' : Foo, 'Bar' : Bar }, SUBDIR='subdir')
53 env.Foo(target = 'f1.out', source = ['f1a.in', 'f1b.in'])
54 Ignore(target = 'f1.out', dependency = 'f1b.in')
55 SConscript('subdir/SConscript', "env")
56 env.Foo(target = 'subdir/f3.out', source = ['subdir/f3a.in', 'subdir/f3b.in'])
57 env.Ignore(target = r'%(SUBDIR_f3_out)s', dependency = r'%(SUBDIR_f3b_in)s')
60 test.write(['subdir', 'SConscript'], """
62 env.Bar(target = 'f2.out', source = ['f2a.in', 'f2b.in'])
63 env.Ignore('f2.out', 'f2a.in')
66 test.write('f1a.in', "f1a.in\n")
67 test.write('f1b.in', "f1b.in\n")
69 test.write(['subdir', 'f2a.in'], "subdir/f2a.in\n")
70 test.write(['subdir', 'f2b.in'], "subdir/f2b.in\n")
72 test.write(['subdir', 'f3a.in'], "subdir/f3a.in\n")
73 test.write(['subdir', 'f3b.in'], "subdir/f3b.in\n")
75 test.run(arguments = '.')
77 test.must_match('f1.out', "f1a.in\nf1b.in\n")
78 test.must_match(['subdir', 'f2.out'], "subdir/f2a.in\nsubdir/f2b.in\n")
79 test.must_match(['subdir', 'f3.out'], "subdir/f3a.in\nsubdir/f3b.in\n")
81 test.up_to_date(arguments = '.')
83 test.write('f1b.in', "f1b.in 2\n")
84 test.write(['subdir', 'f2a.in'], "subdir/f2a.in 2\n")
85 test.write(['subdir', 'f3b.in'], "subdir/f3b.in 2\n")
87 test.up_to_date(arguments = '.')
89 test.must_match('f1.out', "f1a.in\nf1b.in\n")
90 test.must_match(['subdir', 'f2.out'], "subdir/f2a.in\nsubdir/f2b.in\n")
91 test.must_match(['subdir', 'f3.out'], "subdir/f3a.in\nsubdir/f3b.in\n")
93 test.write('f1a.in', "f1a.in 2\n")
94 test.write(['subdir', 'f2b.in'], "subdir/f2b.in 2\n")
95 test.write(['subdir', 'f3a.in'], "subdir/f3a.in 2\n")
97 test.run(arguments = '.')
99 test.must_match('f1.out', "f1a.in 2\nf1b.in 2\n")
100 test.must_match(['subdir', 'f2.out'], "subdir/f2a.in 2\nsubdir/f2b.in 2\n")
101 test.must_match(['subdir', 'f3.out'], "subdir/f3a.in 2\nsubdir/f3b.in 2\n")
103 test.up_to_date(arguments = '.')
106 test.write('SConstruct', """\
108 file1 = File('file1')
109 file2 = File('file2')
110 env.Ignore(file1, [[file2, 'file3']])
113 test.up_to_date(arguments = '.')
119 # indent-tabs-mode:nil
121 # vim: set expandtab tabstop=4 shiftwidth=4: