summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-02-24 06:19:49 (GMT)
committerSteven Knight <knight@baldmt.com>2004-02-24 06:19:49 (GMT)
commit4b3d35e6964da9108f1d55a8d0dbb2161300bd3f (patch)
tree21ab8d3cc408214f1e550bf4df7a27c3b45115fe /test
parentd8b17914c7e3983c6c68c7aea2f0a835f00ddb07 (diff)
downloadSCons-4b3d35e6964da9108f1d55a8d0dbb2161300bd3f.zip
SCons-4b3d35e6964da9108f1d55a8d0dbb2161300bd3f.tar.gz
SCons-4b3d35e6964da9108f1d55a8d0dbb2161300bd3f.tar.bz2
Handle recursive substitution in overrides.
Diffstat (limited to 'test')
-rw-r--r--test/CCFLAGS.py10
-rw-r--r--test/LIBS.py44
-rw-r--r--test/overrides.py10
3 files changed, 47 insertions, 17 deletions
diff --git a/test/CCFLAGS.py b/test/CCFLAGS.py
index 60fb74e..6664010 100644
--- a/test/CCFLAGS.py
+++ b/test/CCFLAGS.py
@@ -45,6 +45,8 @@ foo.Object(target = 'foo%s', source = 'prog.c')
bar.Object(target = 'bar%s', source = 'prog.c')
foo.Program(target = 'foo', source = 'foo%s')
bar.Program(target = 'bar', source = 'bar%s')
+foo.Program(target = 'prog', source = 'prog.c',
+ CCFLAGS = '$CCFLAGS -DBAR $BAZ', BAZ = '-DBAZ')
""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
test.write('prog.c', r"""
@@ -58,6 +60,9 @@ main(int argc, char *argv[])
#ifdef BAR
printf("prog.c: BAR\n");
#endif
+#ifdef BAZ
+ printf("prog.c: BAZ\n");
+#endif
exit (0);
}
""")
@@ -67,6 +72,11 @@ test.run(arguments = '.')
test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+test.run(program = test.workpath('prog'), stdout = """\
+prog.c: FOO
+prog.c: BAR
+prog.c: BAZ
+""")
test.write('SConstruct', """
bar = Environment(CCFLAGS = '%s')
diff --git a/test/LIBS.py b/test/LIBS.py
index e66899e..645c625 100644
--- a/test/LIBS.py
+++ b/test/LIBS.py
@@ -121,8 +121,8 @@ test.run(program=foo4_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
#
test.write('SConstruct', """
-env = Environment()
-env.Program(target='foo1', source='foo1.c', LIBS=['baz', 'bar'], LIBPATH = '.')
+env = Environment(LIBS=['baz'])
+env.Program(target='foo1', source='foo1.c', LIBS=['$LIBS', 'bar'], LIBPATH = '.')
SConscript('sub1/SConscript', 'env')
SConscript('sub2/SConscript', 'env')
""")
@@ -187,7 +187,18 @@ libraries = (['libtest_component2',
'libtest_component1'])
# To remove the dependency problem, you should rename blender to mlender.
-Program (source='', target='blender', LIBS=libraries, LIBPREFIX='lib', LIBPATH=libpath)
+Program (source='main.c', target='blender', LIBS=libraries, LIBPREFIX='lib', LIBPATH=libpath, CPPPATH=['src/component2'])
+""")
+
+test.write('main.c', """\
+#include <stdio.h>
+#include "message2.h"
+
+int main (void)
+{
+ DisplayMessage2();
+ exit (0);
+}
""")
test.write(['src', 'SConscript'], """\
@@ -196,38 +207,41 @@ SConscript(['component1/SConscript',
""")
test.write(['src', 'component1', 'SConscript'], """\
-source_files = ['message.c']
-Library (target='../../lib/libtest_component1', source=source_files)
+source_files = ['message1.c']
+Library (target='../../lib/libtest_component1', source=source_files, LINKFLAGS='')
""")
-test.write(['src', 'component1', 'message.c'], """\
+test.write(['src', 'component1', 'message1.c'], """\
#include <stdio.h>
-void DisplayMessage (void)
+void DisplayMessage1 (void)
{
printf ("src/component1/message.c\\n");
}
""")
-test.write(['src', 'component1', 'message.h'], """\
-void DisplayMessage (void);
+test.write(['src', 'component1', 'message1.h'], """\
+void DisplayMessage1 (void);
""")
test.write(['src', 'component2', 'SConscript'], """\
-source_files = ['hello.c']
+source_files = ['message2.c']
include_paths = ['../component1']
Library (target='../../lib/libtest_component2', source=source_files, CPPPATH=include_paths)
""")
-test.write(['src', 'component2', 'hello.c'], """\
+test.write(['src', 'component2', 'message2.h'], """\
+void DisplayMessage2 (void);
+""")
+
+test.write(['src', 'component2', 'message2.c'], """\
#include <stdio.h>
-#include "message.h"
+#include "message1.h"
-int main (void)
+int DisplayMessage2 (void)
{
- DisplayMessage();
+ DisplayMessage1();
printf ("src/component2/hello.c\\n");
- exit (0);
}
""")
diff --git a/test/overrides.py b/test/overrides.py
index d9b6fde..a247f7d 100644
--- a/test/overrides.py
+++ b/test/overrides.py
@@ -34,14 +34,18 @@ test = TestSCons.TestSCons()
python = TestSCons.python
test.write('SConstruct', """
-env = Environment(LIBS=['a'])
+env = Environment(CCFLAGS='-DFOO', LIBS=['a'])
def build(target, source, env):
print "env['CC'] =", env['CC']
+ print "env['CCFLAGS'] =", env['CCFLAGS']
print "env['LIBS'] =", env['LIBS']
builder = Builder(action=build, CC='buildcc', LIBS='buildlibs')
env['BUILDERS']['Build'] = builder
-foo = env.Build('foo.out', 'foo.in', CC='mycc', LIBS = env['LIBS']+['b'])
+foo = env.Build('foo.out', 'foo.in',
+ CC='mycc',
+ CCFLAGS='$CCFLAGS -DBAR',
+ LIBS = env['LIBS']+['b'])
bar = env.Build('bar.out', 'bar.in')
Default([foo, bar])
""")
@@ -52,9 +56,11 @@ test.write('bar.in', "bar.in\n")
test.run(arguments = "-Q", stdout = """\
build("foo.out", "foo.in")
env['CC'] = mycc
+env['CCFLAGS'] = -DFOO -DBAR
env['LIBS'] = ['a', 'b']
build("bar.out", "bar.in")
env['CC'] = buildcc
+env['CCFLAGS'] = -DFOO
env['LIBS'] = buildlibs
""")