Fix dependency scans of generated files. (John Johnson)
[scons.git] / test / HeaderInstall.py
1 #!/usr/bin/env python
2 # __COPYRIGHT__
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining
5 # a copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish,
8 # distribute, sublicense, and/or sell copies of the Software, and to
9 # permit persons to whom the Software is furnished to do so, subject to
10 # the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #
23
24 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
25
26 """
27 Test that dependencies in installed header files get re-scanned correctly.
28 """
29
30 import TestSCons
31
32 test = TestSCons.TestSCons()
33
34 test.write('SConstruct', """
35 env = Environment(CPPPATH=['#include'])
36 Export('env')
37 SConscript('dist/SConscript')
38 libfoo = env.StaticLibrary('foo', ['foo.c'])
39 Default(libfoo)
40 """)
41
42 test.write('foo.c', """
43 #include <h1.h>
44 """)
45
46 test.subdir('dist')
47
48 test.write(['dist', 'SConscript'], """\
49 Import('env')
50 env.Install('#include', ['h1.h', 'h2.h', 'h3.h'])
51 """)
52
53 test.write(['dist', 'h1.h'], """\
54 #include "h2.h"
55 """)
56
57 test.write(['dist', 'h2.h'], """\
58 #include "h3.h"
59 """)
60
61 test.write(['dist', 'h3.h'], """\
62 int foo = 3;
63 """)
64
65 test.run(arguments = ".")
66
67 test.up_to_date(arguments = ".")
68
69 test.pass_test()