summaryrefslogtreecommitdiffstats
path: root/test/CPPPATH.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-03-12 21:53:24 (GMT)
committerSteven Knight <knight@baldmt.com>2002-03-12 21:53:24 (GMT)
commita441c8d1cc8bf1ed0817b4b1deb9ff2e912bb9f0 (patch)
tree5ee2cd288a5dc2d36b8ac73483d460fd0107302a /test/CPPPATH.py
parent50ef9e4b3dbf4f1a345297d12ffe98679c50d9d1 (diff)
downloadSCons-a441c8d1cc8bf1ed0817b4b1deb9ff2e912bb9f0.zip
SCons-a441c8d1cc8bf1ed0817b4b1deb9ff2e912bb9f0.tar.gz
SCons-a441c8d1cc8bf1ed0817b4b1deb9ff2e912bb9f0.tar.bz2
Support whitespace separated CPPPATH, etc. (Task 49057). (Steve Leblanc)
Diffstat (limited to 'test/CPPPATH.py')
-rw-r--r--test/CPPPATH.py50
1 files changed, 35 insertions, 15 deletions
diff --git a/test/CPPPATH.py b/test/CPPPATH.py
index 372f6b6..958cc68 100644
--- a/test/CPPPATH.py
+++ b/test/CPPPATH.py
@@ -41,7 +41,7 @@ args = prog + ' ' + subdir_prog + ' ' + variant_prog
test = TestSCons.TestSCons()
-test.subdir('include', 'subdir', ['subdir', 'include'])
+test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
test.write('SConstruct', """
env = Environment(CPPPATH = ['include'])
@@ -55,24 +55,26 @@ env = Environment(CPPPATH=[include])
SConscript('variant/SConscript', "env")
""")
-test.write(['subdir', 'SConscript'], """
+test.write(['subdir', 'SConscript'],
+"""
Import("env")
env.Program(target='prog', source='prog.c')
""")
-test.write('include/foo.h',
+test.write(['include', 'foo.h'],
r"""
#define FOO_STRING "include/foo.h 1\n"
#include <bar.h>
""")
-test.write('include/bar.h',
+test.write(['include', 'bar.h'],
r"""
#define BAR_STRING "include/bar.h 1\n"
""")
-test.write('subdir/prog.c',
-r"""#include <foo.h>
+test.write(['subdir', 'prog.c'],
+r"""
+#include <foo.h>
#include <stdio.h>
int
@@ -86,13 +88,13 @@ main(int argc, char *argv[])
}
""")
-test.write('subdir/include/foo.h',
+test.write(['subdir', 'include', 'foo.h'],
r"""
#define FOO_STRING "subdir/include/foo.h 1\n"
#include "bar.h"
""")
-test.write('subdir/include/bar.h',
+test.write(['subdir', 'include', 'bar.h'],
r"""
#define BAR_STRING "subdir/include/bar.h 1\n"
""")
@@ -115,8 +117,7 @@ test.fail_test(os.path.exists(test.workpath('variant', 'prog.c')))
test.up_to_date(arguments = args)
-test.unlink('include/foo.h')
-test.write('include/foo.h',
+test.write(['include', 'foo.h'],
r"""
#define FOO_STRING "include/foo.h 2\n"
#include "bar.h"
@@ -138,9 +139,8 @@ test.fail_test(os.path.exists(test.workpath('variant', 'prog.c')))
test.up_to_date(arguments = args)
-
-test.unlink('include/bar.h')
-test.write('include/bar.h',
+#
+test.write(['include', 'bar.h'],
r"""
#define BAR_STRING "include/bar.h 2\n"
""")
@@ -163,19 +163,39 @@ test.up_to_date(arguments = args)
# Change CPPPATH and make sure we don't rebuild because of it.
test.write('SConstruct', """
-env = Environment(CPPPATH = ['include'])
+env = Environment(CPPPATH = 'inc2 include')
obj = env.Object(target='prog', source='subdir/prog.c')
env.Program(target='prog', source=obj)
SConscript('subdir/SConscript', "env")
BuildDir('variant', 'subdir', 0)
include = Dir('include')
-env = Environment(CPPPATH=[include])
+env = Environment(CPPPATH=['inc2', include])
SConscript('variant/SConscript', "env")
""")
test.up_to_date(arguments = args)
+#
+test.write(['inc2', 'foo.h'],
+r"""
+#define FOO_STRING "inc2/foo.h 1\n"
+#include <bar.h>
+""")
+
+test.run(arguments = args)
+
+test.run(program = test.workpath(prog),
+ stdout = "subdir/prog.c\ninc2/foo.h 1\ninclude/bar.h 2\n")
+
+test.run(program = test.workpath(subdir_prog),
+ stdout = "subdir/prog.c\nsubdir/include/foo.h 1\nsubdir/include/bar.h 1\n")
+
+test.run(program = test.workpath(variant_prog),
+ stdout = "subdir/prog.c\ninclude/foo.h 2\ninclude/bar.h 2\n")
+
+test.up_to_date(arguments = args)
+
# Check that a null-string CPPPATH doesn't blow up.
test.write('SConstruct', """
env = Environment(CPPPATH = '')