[Lldb-commits] [lldb] r370090 - [dotest] Remove results port

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 27 11:18:46 PDT 2019


Author: jdevlieghere
Date: Tue Aug 27 11:18:46 2019
New Revision: 370090

URL: http://llvm.org/viewvc/llvm-project?rev=370090&view=rev
Log:
[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

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/configuration.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
    lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
    lldb/trunk/packages/Python/lldbsuite/test_event/formatter/curses.py
    lldb/trunk/packages/Python/lldbsuite/test_event/formatter/pickled.py
    lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py
    lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Tue Aug 27 11:18:46 2019
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Aug 27 11:18:46 2019
@@ -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(

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Tue Aug 27 11:18:46 2019
@@ -231,12 +231,6 @@ def create_parser():
         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',
         help=('Specifies the full package/module/class name used to translate '

Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py Tue Aug 27 11:18:46 2019
@@ -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."""

Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/curses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/curses.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/curses.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/curses.py Tue Aug 27 11:18:46 2019
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/pickled.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/pickled.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/pickled.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/pickled.py Tue Aug 27 11:18:46 2019
@@ -46,18 +46,14 @@ class RawPickledFormatter(ResultsFormatt
         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)

Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py Tue Aug 27 11:18:46 2019
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py?rev=370090&r1=370089&r2=370090&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py Tue Aug 27 11:18:46 2019
@@ -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




More information about the lldb-commits mailing list