diff options
author | Steven Knight <knight@baldmt.com> | 2004-05-19 17:49:55 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-05-19 17:49:55 (GMT) |
commit | afc2ed0070c73d8f0dbc24ba3fe5e5773522beaa (patch) | |
tree | 9122729d1120c1119fe10ff360f4675789ca8f9b /test/DSUFFIXES.py | |
parent | e2763b54fc32b24169586918481d31b6234c0ae4 (diff) | |
download | SCons-afc2ed0070c73d8f0dbc24ba3fe5e5773522beaa.zip SCons-afc2ed0070c73d8f0dbc24ba3fe5e5773522beaa.tar.gz SCons-afc2ed0070c73d8f0dbc24ba3fe5e5773522beaa.tar.bz2 |
Fix spurious rebuilds/reinstalls of header files and circular dependencies with generated header files by allowing Scanners to be associated explicitly with Builders, not just through Scanner file suffix lists.
Diffstat (limited to 'test/DSUFFIXES.py')
-rw-r--r-- | test/DSUFFIXES.py | 122 |
1 files changed, 105 insertions, 17 deletions
diff --git a/test/DSUFFIXES.py b/test/DSUFFIXES.py index 6f10439..188da9b 100644 --- a/test/DSUFFIXES.py +++ b/test/DSUFFIXES.py @@ -25,43 +25,131 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that we can add filesuffixes to $DSUFFIXES. +Test the ability to scan additional filesuffixes added to $DSUFFIXES. """ import TestSCons +python = TestSCons.python + test = TestSCons.TestSCons() +test.write('mydc.py', r""" +import string +import sys +def do_file(outf, inf): + for line in open(inf, 'rb').readlines(): + if line[:7] == 'import ': + do_file(outf, line[7:-2]+'.d') + else: + outf.write(line) +outf = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + do_file(outf, f) +sys.exit(0) +""") + test.write('SConstruct', """ -env = Environment(DPATH=['.']) -env.Append(DSUFFIXES = ['.x']) -env.InstallAs('foo_d', 'foo.d') -env.InstallAs('foo_x', 'foo.x') +env = Environment(DPATH = ['.'], + DC = r'%s mydc.py', + DFLAGS = [], + DCOM = '$DC $TARGET $SOURCES', + OBJSUFFIX = '.o') +env.Append(CPPSUFFIXES = ['.x']) +env.Object(target = 'test1', source = 'test1.d') +env.InstallAs('test1_d', 'test1.d') +env.InstallAs('test2_d', 'test2.d') +env.InstallAs('test3_d', 'test3.d') +""" % (python,)) + +test.write('test1.d', """\ +test1.d 1 +import test2; +import test3; +""") + +test.write('test2.d', """\ +test2.d 1 +import foo; """) -test.write('foo.d', """\ -import inc; +test.write('test3.d', """\ +test3.d 1 +import foo; """) -test.write('foo.x', """\ -import inc; +test.write('foo.d', "foo.d 1\n") + +test.run(arguments='.', stdout=test.wrap_stdout("""\ +%s mydc.py test1.o test1.d +Install file: "test1.d" as "test1_d" +Install file: "test2.d" as "test2_d" +Install file: "test3.d" as "test3_d" +""" % (python,))) + +test.must_match('test1.o', """\ +test1.d 1 +test2.d 1 +foo.d 1 +test3.d 1 +foo.d 1 +""") + +test.up_to_date(arguments='.') + +test.write('foo.d', "foo.d 2\n") + +test.run(arguments='.', stdout=test.wrap_stdout("""\ +%s mydc.py test1.o test1.d +""" % (python,))) + +test.must_match('test1.o', """\ +test1.d 1 +test2.d 1 +foo.d 2 +test3.d 1 +foo.d 2 """) -test.write('inc.d', "inc.d 1\n") +test.up_to_date(arguments='.') + +test.write('test3.d', """\ +test3.d 2 +import foo; +""") test.run(arguments='.', stdout=test.wrap_stdout("""\ -Install file: "foo.d" as "foo_d" -Install file: "foo.x" as "foo_x" -""")) +%s mydc.py test1.o test1.d +Install file: "test3.d" as "test3_d" +""" % (python,))) + +test.must_match('test1.o', """\ +test1.d 1 +test2.d 1 +foo.d 2 +test3.d 2 +foo.d 2 +""") test.up_to_date(arguments='.') -test.write('inc.d', "inc 2\n") +test.write('test2.d', """\ +test2.d 2 +import foo; +""") test.run(arguments='.', stdout=test.wrap_stdout("""\ -Install file: "foo.d" as "foo_d" -Install file: "foo.x" as "foo_x" -""")) +%s mydc.py test1.o test1.d +Install file: "test2.d" as "test2_d" +""" % (python,))) + +test.must_match('test1.o', """\ +test1.d 1 +test2.d 2 +foo.d 2 +test3.d 2 +foo.d 2 +""") test.up_to_date(arguments='.') |