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 the sconsign script works when using a .sconsign file in
29 each subdirectory (SConsignFile(None)) written with the non-default
30 value of Decider('timestamp-newer').
32 This used to test the non-default combination of
33 SourceSignatures('timestamp') with TargetSignatures('content').
39 python = TestSCons.python
40 _python_ = TestSCons._python_
42 test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
44 # Note: We don't use os.path.join() representations of the file names
45 # in the expected output because paths in the .sconsign files are
46 # canonicalized to use / as the separator.
48 sub1_hello_c = 'sub1/hello.c'
49 sub1_hello_obj = 'sub1/hello.obj'
51 test.subdir('sub1', 'sub2')
53 test.write('fake_cc.py', r"""
59 path = string.split(sys.argv[1])
60 output = open(sys.argv[2], 'wb')
61 input = open(sys.argv[3], 'rb')
63 output.write('fake_cc.py: %s\n' % sys.argv)
72 def process(infp, outfp):
73 for line in infp.readlines():
74 m = re.match('#include <(.*)>', line)
77 process(find_file(file), outfp)
81 process(input, output)
86 test.write('fake_link.py', r"""
89 output = open(sys.argv[1], 'wb')
90 input = open(sys.argv[2], 'rb')
92 output.write('fake_link.py: %s\n' % sys.argv)
94 output.write(input.read())
99 test.write('SConstruct', """
101 Decider('timestamp-newer')
102 env1 = Environment(PROGSUFFIX = '.exe',
104 CCCOM = r'%(_python_)s fake_cc.py sub2 $TARGET $SOURCE',
105 LINKCOM = r'%(_python_)s fake_link.py $TARGET $SOURCE')
106 env1.Program('sub1/hello.c')
107 env2 = env1.Clone(CPPPATH = ['sub2'])
108 env2.Program('sub2/hello.c')
111 test.write(['sub1', 'hello.c'], r"""\
115 test.write(['sub2', 'hello.c'], r"""\
121 test.write(['sub2', 'inc1.h'], r"""\
122 #define STRING1 "inc1.h"
125 test.write(['sub2', 'inc2.h'], r"""\
126 #define STRING2 "inc2.h"
131 test.run(arguments = '. --max-drift=1')
133 sig_re = r'[0-9a-fA-F]{32}'
134 date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d'
136 test.run_sconsign(arguments = "-e hello.exe -e hello.obj sub1/.sconsign",
137 stdout = r"""hello.exe: %(sig_re)s \d+ \d+
138 %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
139 %(python)s: None \d+ \d+
141 hello.obj: %(sig_re)s \d+ \d+
142 %(sub1_hello_c)s: None \d+ \d+
143 %(python)s: None \d+ \d+
147 test.run_sconsign(arguments = "-e hello.exe -e hello.obj -r sub1/.sconsign",
148 stdout = r"""hello.exe: %(sig_re)s '%(date_re)s' \d+
149 %(sub1_hello_obj)s: %(sig_re)s '%(date_re)s' \d+
150 %(python)s: None '%(date_re)s' \d+
152 hello.obj: %(sig_re)s '%(date_re)s' \d+
153 %(sub1_hello_c)s: None '%(date_re)s' \d+
154 %(python)s: None '%(date_re)s' \d+