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 rebuilds do not occur when SConsignFile(None) is used to
29 put a .sconsign file in each directory and we subdvide the dependency
30 tree with subsidiary *SConstruct* files in various subdirectories.
32 This depends on using content signatures for evaluation of intermediate
33 Nodes. We used to configure this explicitly using
34 TargetSignatures('content'), but we now rely on the default behavior
35 being the equivalent of Decider('content').
42 _python_ = TestSCons._python_
44 test = TestSCons.TestSCons()
46 #if os.path.exists('sconsign.py'):
47 # sconsign = 'sconsign.py'
48 #elif os.path.exists('sconsign'):
49 # sconsign = 'sconsign'
51 # print "Can find neither 'sconsign.py' nor 'sconsign' scripts."
54 test.subdir('src', ['src', 'sub'])
56 test.write('fake_cc.py', """\
58 ofp = open(sys.argv[1], 'wb')
59 ofp.write('fake_cc.py: %s\\n' % sys.argv)
60 for s in sys.argv[2:]:
61 ofp.write(open(s, 'rb').read())
64 test.write('fake_link.py', """\
66 ofp = open(sys.argv[1], 'wb')
67 ofp.write('fake_link.py: %s\\n' % sys.argv)
68 for s in sys.argv[2:]:
69 ofp.write(open(s, 'rb').read())
72 test.write('SConstruct', """\
74 env = Environment(PROGSUFFIX = '.exe',
76 CCCOM = r'%(_python_)s fake_cc.py $TARGET $SOURCES',
77 LINKCOM = r'%(_python_)s fake_link.py $TARGET $SOURCES')
78 env.SConscript('src/SConstruct', exports=['env'])
82 test.write(['src', 'SConstruct'], """\
84 env = Environment(PROGSUFFIX = '.exe',
86 CCCOM = r'%(_python_)s fake_cc.py $TARGET $SOURCES',
87 LINKCOM = r'%(_python_)s fake_link.py $TARGET $SOURCES')
88 p = env.Program('prog', ['main.c', '../foo$OBJSUFFIX', 'sub/bar.c'])
92 test.write('foo.c', """\
96 test.write(['src', 'main.c'], """\
100 test.write(['src', 'sub', 'bar.c'], """\
106 src_prog_exe = os.path.join('src', 'prog.exe')
107 src_main_c = os.path.join('src', 'main.c')
108 src_main_obj = os.path.join('src', 'main.obj')
109 src_sub_bar_c = os.path.join('src', 'sub', 'bar.c')
110 src_sub_bar_obj = os.path.join('src', 'sub', 'bar.obj')
113 fake_link.py: ['fake_link.py', '%(src_prog_exe)s', '%(src_main_obj)s', 'foo.obj', '%(src_sub_bar_obj)s']
114 fake_cc.py: ['fake_cc.py', '%(src_main_obj)s', '%(src_main_c)s']
116 fake_cc.py: ['fake_cc.py', 'foo.obj', 'foo.c']
118 fake_cc.py: ['fake_cc.py', '%(src_sub_bar_obj)s', '%(src_sub_bar_c)s']
124 expect = string.replace(expect, '\\', '\\\\')
126 test.must_match(['src', 'prog.exe'], expect)
128 test.up_to_date(chdir='src', arguments = test.workpath())
130 test.up_to_date(arguments = '.')