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 Test case for the bug report:
29 "[ 1088979 ] Unnecessary rebuild with generated header file"
30 (<http://sourceforge.net/tracker/index.php?func=detail&aid=1088979&group_id=30337&atid=398971>).
32 Unnecessary rebuild with generated header file
33 Scons rebuilds some nodes when invoked twice. The
34 trigger seems to be a generated C++ source file that
35 includes a header file that also is generated.
37 A tarball with a minimal test case is attached.
38 Transcript for reproducing:
41 tar xzf scons_rebuild_debug.tar.gz
42 cd scons_rebuild_debug
47 Note that the bug is not triggered when scons is run
50 This may be a duplicate to bug 1019683.
57 test = TestSCons.TestSCons()
61 if sys.platform == 'win32':
62 generator_name = 'generator.bat'
63 test.write(generator_name, '@echo #include "header.hh"')
64 kernel_action = "$SOURCES > $TARGET"
66 generator_name = 'generator.sh'
67 test.write(generator_name, 'echo \'#include "header.hh"\'')
68 kernel_action = "sh $SOURCES > $TARGET"
70 test.write('SConstruct', """\
74 kernelDefines = env.Command("header.hh",
78 kernelImporterSource = env.Command(
79 "generated.cc", ["%s"],
82 kernelImporter = env.Program(
83 kernelImporterSource + ["main.cc"])
85 kernelImports = env.Command(
86 "KernelImport.hh", kernelImporter,
87 ".%s$SOURCE > $TARGET")
89 osLinuxModule = env.StaticObject(
91 """ % (generator_name, kernel_action, os.sep))
93 test.write('main.cc', """\
101 test.write('target.cc', """\
104 #include "KernelImport.hh"
109 test.run(arguments = 'target' + _obj)
111 expected_stdout = """\
112 scons: Reading SConscript files ...
113 scons: done reading SConscript files.
114 scons: Building targets ...
115 scons: `target%(_obj)s' is up to date.
116 scons: done building targets.
119 test.run(arguments = 'target' + _obj, stdout=expected_stdout)
125 # indent-tabs-mode:nil
127 # vim: set expandtab tabstop=4 shiftwidth=4: