Redirect STDERR to output to an errlog file when running run_tests.py.
Adds a flag option for specifying the output file and adds a bzr ignore rule to disregard the generated logfile.
This commit is contained in:
1
.bzrignore
Normal file
1
.bzrignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
run_tests.err.log
|
||||||
@@ -39,6 +39,7 @@ Due to our use of multiprocessing it we frequently get some ignorable
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import __main__
|
import __main__
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@@ -66,6 +67,9 @@ FLAGS = flags.FLAGS
|
|||||||
flags.DEFINE_bool('flush_db', True,
|
flags.DEFINE_bool('flush_db', True,
|
||||||
'Flush the database before running fake tests')
|
'Flush the database before running fake tests')
|
||||||
|
|
||||||
|
flags.DEFINE_string('tests_stderr', 'run_tests.err.log',
|
||||||
|
'Path to where to pipe STDERR during test runs. Default = "run_tests.err.log"')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
OptionsClass = twistd.WrapTwistedOptions(trial_script.Options)
|
OptionsClass = twistd.WrapTwistedOptions(trial_script.Options)
|
||||||
config = OptionsClass()
|
config = OptionsClass()
|
||||||
@@ -85,6 +89,11 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
from nova.tests.real_flags import *
|
from nova.tests.real_flags import *
|
||||||
|
|
||||||
|
# Establish redirect for STDERR
|
||||||
|
sys.stderr.flush()
|
||||||
|
err = open(FLAGS.tests_stderr, 'w+', 0)
|
||||||
|
os.dup2(err.fileno(), sys.stderr.fileno())
|
||||||
|
|
||||||
if len(argv) == 1 and len(config['tests']) == 0:
|
if len(argv) == 1 and len(config['tests']) == 0:
|
||||||
# If no tests were specified run the ones imported in this file
|
# If no tests were specified run the ones imported in this file
|
||||||
# NOTE(termie): "tests" is not a flag, just some Trial related stuff
|
# NOTE(termie): "tests" is not a flag, just some Trial related stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user