2 # Copyright 2008 Google Inc. All Rights Reserved.
5 The test module contains the objects and methods used to
6 manage tests in Autotest.
11 The common options are:
12 --tlist / -T: file containing a list of tests
14 See topic_common.py for a High Level Design and Algorithm.
20 from autotest_lib
.cli
import topic_common
, action_common
23 class test(topic_common
.atest
):
25 atest test list <options>"""
27 topic
= msg_topic
= 'test'
31 """Add to the parser the options common to all the test actions"""
32 super(test
, self
).__init
__()
34 self
.parser
.add_option('-T', '--tlist',
35 help='File listing the tests',
40 self
.topic_parse_info
= topic_common
.item_parse_info(
41 attribute_name
='tests',
42 filename_option
='tlist',
50 class test_help(test
):
51 """Just here to get the atest logic working.
52 Usage is set by its parent"""
56 class test_list(action_common
.atest_list
, test
):
57 """atest test list [--description] [--experimental|--all] [<tests>]"""
59 super(test_list
, self
).__init
__()
61 self
.parser
.add_option('-d', '--description',
62 help='Display the test descriptions',
65 self
.parser
.add_option('--all',
66 help='Display all the tests',
69 self
.parser
.add_option('-e', '--experimental',
70 help='Display the experimental tests only',
76 (options
, leftover
) = super(test_list
, self
).parse()
78 if self
.tests
and (options
.experimental
or options
.all
):
79 self
.invalid_syntax('Do not specify a test name with --all or '
82 self
.description
= options
.description
83 self
.all
= options
.all
84 self
.experimental
= options
.experimental
86 return (options
, leftover
)
93 filters
['name__in'] = self
.tests
94 check_results
['name__in'] = 'name'
97 filters
['experimental'] = self
.experimental
98 check_results
['experimental'] = None
100 return super(test_list
, self
).execute(op
='get_tests',
102 check_results
=check_results
)
105 def output(self
, results
):
106 keys
= ['name', 'test_type', 'test_class']
109 keys
.append('experimental')
115 keys
.append('description')
117 super(test_list
, self
).output(results
, keys
)