[dotest] Remove results port

The results port was used by dosep.py to deal with test results coming
form different processes. With dosep.py gone, I don't think we need this
any longer.

Differential revision: https://reviews.llvm.org/D66811

llvm-svn: 370090
This commit is contained in:
Jonas Devlieghere 2019-08-27 18:18:46 +00:00
parent ff07631b48
commit 2d247359cc
8 changed files with 9 additions and 72 deletions

View File

@ -117,7 +117,6 @@ exclusive_test_subdir = None
# Test results handling globals
results_filename = None
results_port = None
results_formatter_name = None
results_formatter_object = None
results_formatter_options = None

View File

@ -429,15 +429,6 @@ def parseOptionsAndInitTestdirs():
if args.results_file:
configuration.results_filename = args.results_file
if args.results_port:
configuration.results_port = args.results_port
if args.results_file and args.results_port:
sys.stderr.write(
"only one of --results-file and --results-port should "
"be specified\n")
usage(args)
if args.results_formatter:
configuration.results_formatter_name = args.results_formatter
if args.results_formatter_options:
@ -516,7 +507,6 @@ def setupTestResults():
formatter_config.formatter_name = configuration.results_formatter_name
formatter_config.formatter_options = (
configuration.results_formatter_options)
formatter_config.port = configuration.results_port
# Create the results formatter.
formatter_spec = formatter.create_results_formatter(

View File

@ -230,12 +230,6 @@ def create_parser():
action='store',
help=('Specifies the file where test results will be written '
'according to the results-formatter class used'))
group.add_argument(
'--results-port',
action='store',
type=int,
help=('Specifies the localhost port to which the results '
'formatted output should be sent'))
group.add_argument(
'--results-formatter',
action='store',

View File

@ -24,7 +24,6 @@ class FormatterConfig(object):
def __init__(self):
self.filename = None
self.port = None
self.formatter_name = None
self.formatter_options = None
@ -48,43 +47,10 @@ def create_results_formatter(config):
@return an instance of CreatedFormatter.
"""
def create_socket(port):
"""Creates a socket to the localhost on the given port.
@param port the port number of the listening port on
the localhost.
@return (socket object, socket closing function)
"""
def socket_closer(open_sock):
"""Close down an opened socket properly."""
open_sock.shutdown(socket.SHUT_RDWR)
open_sock.close()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", port))
# Wait for the ack from the listener side.
# This is needed to prevent a race condition
# in the main dosep.py processing loop: we
# can't allow a worker queue thread to die
# that has outstanding messages to a listener
# socket before the listener socket asyncore
# listener socket gets spun up; otherwise,
# we lose the test result info.
read_bytes = sock.recv(1)
if read_bytes is None or (len(read_bytes) < 1) or (read_bytes != b'*'):
raise Exception(
"listening socket did not respond with ack byte: response={}".format(read_bytes))
return sock, lambda: socket_closer(sock)
default_formatter_name = None
results_file_object = None
cleanup_func = None
file_is_stream = False
if config.filename:
# Open the results file for writing.
if config.filename == 'stdout':
@ -98,12 +64,6 @@ def create_results_formatter(config):
cleanup_func = results_file_object.close
default_formatter_name = (
"lldbsuite.test_event.formatter.xunit.XunitFormatter")
elif config.port:
# Connect to the specified localhost port.
results_file_object, cleanup_func = create_socket(config.port)
default_formatter_name = (
"lldbsuite.test_event.formatter.pickled.RawPickledFormatter")
file_is_stream = True
# If we have a results formatter name specified and we didn't specify
# a results file, we should use stdout.
@ -141,8 +101,7 @@ def create_results_formatter(config):
# Create the TestResultsFormatter given the processed options.
results_formatter_object = cls(
results_file_object,
formatter_options,
file_is_stream)
formatter_options)
def shutdown_formatter():
"""Shuts down the formatter when it is no longer needed."""

View File

@ -26,9 +26,9 @@ from ..event_builder import EventBuilder
class Curses(results_formatter.ResultsFormatter):
"""Receives live results from tests that are running and reports them to the terminal in a curses GUI"""
def __init__(self, out_file, options, file_is_stream):
def __init__(self, out_file, options):
# Initialize the parent
super(Curses, self).__init__(out_file, options, file_is_stream)
super(Curses, self).__init__(out_file, options)
self.using_terminal = True
self.have_curses = True
self.initialize_event = None

View File

@ -46,18 +46,14 @@ class RawPickledFormatter(ResultsFormatter):
def serialize(test_event, out_file):
cPickle.dump(test_event, out_file)
def __init__(self, out_file, options, file_is_stream):
def __init__(self, out_file, options):
super(
RawPickledFormatter,
self).__init__(
out_file,
options,
file_is_stream)
options)
self.pid = os.getpid()
if file_is_stream:
self.serializer = self.StreamSerializer()
else:
self.serializer = self.BlockSerializer()
self.serializer = self.BlockSerializer()
def handle_event(self, test_event):
super(RawPickledFormatter, self).handle_event(test_event)

View File

@ -114,7 +114,7 @@ class ResultsFormatter(object):
'the summary output.'))
return parser
def __init__(self, out_file, options, file_is_stream):
def __init__(self, out_file, options):
super(ResultsFormatter, self).__init__()
self.out_file = out_file
self.options = options
@ -123,7 +123,6 @@ class ResultsFormatter(object):
raise Exception("ResultsFormatter created with no file object")
self.start_time_by_test = {}
self.terminate_called = False
self.file_is_stream = file_is_stream
# Track the most recent test start event by worker index.
# We'll use this to assign TIMEOUT and exceptional

View File

@ -155,14 +155,14 @@ class XunitFormatter(ResultsFormatter):
regex_list.append(re.compile(pattern))
return regex_list
def __init__(self, out_file, options, file_is_stream):
def __init__(self, out_file, options):
"""Initializes the XunitFormatter instance.
@param out_file file-like object where formatted output is written.
@param options specifies a dictionary of options for the
formatter.
"""
# Initialize the parent
super(XunitFormatter, self).__init__(out_file, options, file_is_stream)
super(XunitFormatter, self).__init__(out_file, options)
self.text_encoding = "UTF-8"
self.invalid_xml_re = XunitFormatter._build_illegal_xml_regex()
self.total_test_count = 0