OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 # We give different default value to launch HTTP server based on shard index | 160 # We give different default value to launch HTTP server based on shard index |
161 # because it may have race condition when multiple processes are trying to | 161 # because it may have race condition when multiple processes are trying to |
162 # launch lighttpd with same port at same time. | 162 # launch lighttpd with same port at same time. |
163 self.LaunchTestHttpServer( | 163 self.LaunchTestHttpServer( |
164 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 164 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
165 if self.flags: | 165 if self.flags: |
166 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) | 166 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) |
167 if self.options.device_flags: | 167 if self.options.device_flags: |
168 with open(self.options.device_flags) as device_flags_file: | 168 with open(self.options.device_flags) as device_flags_file: |
169 self.flags.AddFlags(list(device_flags_file)) | 169 stripped_flags = (l.strip() for l in device_flags_file) |
| 170 self.flags.AddFlags([flag for flag in stripped_flags if flag]) |
170 | 171 |
171 def TearDown(self): | 172 def TearDown(self): |
172 """Cleans up the test harness and saves outstanding data from test run.""" | 173 """Cleans up the test harness and saves outstanding data from test run.""" |
173 if self.flags: | 174 if self.flags: |
174 self.flags.Restore() | 175 self.flags.Restore() |
175 super(TestRunner, self).TearDown() | 176 super(TestRunner, self).TearDown() |
176 | 177 |
177 def TestSetup(self, test): | 178 def TestSetup(self, test): |
178 """Sets up the test harness for running a particular test. | 179 """Sets up the test harness for running a particular test. |
179 | 180 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 duration_ms = 0 | 431 duration_ms = 0 |
431 message = str(e) | 432 message = str(e) |
432 if not message: | 433 if not message: |
433 message = 'No information.' | 434 message = 'No information.' |
434 results.AddResult(test_result.InstrumentationTestResult( | 435 results.AddResult(test_result.InstrumentationTestResult( |
435 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 436 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
436 log=message)) | 437 log=message)) |
437 raw_result = None | 438 raw_result = None |
438 self.TestTeardown(test, raw_result) | 439 self.TestTeardown(test, raw_result) |
439 return (results, None if results.DidRunPass() else test) | 440 return (results, None if results.DidRunPass() else test) |
OLD | NEW |