[Lldb-commits] [lldb] r248066 - test events: added optional value type to extra event key/val pairs

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 18 16:46:30 PDT 2015


Author: tfiala
Date: Fri Sep 18 18:46:30 2015
New Revision: 248066

URL: http://llvm.org/viewvc/llvm-project?rev=248066&view=rev
Log:
test events: added optional value type to extra event key/val pairs

The test events had worker indexes coming across as strings.  I
want them to be ints.  worker_index now comes across as an int in
the dicationary.

The optional type can be specified with:
--event-add-entries key=val[:type][,key2=val2[:type2]...]
The type piece may be 'int' at this time.  That is all.  Otherwise
it will be a string.

Modified:
    lldb/trunk/test/dosep.py
    lldb/trunk/test/dotest.py
    lldb/trunk/test/dotest_args.py

Modified: lldb/trunk/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=248066&r1=248065&r2=248066&view=diff
==============================================================================
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Fri Sep 18 18:46:30 2015
@@ -183,7 +183,7 @@ def call_with_timeout(command, timeout,
         try:
             worker_index = GET_WORKER_INDEX()
             command.extend([
-                "--event-add-entries", "worker_index={}".format(worker_index)])
+                "--event-add-entries", "worker_index={}:int".format(worker_index)])
         except:
             # Ctrl-C does bad things to multiprocessing.Manager.dict() lookup.
             pass
@@ -1084,7 +1084,6 @@ def _remove_option(args, option_name, re
         for index in range(len(args)):
             match = regex.match(args[index])
             if match:
-                print "found matching option= at index {}".format(index)
                 del args[index]
                 return
         print "failed to find regex '{}'".format(regex_string)

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=248066&r1=248065&r2=248066&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Sep 18 18:46:30 2015
@@ -830,7 +830,13 @@ def parseOptionsAndInitTestdirs():
         for keyval in args.event_add_entries.split(","):
             key_val_entry = keyval.split("=")
             if len(key_val_entry) == 2:
-                entries[key_val_entry[0]] = key_val_entry[1]
+                (key, val) = key_val_entry
+                val_parts = val.split(':')
+                if len(val_parts) > 1:
+                    (val, val_type) = val_parts
+                    if val_type == 'int':
+                        val = int(val)
+                entries[key] = val
         # Tell the event builder to create all events with these
         # key/val pairs in them.
         if len(entries) > 0:

Modified: lldb/trunk/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest_args.py?rev=248066&r1=248065&r2=248066&view=diff
==============================================================================
--- lldb/trunk/test/dotest_args.py (original)
+++ lldb/trunk/test/dotest_args.py Fri Sep 18 18:46:30 2015
@@ -181,7 +181,9 @@ def create_parser():
         '--event-add-entries',
         action='store',
         help=('Specify comma-separated KEY=VAL entries to add key and value '
-              'pairs to all test events generated by this test run.'))
+              'pairs to all test events generated by this test run.  VAL may '
+              'be specified as VAL:TYPE, where TYPE may be int to convert '
+              'the value to an int'))
     # Remove the reference to our helper function
     del X
 




More information about the lldb-commits mailing list