3 Selects all rows and columns that satisfy the condition specified
6 import sys
, os
, re
, optparse
8 from autotest_lib
.client
.common_lib
import kernel_versions
9 from autotest_lib
.tko
import display
, frontend
, db
, query_lib
11 # First do all the options parsing
12 parser
= optparse
.OptionParser()
13 parser
.add_option('-x', '--x_axis', action
='store', dest
='x_axis',
14 default
='machine_group')
15 parser
.add_option('-y', '--y_axis', action
='store', dest
='y_axis',
17 parser
.add_option('-c', '--condition', action
='store', dest
='condition')
18 (options
, args
) = parser
.parse_args()
21 where
= query_lib
.parse_scrub_and_gen_condition(
22 options
.condition
, frontend
.test_view_field_dict
)
23 # print("where clause:" % where)
29 test_data
= frontend
.get_matrix_data(db
, options
.x_axis
, options
.y_axis
, where
)
32 widest_row_header
= max([len(y
) for y
in test_data
.y_values
])
33 data_column_width
= max([max(13,len(x
)) for x
in test_data
.x_values
])
34 column_widths
= [widest_row_header
] + [data_column_width
] * len(test_data
.x_values
)
35 format
= ' | '.join(['%%%ds' % i
for i
in column_widths
])
37 print format
% tuple([''] + test_data
.x_values
)
40 for y
in test_data
.y_values
:
42 for x
in test_data
.x_values
:
44 data_point
= test_data
.data
[x
][y
]
45 good_status
= db
.status_idx
['GOOD']
46 good
= data_point
.status_count
.get(good_status
, 0)
47 total
= sum(data_point
.status_count
.values())
48 line
.append('%5d / %-5d' % (good
, total
))
51 print format
% tuple(line
)