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__"
28 Verify that, when a file is specified multiple times in a target
29 list, we still build all of the necessary targets.
31 This used to cause a target to "disappear" from the DAG when its reference
32 count dropped below 0, because we were subtracting the duplicated target
33 mutiple times even though we'd only visit it once. This was particularly
34 hard to track down because the DAG itself (when printed with --tree=prune,
35 for example) doesn't show the duplication in the *target* list.
40 _python_
= TestSCons
._python
_
42 test
= TestSCons
.TestSCons()
44 test
.subdir('work', ['work', 'sub'])
46 tar_output
= test
.workpath('work.tar')
48 test
.write(['work', 'mycopy.py'], """\
51 time.sleep(int(sys.argv[1]))
52 with open(sys.argv[2], 'wb') as ofp, open(sys.argv[3], 'rb') as ifp:
56 test
.write(['work', 'mytar.py'], """\
60 ofp = open(sys.argv[1], 'wb')
63 names = os.listdir(dirname)
66 p = os.path.join(dirname, n)
69 elif os.path.isfile(p):
70 with open(p, 'rb') as ifp:
73 for s in sys.argv[2:]:
78 test
.write(['work', 'SConstruct'], """\
80 out1 = File('sub/f1.out')
81 out2 = File('sub/f2.out')
82 env.Command([out1, out1], 'sub/f1.in',
83 r'%(_python_)s mycopy.py 3 $TARGET $SOURCE')
84 env.Command([out2, out2], 'sub/f2.in',
85 r'%(_python_)s mycopy.py 3 $TARGET $SOURCE')
87 env.Command(r'%(tar_output)s', Dir('sub'),
88 r'%(_python_)s mytar.py $TARGET $SOURCE')
91 test
.write(['work', 'sub', 'f1.in'], "work/sub/f1.in\n")
92 test
.write(['work', 'sub', 'f2.in'], "work/sub/f2.in\n")
94 test
.run(chdir
= 'work', arguments
= tar_output
+ ' -j2')
96 test
.must_match(['work', 'sub', 'f1.out'], "work/sub/f1.in\n")
97 test
.must_match(['work', 'sub', 'f2.out'], "work/sub/f2.in\n")
98 test
.must_match(tar_output
, """\
109 # indent-tabs-mode:nil
111 # vim: set expandtab tabstop=4 shiftwidth=4: