summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-09-05 12:01:20 (GMT)
committerSteven Knight <knight@baldmt.com>2004-09-05 12:01:20 (GMT)
commit1091ca56e75ed39820081d4cca289c241c7fbceb (patch)
tree143f770f6476c5398894e67deca44309283dfc67 /test
parent39ce0b2ef56813cd5abfbe9fac579ebd28b0f4b1 (diff)
downloadSCons-1091ca56e75ed39820081d4cca289c241c7fbceb.zip
SCons-1091ca56e75ed39820081d4cca289c241c7fbceb.tar.gz
SCons-1091ca56e75ed39820081d4cca289c241c7fbceb.tar.bz2
Add a configurable function for command-line printing. (Gary Oberbrunner)
Diffstat (limited to 'test')
-rw-r--r--test/PRINT_CMD_LINE_FUNC.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/PRINT_CMD_LINE_FUNC.py b/test/PRINT_CMD_LINE_FUNC.py
new file mode 100644
index 0000000..cc6929a
--- /dev/null
+++ b/test/PRINT_CMD_LINE_FUNC.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the PRINT_CMD_LINE_FUNC construction variable.
+"""
+
+import sys
+import TestCmd
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestCmd.match_re)
+
+
+test.write('SConstruct', r"""
+import sys
+def print_cmd_line(s, target, source, env):
+ sys.stdout.write("BUILDING %s from %s with %s\n"%
+ (str(target[0]), str(source[0]), s))
+
+e = Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
+e.Program(target = 'prog', source = 'prog.c')
+""")
+
+test.write('prog.c', r"""
+int main(int argc, char *argv[]) { return 0; }
+""")
+
+test.run(arguments = '-Q .', stdout = """\
+BUILDING prog.o from prog.c with .*
+BUILDING prog from prog.o with .*
+""")
+
+test.run(arguments = '-c .')
+
+# Just make sure it doesn't blow up when PRINT_CMD_LINE_FUNC
+# is explicity initialized to None.
+test.write('SConstruct', r"""
+e = Environment(PRINT_CMD_LINE_FUNC=None)
+e.Program(target = 'prog', source = 'prog.c')
+""")
+
+test.run(arguments = '-Q .')
+
+test.pass_test()