@@ -40,19 +40,6 @@ def is_counter_value(num):
40
40
return isfloat (num ) or num == '<not counted>' or num == '<not supported>'
41
41
42
42
def check_json_output (expected_items ):
43
- if expected_items != - 1 :
44
- for line in Lines :
45
- if 'failed' not in line :
46
- count = 0
47
- count = line .count (',' )
48
- if count != expected_items and count >= 1 and count <= 3 and 'metric-value' in line :
49
- # Events that generate >1 metric may have isolated metric
50
- # values and possibly other prefixes like interval, core and
51
- # aggregate-number.
52
- continue
53
- if count != expected_items :
54
- raise RuntimeError (f'wrong number of fields. counted { count } expected { expected_items } '
55
- f' in \' { line } \' ' )
56
43
checks = {
57
44
'aggregate-number' : lambda x : isfloat (x ),
58
45
'core' : lambda x : True ,
@@ -73,6 +60,16 @@ def check_json_output(expected_items):
73
60
}
74
61
input = '[\n ' + ',' .join (Lines ) + '\n ]'
75
62
for item in json .loads (input ):
63
+ if expected_items != - 1 :
64
+ count = len (item )
65
+ if count != expected_items and count >= 1 and count <= 4 and 'metric-value' in item :
66
+ # Events that generate >1 metric may have isolated metric
67
+ # values and possibly other prefixes like interval, core and
68
+ # aggregate-number.
69
+ pass
70
+ elif count != expected_items :
71
+ raise RuntimeError (f'wrong number of fields. counted { count } expected { expected_items } '
72
+ f' in \' { item } \' ' )
76
73
for key , value in item .items ():
77
74
if key not in checks :
78
75
raise RuntimeError (f'Unexpected key: key={ key } value={ value } ' )
@@ -82,11 +79,11 @@ def check_json_output(expected_items):
82
79
83
80
try :
84
81
if args .no_args or args .system_wide or args .event :
85
- expected_items = 6
86
- elif args .interval or args .per_thread or args .system_wide_no_aggr :
87
82
expected_items = 7
88
- elif args .per_core or args .per_socket or args .per_node or args . per_die :
83
+ elif args .interval or args .per_thread or args .system_wide_no_aggr :
89
84
expected_items = 8
85
+ elif args .per_core or args .per_socket or args .per_node or args .per_die :
86
+ expected_items = 9
90
87
else :
91
88
# If no option is specified, don't check the number of items.
92
89
expected_items = - 1
0 commit comments