summaryrefslogtreecommitdiffstats
path: root/test/option--warn.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-12-08 04:43:08 (GMT)
committerSteven Knight <knight@baldmt.com>2003-12-08 04:43:08 (GMT)
commit69fad99f14c6ae0ba16db7ffda4d892fb2381f53 (patch)
treee00375c2b4c22646c121e5d20555b67ae0a804c6 /test/option--warn.py
parentf7e6a9276fe7459388b933cb215994f300dd5271 (diff)
downloadSCons-69fad99f14c6ae0ba16db7ffda4d892fb2381f53.zip
SCons-69fad99f14c6ae0ba16db7ffda4d892fb2381f53.tar.gz
SCons-69fad99f14c6ae0ba16db7ffda4d892fb2381f53.tar.bz2
Relax the duplicate-environment restriction for targets so that it's okay if the two environments would build the target with the same command or function call. (Scott Fritchie)
Diffstat (limited to 'test/option--warn.py')
-rw-r--r--test/option--warn.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/option--warn.py b/test/option--warn.py
index c8e16a9..ac510bc 100644
--- a/test/option--warn.py
+++ b/test/option--warn.py
@@ -52,6 +52,8 @@ test = TestSCons.TestSCons(match = TestCmd.match_re_dotall)
#File "SConstruct", line 2, in \?
#""")
+
+
test.write("SConstruct","""
def build(target, source, env):
pass
@@ -82,6 +84,8 @@ scons: warning: No dependency generated for file: not_there\.h \(included from:
File ".+", line \d+, in .+
""")
+
+
test.write("SConstruct", """\
def build(target, source, env):
pass
@@ -99,4 +103,41 @@ File ".+", line \d+, in .+
test.run(arguments = '--warn=no-missing-sconscript .', stderr = "")
+
+
+test.write('SConstruct', """
+def build(env, target, source):
+ file = open(str(target[0]), 'wb')
+ for s in source:
+ file.write(open(str(s), 'rb').read())
+
+B = Builder(action=build, multi=1)
+env = Environment(BUILDERS = { 'B' : B })
+env2 = env.Copy(DIFFERENT_VARIABLE = 'true')
+env.B(target = 'file1.out', source = 'file1a.in')
+env2.B(target = 'file1.out', source = 'file1b.in')
+""")
+
+test.write('file1a.in', 'file1a.in\n')
+test.write('file1b.in', 'file1b.in\n')
+
+test.run(arguments='file1.out',
+ stderr=r"""
+scons: warning: Two different environments were specified for target file1.out,
+ but they appear to have the same action: build\("file1.out", "file1b.in"\)
+File "SConstruct", line \d+, in .+
+""")
+
+test.fail_test(not test.read('file1.out') == 'file1a.in\nfile1b.in\n')
+
+test.run(arguments='--warn=duplicate-environment file1.out',
+ stderr=r"""
+scons: warning: Two different environments were specified for target file1.out,
+ but they appear to have the same action: build\("file1.out", "file1b.in"\)
+File "SConstruct", line \d+, in .+
+""")
+
+test.run(arguments='--warn=no-duplicate-environment file1.out')
+
+
test.pass_test()