summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-09-18 23:02:56 (GMT)
committerSteven Knight <knight@baldmt.com>2004-09-18 23:02:56 (GMT)
commita965b2ed53e58047b417e28c41a0f0c0f98b82b7 (patch)
tree96f741d3e308c022c801036190067eab0d115b20 /test
parentaeb8fd273afe8db3b98ad991d6afb94a6007c293 (diff)
downloadSCons-a965b2ed53e58047b417e28c41a0f0c0f98b82b7.zip
SCons-a965b2ed53e58047b417e28c41a0f0c0f98b82b7.tar.gz
SCons-a965b2ed53e58047b417e28c41a0f0c0f98b82b7.tar.bz2
Fix --debug=explain when the action is a Python function.
Diffstat (limited to 'test')
-rw-r--r--test/explain.py58
-rw-r--r--test/symlink.py2
2 files changed, 58 insertions, 2 deletions
diff --git a/test/explain.py b/test/explain.py
index ae4a33a..be966c0 100644
--- a/test/explain.py
+++ b/test/explain.py
@@ -38,7 +38,8 @@ python = TestSCons.python
test = TestSCons.TestSCons()
test.subdir('work1', ['work1', 'src'], ['work1', 'src', 'subdir'],
- 'work4', ['work4', 'src'], ['work4', 'src', 'subdir'])
+ 'work4', ['work4', 'src'], ['work4', 'src', 'subdir'],
+ 'work5')
subdir_file6 = os.path.join('subdir', 'file6')
subdir_file6_in = os.path.join('subdir', 'file6.in')
@@ -442,4 +443,59 @@ ccc 1
file5.k 1 line 4
""")
+
+
+test.write(['work5', 'SConstruct'], """\
+import shutil
+
+env = Environment()
+mode = int(ARGUMENTS.get('mode'))
+if mode:
+ def DifferentCopy(target, source, env):
+ tgt = str(target[0])
+ src = str(source[0])
+ shutil.copy(src, tgt)
+ MyCopy = Builder(action = DifferentCopy)
+
+ def ChangingCopy(target, source, env):
+ tgt = str(target[0])
+ src = str(source[0])
+ shutil.copy(src, tgt)
+ ChangingCopy = Builder(action = ChangingCopy)
+else:
+ MyCopy = Builder(action = Copy('$TARGET', '$SOURCE'))
+ def ChangingCopy(target, source, env):
+ tgt = str(target[0].abspath)
+ src = str(source[0].abspath)
+ shutil.copy(src, tgt)
+ ChangingCopy = Builder(action = ChangingCopy)
+
+env['BUILDERS']['MyCopy'] = MyCopy
+env['BUILDERS']['ChangingCopy'] = ChangingCopy
+
+env.MyCopy('f1.out', 'f1.in')
+env.ChangingCopy('f2.out', 'f2.in')
+""")
+
+test.write(['work5', 'f1.in'], "work5/f1.in\n")
+test.write(['work5', 'f2.in'], "work5/f2.in\n")
+
+test.run(chdir = 'work5', arguments = "mode=0 .")
+
+test.must_match(['work5', 'f1.out'], "work5/f1.in\n")
+test.must_match(['work5', 'f2.out'], "work5/f2.in\n")
+
+test.run(chdir = 'work5',
+ arguments = "--debug=explain mode=1 .",
+ stdout = test.wrap_stdout("""\
+scons: rebuilding `f1.out' because the build action changed:
+ old: Copy("f1.out", "f1.in")
+ new: DifferentCopy(["f1.out"], ["f1.in"])
+DifferentCopy(["f1.out"], ["f1.in"])
+scons: rebuilding `f2.out' because the contents of the build action changed
+ChangingCopy(["f2.out"], ["f2.in"])
+"""))
+
+
+
test.pass_test()
diff --git a/test/symlink.py b/test/symlink.py
index 62ce75b..889c7a0 100644
--- a/test/symlink.py
+++ b/test/symlink.py
@@ -59,7 +59,7 @@ expect = "scons: *** [%s] Error 1\n" % foo_obj
test.fail_test(string.find(test.stderr(), expect) == -1)
test.write('SConstruct', """
-Command('file.out', 'file.in', Copy())
+Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE'))
""")
test.symlink('nonexistent', 'file.in')