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
"""
42 SUBDIR_f4_out
= os
.path
.join('$SUBDIR', 'f4.out')
44 test
.write('SConstruct', """\
45 B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
46 env = Environment(BUILDERS = { 'B' : B }, SUBDIR = 'subdir')
47 f1 = env.B(target = 'f1.out', source = 'f1.in')
48 env.B(target = 'f2.out', source = 'f2.in')
49 env.B(target = 'f3.out', source = 'f3.in')
50 env.B(target = 'subdir/f4.out', source = 'f4.in')
51 env.Precious(f1, 'f2.out', r'%(SUBDIR_f4_out)s')
52 SConscript('subdir/SConscript', "env")
55 test
.write(['subdir', 'SConscript'], """
57 env.B(target = 'f5.out', source = 'f5.in')
58 f6 = env.B(target = 'f6.out', source = 'f6.in')
59 env.B(target = 'f7.out', source = 'f7.in')
60 Precious(['f5.out', f6])
63 test
.write('f1.in', "f1.in\n")
64 test
.write('f2.in', "f2.in\n")
65 test
.write('f3.in', "f3.in\n")
66 test
.write('f4.in', "f4.in\n")
68 test
.write(['subdir', 'f5.in'], "subdir/f5.in\n")
69 test
.write(['subdir', 'f6.in'], "subdir/f6.in\n")
70 test
.write(['subdir', 'f7.in'], "subdir/f7.in\n")
72 test
.write('f1.out', "SHOULD NOT BE REMOVED\n")
73 test
.write('f2.out', "SHOULD NOT BE REMOVED\n")
74 test
.write('f3.out', "SHOULD BE REMOVED\n")
75 test
.write(['subdir', 'f4.out'], "SHOULD NOT BE REMOVED\n")
77 test
.write(['subdir', 'f5.out'], "SHOULD NOT BE REMOVED\n")
78 test
.write(['subdir', 'f6.out'], "SHOULD NOT BE REMOVED\n")
79 test
.write(['subdir', 'f7.out'], "SHOULD BE REMOVED\n")
81 test
.run(arguments
= '.')
83 test
.fail_test(not os
.path
.exists(test
.workpath('f1.out')))
84 test
.fail_test(not os
.path
.exists(test
.workpath('f2.out')))
85 test
.fail_test(os
.path
.exists(test
.workpath('f3.out')))
86 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f4.out')))
88 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f5.out')))
89 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f6.out')))
90 test
.fail_test(os
.path
.exists(test
.workpath('subdir', 'f7.out')))
92 test
.write('f3.out', "SHOULD BE REMOVED\n")
93 test
.write(['subdir', 'f7.out'], "SHOULD BE REMOVED\n")
95 test
.run(arguments
= '.')
97 test
.fail_test(not os
.path
.exists(test
.workpath('f1.out')))
98 test
.fail_test(not os
.path
.exists(test
.workpath('f2.out')))
99 test
.fail_test(not os
.path
.exists(test
.workpath('f3.out')))
100 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f4.out')))
102 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f5.out')))
103 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f6.out')))
104 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f7.out')))
106 test
.write('f3.in', "f3.in 2\n")
107 test
.write(['subdir', 'f7.in'], "subdir/f7.in 2\n")
109 test
.run(arguments
= '.')
111 test
.fail_test(not os
.path
.exists(test
.workpath('f1.out')))
112 test
.fail_test(not os
.path
.exists(test
.workpath('f2.out')))
113 test
.fail_test(os
.path
.exists(test
.workpath('f3.out')))
114 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f4.out')))
116 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f5.out')))
117 test
.fail_test(not os
.path
.exists(test
.workpath('subdir', 'f6.out')))
118 test
.fail_test(os
.path
.exists(test
.workpath('subdir', 'f7.out')))
124 # indent-tabs-mode:nil
126 # vim: set expandtab tabstop=4 shiftwidth=4: