Merge lp:~canonical-platform-qa/ubuntu-system-tests/add-adt-run-debugging into lp:ubuntu-system-tests

Proposed by Allan LeSage
Status: Merged
Approved by: Richard Huddie
Approved revision: 373
Merged at revision: 371
Proposed branch: lp:~canonical-platform-qa/ubuntu-system-tests/add-adt-run-debugging
Merge into: lp:ubuntu-system-tests
Diff against target: 249 lines (+65/-20)
2 files modified
ubuntu_system_tests/command_line.py (+21/-10)
ubuntu_system_tests/selftests/test_command_line.py (+44/-10)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/add-adt-run-debugging
Reviewer Review Type Date Requested Status
Richard Huddie (community) Approve
PS Jenkins bot continuous-integration Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+291956@code.launchpad.net

Commit message

Add -ddd debugging to adt-run calls.

Description of the change

This doesn't change the behavior of the tests, only adds a lot of debugging output. If we insist it can be made into a command-line option but we'll have to choose a letter other than 'd' as rhuddie is squatting that one ;) .

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

Agree that a command line option would be best to enable this. I'd suggest using -v or --verbose for that. I think -v is free :)

review: Needs Fixing
370. By Allan LeSage

Add -v for verbose logging.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
371. By Allan LeSage

Fix tests.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
372. By Allan LeSage

Merge trunk.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Review me please!

Revision history for this message
Richard Huddie (rhuddie) wrote :

Looks good and works fine. Just a couple of minor points below, thanks.

review: Needs Fixing
373. By Allan LeSage

Add a verbosity command-line test, conform to no-defaulting param style.

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

Thanks for update, all looks good so approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_system_tests/command_line.py'
2--- ubuntu_system_tests/command_line.py 2016-04-14 09:48:49 +0000
3+++ ubuntu_system_tests/command_line.py 2016-04-18 15:40:01 +0000
4@@ -61,7 +61,7 @@
5 return run_system_tests(args.config, args.suites,
6 args.update_apt, args.network_ready,
7 args.touch_visualization, args.install_deps,
8- args.silent, args.cache_deps)
9+ args.silent, args.cache_deps, args.verbose)
10
11
12 def _parse_arguments(argv=None):
13@@ -94,12 +94,16 @@
14 'downloaded for every test run.')
15 parser.add_argument(
16 'suites', nargs='*', help='The list of test suites to run.')
17+ parser.add_argument(
18+ '--verbose', '-v', action='store_true',
19+ help='Provide verbose logging.', default=False)
20 return parser.parse_args(args=argv)
21
22
23 def run_system_tests(conf_name, tests_to_run, update_apt=False,
24 network_ready=False, touch_visualization=False,
25- install_deps=False, silent=False, cache_deps=False):
26+ install_deps=False, silent=False, cache_deps=False,
27+ verbose=False):
28 """Run system tests in a device connected via USB and report the results.
29 :param conf_name: The name of the configuration file that will be used
30 for the system tests.
31@@ -125,7 +129,7 @@
32
33 enable_autopilot_introspection(config_stack)
34 return_code = run_autopkg_test(config_stack, update_apt, network_ready,
35- install_deps, cache_deps)
36+ install_deps, cache_deps, verbose)
37
38 if return_code <= 6:
39 # Return codes higher than 6 mean that there was a problem with adt or
40@@ -222,7 +226,7 @@
41
42
43 def run_autopkg_test(config_stack, update_apt, network_ready, install_deps,
44- cache_deps):
45+ cache_deps, verbose):
46 """ Run the autopkgtest in the revice for the tests selected
47 :param config_stack: The config objects
48 :param update_apt: True if the packages hasve to be updated
49@@ -232,6 +236,7 @@
50 permanently in the device instead of install those in the tmp dir
51 :param cache_deps: If True then cache the downloaded dependencies so that
52 they don't have to be downloaded for every test run.
53+ :param verbose: True to provide verbose logging.
54 :return: the autopkgtest execution exit code
55 """
56 extra_depends = _get_extra_dependencies(
57@@ -245,7 +250,8 @@
58 network_ready=network_ready,
59 add_ppa=False,
60 install_deps=False,
61- cache_deps=True)
62+ cache_deps=True,
63+ verbose=verbose)
64 subprocess.call(adt_run_cmd)
65 clean_output_directory(config_stack)
66 logger.info('apt-cacher-ng installed on device')
67@@ -257,7 +263,8 @@
68 update_apt=update_apt,
69 network_ready=network_ready,
70 add_ppa=add_ppa,
71- install_deps=install_deps)
72+ install_deps=install_deps,
73+ verbose=verbose)
74 subprocess.call(adt_run_cmd)
75
76 clean_output_directory(config_stack)
77@@ -273,7 +280,8 @@
78 update_apt=update_apt,
79 network_ready=network_ready,
80 add_ppa=add_ppa,
81- install_deps=install_deps)
82+ install_deps=install_deps,
83+ verbose=verbose)
84 return subprocess.call(adt_run_cmd)
85
86
87@@ -370,11 +378,13 @@
88 src=keyfile, dest=ssh.get_device_keyfile_path(keyfile))])
89
90
91-def _build_basic_adt_run_test_command(config_stack, extra_depends):
92+def _build_basic_adt_run_test_command(config_stack, extra_depends, verbose):
93 """ Build and return the first part of the adt-run """
94 output_dir = config_stack.get('output_dir')
95
96 run_cmd = ['adt-run']
97+ if verbose:
98+ run_cmd.append('-ddd')
99 if extra_depends:
100 run_cmd.append('--override-control={}'.format(
101 _create_temp_control_file(extra_depends))
102@@ -403,10 +413,11 @@
103 def _build_adt_run_test_command(config_stack, extra_depends=None,
104 update_apt=False, network_ready=False,
105 add_ppa=True, install_deps=False,
106- cache_deps=False):
107+ cache_deps=False, verbose=False):
108
109 device_password = config_stack.get('device_password')
110- run_cmd = _build_basic_adt_run_test_command(config_stack, extra_depends)
111+ run_cmd = _build_basic_adt_run_test_command(
112+ config_stack, extra_depends, verbose)
113
114 ssh_cmd = (
115 ['ssh', '-s', 'adb', '--', '-p', device_password] +
116
117=== modified file 'ubuntu_system_tests/selftests/test_command_line.py'
118--- ubuntu_system_tests/selftests/test_command_line.py 2016-04-08 09:17:43 +0000
119+++ ubuntu_system_tests/selftests/test_command_line.py 2016-04-18 15:40:01 +0000
120@@ -351,6 +351,8 @@
121 DONT_USE_SILENT = False
122 DO_USE_CACHE_DEPS = True
123 DONT_USE_CACHE_DEPS = False
124+ DO_USE_VERBOSE_LOGGING = True
125+ DONT_USE_VERBOSE_LOGGING = False
126
127 scenarios = [
128 ('no arguments', {
129@@ -363,7 +365,9 @@
130 VISUALIZATION_OFF,
131 DONT_INSTALL_DEPS,
132 DONT_USE_SILENT,
133- DONT_USE_CACHE_DEPS)
134+ DONT_USE_CACHE_DEPS,
135+ DONT_USE_VERBOSE_LOGGING,
136+ )
137 }),
138 ('alternative config', {
139 'command_line_arguments': ['--config=alternative.conf'],
140@@ -375,7 +379,9 @@
141 VISUALIZATION_OFF,
142 DONT_INSTALL_DEPS,
143 DONT_USE_SILENT,
144- DONT_USE_CACHE_DEPS)
145+ DONT_USE_CACHE_DEPS,
146+ DONT_USE_VERBOSE_LOGGING,
147+ )
148 }),
149 ('with apt-get update', {
150 'command_line_arguments': ['--update-apt'],
151@@ -387,7 +393,9 @@
152 VISUALIZATION_OFF,
153 DONT_INSTALL_DEPS,
154 DONT_USE_SILENT,
155- DONT_USE_CACHE_DEPS)
156+ DONT_USE_CACHE_DEPS,
157+ DONT_USE_VERBOSE_LOGGING,
158+ )
159 }),
160 ('one test suite', {
161 'command_line_arguments': ['test_suite'],
162@@ -399,7 +407,9 @@
163 VISUALIZATION_OFF,
164 DONT_INSTALL_DEPS,
165 DONT_USE_SILENT,
166- DONT_USE_CACHE_DEPS)
167+ DONT_USE_CACHE_DEPS,
168+ DONT_USE_VERBOSE_LOGGING,
169+ )
170 }),
171 ('multiple test suites', {
172 'command_line_arguments': [
173@@ -411,7 +421,9 @@
174 DONT_APT_UPDATE, NETWORK_NOT_ALREADY_SETUP, VISUALIZATION_OFF,
175 DONT_INSTALL_DEPS,
176 DONT_USE_SILENT,
177- DONT_USE_CACHE_DEPS)
178+ DONT_USE_CACHE_DEPS,
179+ DONT_USE_VERBOSE_LOGGING,
180+ )
181 }),
182 ('with network already setup', {
183 'command_line_arguments': ['--network-ready'],
184@@ -421,7 +433,9 @@
185 VISUALIZATION_OFF,
186 DONT_INSTALL_DEPS,
187 DONT_USE_SILENT,
188- DONT_USE_CACHE_DEPS)
189+ DONT_USE_CACHE_DEPS,
190+ DONT_USE_VERBOSE_LOGGING,
191+ )
192 }),
193 ('with touch visualisation enabled', {
194 'command_line_arguments': ['--touch-visualization'],
195@@ -431,7 +445,9 @@
196 VISUALIZATION_ON,
197 DONT_INSTALL_DEPS,
198 DONT_USE_SILENT,
199- DONT_USE_CACHE_DEPS)
200+ DONT_USE_CACHE_DEPS,
201+ DONT_USE_VERBOSE_LOGGING,
202+ )
203 }),
204 ('with install dependencies enabled', {
205 'command_line_arguments': ['--install-deps'],
206@@ -441,7 +457,9 @@
207 VISUALIZATION_OFF,
208 DO_INSTALL_DEPS,
209 DONT_USE_SILENT,
210- DONT_USE_CACHE_DEPS)
211+ DONT_USE_CACHE_DEPS,
212+ DONT_USE_VERBOSE_LOGGING,
213+ )
214 }),
215 ('with silent mode specified', {
216 'command_line_arguments': ['--silent'],
217@@ -451,7 +469,9 @@
218 VISUALIZATION_OFF,
219 DONT_INSTALL_DEPS,
220 DO_USE_SILENT,
221- DONT_USE_CACHE_DEPS)
222+ DONT_USE_CACHE_DEPS,
223+ DONT_USE_VERBOSE_LOGGING,
224+ )
225 }),
226 ('with cache deps specified', {
227 'command_line_arguments': ['--cache-deps'],
228@@ -461,7 +481,21 @@
229 VISUALIZATION_OFF,
230 DONT_INSTALL_DEPS,
231 DONT_USE_SILENT,
232- DO_USE_CACHE_DEPS)
233+ DO_USE_CACHE_DEPS,
234+ DONT_USE_VERBOSE_LOGGING,
235+ )
236+ }),
237+ ('with verbose logging specified', {
238+ 'command_line_arguments': ['--verbose'],
239+ 'parsed_arguments': (
240+ DEFAULT_CONFIG_FILE, [], DONT_APT_UPDATE,
241+ NETWORK_NOT_ALREADY_SETUP,
242+ VISUALIZATION_OFF,
243+ DONT_INSTALL_DEPS,
244+ DONT_USE_SILENT,
245+ DONT_USE_CACHE_DEPS,
246+ DO_USE_VERBOSE_LOGGING,
247+ )
248 }),
249 ]
250

Subscribers

People subscribed via source and target branches

to all changes: