Re: [Lldb-commits] [PATCH] D12987: test events: announce worker count in new initialize event

2015-09-18 Thread Todd Fiala via lldb-commits
tfiala closed this revision.
tfiala added a comment.

Sendingtest/dosep.py
Sendingtest/dotest.py
Sendingtest/dotest_args.py
Sendingtest/test_results.py
Transmitting file data 
Committed revision 248059.


http://reviews.llvm.org/D12987



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12987: test events: announce worker count in new initialize event

2015-09-18 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good


http://reviews.llvm.org/D12987



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D12987: test events: announce worker count in new initialize event

2015-09-18 Thread Todd Fiala via lldb-commits
tfiala created this revision.
tfiala added a reviewer: clayborg.
tfiala added a subscriber: lldb-commits.

This change:
- renames TestFormatter.process_event() to TestFormatter.handle_event()
- does away with TestFormatter.begin_session()/end_session(), replacing them 
with new initialize and terminate events.  Now everything goes through 
handle_event().
- passes the worker count (thread/process count) in the initialize event.
- really adds the inferior dotest.py pid to all test events.  Looks like I lost 
that at some point as it was only coming in on the inferior process begin/end 
messages.
- names the inferior process begin/end messages to job_begin and job_end.
- fixes some ugly output and invalid handling when Ctrl-C happened with my 
previous change (grabbing the worker index would blow up when we were tearing 
down the multiprocessing.Manager when accessing its shared proxy dictionary.)

http://reviews.llvm.org/D12987

Files:
  test/dosep.py
  test/dotest.py
  test/dotest_args.py
  test/test_results.py

Index: test/test_results.py
===
--- test/test_results.py
+++ test/test_results.py
@@ -40,6 +40,29 @@
 return (test_class_name, test_name)
 
 @staticmethod
+def bare_event(event_type):
+"""Creates an event with default additions, event type and timestamp.
+
+@param event_type the value set for the "event" key, used
+to distinguish events.
+
+@returns an event dictionary with all default additions, the "event"
+key set to the passed in event_type, and the event_time value set to
+time.time().
+"""
+if EventBuilder.BASE_DICTIONARY is not None:
+# Start with a copy of the "always include" entries.
+event = dict(EventBuilder.BASE_DICTIONARY)
+else:
+event = {}
+
+event.update({
+"event": event_type,
+"event_time": time.time()
+})
+return event
+
+@staticmethod
 def _event_dictionary_common(test, event_type):
 """Returns an event dictionary setup with values for the given event type.
 
@@ -51,18 +74,12 @@
 """
 test_class_name, test_name = EventBuilder._get_test_name_info(test)
 
-if EventBuilder.BASE_DICTIONARY is not None:
-# Start with a copy of the "always include" entries.
-result = dict(EventBuilder.BASE_DICTIONARY)
-else:
-result = {}
-result.update({
-"event": event_type,
+event = EventBuilder.bare_event(event_type)
+event.update({
 "test_class": test_class_name,
 "test_name": test_name,
-"event_time": time.time()
 })
-return result
+return event
 
 @staticmethod
 def _error_tuple_class(error_tuple):
@@ -278,15 +295,7 @@
 """
 EventBuilder.BASE_DICTIONARY = dict(entries_dict)
 
-@staticmethod
-def base_event():
-"""@return the base event dictionary that all events should contain."""
-if EventBuilder.BASE_DICTIONARY is not None:
-return dict(EventBuilder.BASE_DICTIONARY)
-else:
-return None
 
-
 class ResultsFormatter(object):
 
 """Provides interface to formatting test results out to a file-like object.
@@ -312,6 +321,8 @@
 # Single call to session start, before parsing any events.
 formatter.begin_session()
 
+formatter.handle_event({"event":"initialize",...})
+
 # Zero or more calls specified for events recorded during the test session.
 # The parallel test runner manages getting results from all the inferior
 # dotest processes, so from a new format perspective, don't worry about
@@ -319,12 +330,12 @@
 # sandwiched between a single begin_session()/end_session() pair in the
 # parallel test runner process/thread.
 for event in zero_or_more_test_events():
-formatter.process_event(event)
+formatter.handle_event(event)
 
-# Single call to session end.  Formatters that need all the data before
-# they can print a correct result (e.g. xUnit/JUnit), this is where
-# the final report can be generated.
-formatter.end_session()
+# Single call to terminate/wrap-up. Formatters that need all the
+# data before they can print a correct result (e.g. xUnit/JUnit),
+# this is where the final report can be generated.
+formatter.handle_event({"event":"terminate",...})
 
 It is not the formatter's responsibility to close the file_like_object.
 (i.e. do not close it).
@@ -380,33 +391,9 @@
 # entirely consistent from the outside.
 self.lock = threading.Lock()
 
-def begin_session(self):
-"""Begins a test session.
+def handle_event(self, test_event):
+"""Handles the test event for collection into the formatter output.
 
-All process_event() calls must be sandwiched between
-be