summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2006-02-17 11:13:44 (GMT)
committerSteven Knight <knight@baldmt.com>2006-02-17 11:13:44 (GMT)
commit01e28894fefef5262340d8cf3d9d10bab9ef332b (patch)
tree5aa3861e45ae88203f5e07c35a8cd84ec9cefaa8
parent2708dc3927775a374fc94a6996ebe09e70705e60 (diff)
downloadSCons-01e28894fefef5262340d8cf3d9d10bab9ef332b.zip
SCons-01e28894fefef5262340d8cf3d9d10bab9ef332b.tar.gz
SCons-01e28894fefef5262340d8cf3d9d10bab9ef332b.tar.bz2
Add a --verbose option to runtest.py. (Baptiste Lepilleur) Fix (?) a deadlock using the --xml option on Windows.
-rw-r--r--etc/TestCmd.py24
-rw-r--r--etc/TestCommon.py4
-rw-r--r--runtest.py12
-rw-r--r--src/CHANGES.txt5
4 files changed, 37 insertions, 8 deletions
diff --git a/etc/TestCmd.py b/etc/TestCmd.py
index cd66245..a2635c9 100644
--- a/etc/TestCmd.py
+++ b/etc/TestCmd.py
@@ -176,8 +176,8 @@ version.
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.18.D001 2005/10/15 06:40:23 knight"
-__version__ = "0.18"
+__revision__ = "TestCmd.py 0.20.D001 2006/02/16 06:28:21 knight"
+__version__ = "0.20"
import os
import os.path
@@ -449,13 +449,18 @@ class TestCmd:
interpreter = None,
workdir = None,
subdir = None,
- verbose = 0,
+ verbose = None,
match = None,
combine = 0):
self._cwd = os.getcwd()
self.description_set(description)
self.program_set(program)
self.interpreter_set(interpreter)
+ if verbose is None:
+ try:
+ verbose = max( 0, int(os.environ.get('TESTCMD_VERBOSE', 0)) )
+ except ValueError:
+ verbose = 0
self.verbose_set(verbose)
self.combine = combine
if not match is None:
@@ -715,6 +720,19 @@ class TestCmd:
self.status = p.wait()
if chdir:
os.chdir(oldcwd)
+ if self.verbose >= 2:
+ write = sys.stdout.write
+ write('============ STATUS: %d\n' % self.status)
+ out = self.stdout()
+ if out or self.verbose >= 3:
+ write('============ BEGIN STDOUT (len=%d):\n' % len(out))
+ write(out)
+ write('============ END STDOUT\n')
+ err = self.stderr()
+ if err or self.verbose >= 3:
+ write('============ BEGIN STDERR (len=%d)\n' % len(err))
+ write(err)
+ write('============ END STDERR\n')
def sleep(self, seconds = default_sleep_seconds):
"""Sleeps at least the specified number of seconds. If no
diff --git a/etc/TestCommon.py b/etc/TestCommon.py
index 76ee8f0..af38ab5 100644
--- a/etc/TestCommon.py
+++ b/etc/TestCommon.py
@@ -80,8 +80,8 @@ The TestCommon module also provides the following variables
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCommon.py 0.18.D001 2005/10/15 06:40:23 knight"
-__version__ = "0.18"
+__revision__ = "TestCommon.py 0.20.D001 2006/02/16 06:28:21 knight"
+__version__ = "0.20"
import os
import os.path
diff --git a/runtest.py b/runtest.py
index e96ed83..1530415 100644
--- a/runtest.py
+++ b/runtest.py
@@ -140,6 +140,9 @@ Options:
-q, --quiet Don't print the test being executed.
-t, --time Print test execution time.
-v version Specify the SCons version.
+ --verbose=LEVEL Set verbose level: 1 = print executed commands,
+ 2 = print commands and non-zero output,
+ 3 = print commands and all output.
-X Test script is executable, don't feed to Python.
-x SCRIPT, --exec SCRIPT Test SCRIPT.
--xml Print results in SCons XML format.
@@ -150,7 +153,7 @@ opts, args = getopt.getopt(sys.argv[1:], "adf:ho:P:p:qv:Xx:t",
'debug', 'file=', 'help', 'output=',
'package=', 'passed', 'python=', 'quiet',
'version=', 'exec=', 'time',
- 'xml'])
+ 'verbose=', 'xml'])
for o, a in opts:
if o == '-a' or o == '--all':
@@ -178,6 +181,8 @@ for o, a in opts:
printcommand = 0
elif o == '-t' or o == '--time':
print_time = lambda fmt, time: sys.stdout.write(fmt % time)
+ elif o in ['--verbose']:
+ os.environ['TESTCMD_VERBOSE'] = a
elif o == '-v' or o == '--version':
version = a
elif o == '-X':
@@ -235,7 +240,8 @@ except AttributeError:
return status >> 8
else:
def spawn_it(command_args):
- command_args = map(escape, command_args)
+ command_args = map(escape, command_args)
+ command_args = map(lambda s: string.replace(s, '\\','\\\\'), command_args)
return os.spawnv(os.P_WAIT, command_args[0], command_args)
class Base:
@@ -264,8 +270,8 @@ except AttributeError:
def execute(self):
(tochild, fromchild, childerr) = os.popen3(self.command_str)
tochild.close()
- self.stdout = fromchild.read()
self.stderr = childerr.read()
+ self.stdout = fromchild.read()
fromchild.close()
self.status = childerr.close()
if not self.status:
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 1455d14..a95891e 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -133,6 +133,8 @@ RELEASE 0.97 - XXX
$WINDOWSIMPLIBPREFIX construction variables. The old names are now
deprecated, but preserved for backwards compatibility.
+ - Fix (?) a runtest.py hang on Windows when the --xml option is used.
+
From Chen Lee:
- Add x64 support for Microsoft Visual Studio 8.
@@ -155,6 +157,9 @@ RELEASE 0.97 - XXX
- Speed up the SCons/EnvironmentTests.py unit tests.
+ - Add a --verbose= option to runtest.py to print executed commands
+ and their output at various levels.
+
From Christian Maaser:
- Add support for Visual Studio Express Editions.