diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-04-26 14:34:34 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2019-04-26 14:34:34 (GMT) |
commit | 095970b093e2eb1c9d86ae55379d3bb0412cfd85 (patch) | |
tree | 9c84696413af70b09cf66264fe00bc865ea7ae59 /test | |
parent | 0b9d8672365b01468fca5ba95594b92d307c94e9 (diff) | |
download | SCons-095970b093e2eb1c9d86ae55379d3bb0412cfd85.zip SCons-095970b093e2eb1c9d86ae55379d3bb0412cfd85.tar.gz SCons-095970b093e2eb1c9d86ae55379d3bb0412cfd85.tar.bz2 |
Initial testcase logic to fix Issue #2811
Diffstat (limited to 'test')
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/SConstruct | 62 | ||||
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/a | 8 | ||||
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/b.in | 2 | ||||
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/c | 0 | ||||
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/f | 0 | ||||
-rw-r--r-- | test/TaskMaster/bug_2811/fixture_dir/g | 0 |
6 files changed, 72 insertions, 0 deletions
diff --git a/test/TaskMaster/bug_2811/fixture_dir/SConstruct b/test/TaskMaster/bug_2811/fixture_dir/SConstruct new file mode 100644 index 0000000..5fcc5f2 --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/SConstruct @@ -0,0 +1,62 @@ +""" +This issue requires the following. +1. Generated source file which outputs 2 (or more) files +2. Action string gets scanned providing only compiler as part of implicit scan +3. Generated file gets built. Without the bugfix only the first target's .implicit list is cleared. +4. builder/executor/action gets tried again and implicits scanned. 2nd to Nth targets end up + with the compiler at the beginning of the implicit list and the rest of the scanned files added to that list. +5. That bimplicit gets saved into sconsign +6. Second run loads sconsign, now with generated file present a regular implicit scan occurs. This yields 2nd through + Nth target's implicit lists changing when compared to SConsign's which have been loaded. +7. This forces rebuild of source file and this propagates to massive recompile +""" +import SCons.Tool + + +def _dwo_emitter(target, source, env): + new_targets = [] + for t in target: + base, ext = SCons.Util.splitext(str(t)) + if not any(ext == env[osuffix] for osuffix in ['OBJSUFFIX', 'SHOBJSUFFIX']): + continue + # TODO: Move 'dwo' into DWOSUFFIX so it can be customized? For + # now, GCC doesn't let you control the output filename, so it + # doesn't matter. + dwotarget = (t.builder.target_factory or env.File)(base + ".dwo") + new_targets.append(dwotarget) + targets = target + new_targets + return (targets, source) + + +bld = Builder(action='cp $SOURCE $TARGET') + +env = Environment(BUILDERS={'Foo': bld}) + +env['SHCCCOM'] = 'cp $SOURCE $TARGET && cp $SOURCE ${TARGETS[1]}' +env['SHCCCOMSTR'] = env['SHCCCOM'] + + +suffixes = ['.c'] + +for object_builder in SCons.Tool.createObjBuilders(env): + emitterdict = object_builder.builder.emitter + for suffix in emitterdict.iterkeys(): + if not suffix in suffixes: + continue + base = emitterdict[suffix] + emitterdict[suffix] = SCons.Builder.ListEmitter([ + base, + _dwo_emitter, + ]) + +vs = ['a'] + +for v in vs: + env.Foo('%s.c' % v, v) + env.SharedObject('%s.c'%v) + +env.Foo('b','b.in') +# seems like processing is always alphabetical.. + + +# code: language=python insertSpaces=4 tabSize=4
\ No newline at end of file diff --git a/test/TaskMaster/bug_2811/fixture_dir/a b/test/TaskMaster/bug_2811/fixture_dir/a new file mode 100644 index 0000000..d3f62b8 --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/a @@ -0,0 +1,8 @@ +#include "b" +// #include "c" +// #include "d" +// #include "e" + +int dummy() { + return 1; +}
\ No newline at end of file diff --git a/test/TaskMaster/bug_2811/fixture_dir/b.in b/test/TaskMaster/bug_2811/fixture_dir/b.in new file mode 100644 index 0000000..867daaf --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/b.in @@ -0,0 +1,2 @@ +#include "f" +#include "g" diff --git a/test/TaskMaster/bug_2811/fixture_dir/c b/test/TaskMaster/bug_2811/fixture_dir/c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/c diff --git a/test/TaskMaster/bug_2811/fixture_dir/f b/test/TaskMaster/bug_2811/fixture_dir/f new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/f diff --git a/test/TaskMaster/bug_2811/fixture_dir/g b/test/TaskMaster/bug_2811/fixture_dir/g new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/TaskMaster/bug_2811/fixture_dir/g |