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.

llvm-svn: 248066
This commit is contained in:
Todd Fiala 2015-09-18 23:46:30 +00:00
parent 659842d0fc
commit 40b180e7ee
3 changed files with 11 additions and 4 deletions

View File

@ -183,7 +183,7 @@ def call_with_timeout(command, timeout, name, inferior_pid_events):
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, removal_count):
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)

View File

@ -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:

View File

@ -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