Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: au_test_harness/au_worker.py

Issue 6815003: This CL updates the parallel job library in the au test harness to be more robust. (Closed) Base URL: http://git.chromium.org/git/crostestutils.git@master
Patch Set: Don's feedback Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « au_test_harness/au_test.py ('k') | au_test_harness/parallel_test_job.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium OS 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 """Module that contains the interface for au_test_harness workers. 5 """Module that contains the interface for au_test_harness workers.
6 6
7 An au test harnss worker is a class that contains the logic for performing 7 An au test harnss worker is a class that contains the logic for performing
8 and validating updates on a target. This should be subclassed to handle 8 and validating updates on a target. This should be subclassed to handle
9 various types of target. Types of targets include VM's, real devices, etc. 9 various types of target. Types of targets include VM's, real devices, etc.
10 """ 10 """
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 """ 225 """
226 cros_lib.Info('Output from VerifyImage():') 226 cros_lib.Info('Output from VerifyImage():')
227 print >> sys.stderr, output 227 print >> sys.stderr, output
228 sys.stderr.flush() 228 sys.stderr.flush()
229 percent_passed = self._ParseGenerateTestReportOutput(output) 229 percent_passed = self._ParseGenerateTestReportOutput(output)
230 cros_lib.Info('Percent passed: %d vs. Percent required: %d' % ( 230 cros_lib.Info('Percent passed: %d vs. Percent required: %d' % (
231 percent_passed, percent_required_to_pass)) 231 percent_passed, percent_required_to_pass))
232 unittest.assertTrue(percent_passed >= percent_required_to_pass) 232 unittest.assertTrue(percent_passed >= percent_required_to_pass)
233 return percent_passed 233 return percent_passed
234 234
235 def InitializeResultsDirectory(self): 235 def Initialize(self, port):
236 """Called by a test to initialize a results directory for this worker.""" 236 """Initializes test specific variables for each test.
237 # Use the name of the test. 237
238 Each test needs to specify a unique ssh port.
239
240 Args:
241 port: Unique port for ssh access.
242 """
243 # Initialize port vars.
244 self._ssh_port = port
245 self._kvm_pid_file = '/tmp/kvm.%d' % port
246
247 # Initialize test results directory.
238 test_name = inspect.stack()[1][3] 248 test_name = inspect.stack()[1][3]
239 self.results_directory = os.path.join(self.test_results_root, test_name) 249 self.results_directory = os.path.join(self.test_results_root, test_name)
240 self.results_count = 0 250 self.results_count = 0
241 251
242 def GetNextResultsPath(self, label): 252 def GetNextResultsPath(self, label):
243 """Returns a path for the results directory for this label. 253 """Returns a path for the results directory for this label.
244 254
245 Prefixes directory returned for worker with time called i.e. 1_label, 255 Prefixes directory returned for worker with time called i.e. 1_label,
246 2_label, etc. The directory returned is outside the chroot so if passing 256 2_label, etc. The directory returned is outside the chroot so if passing
247 to an script that is called with enther_chroot, make sure to use 257 to an script that is called with enther_chroot, make sure to use
(...skipping 15 matching lines...) Expand all
263 lines = output.split('\n') 273 lines = output.split('\n')
264 274
265 for line in lines: 275 for line in lines:
266 if line.startswith("Total PASS:"): 276 if line.startswith("Total PASS:"):
267 # FORMAT: ^TOTAL PASS: num_passed/num_total (percent%)$ 277 # FORMAT: ^TOTAL PASS: num_passed/num_total (percent%)$
268 percent_passed = line.split()[3].strip('()%') 278 percent_passed = line.split()[3].strip('()%')
269 cros_lib.Info('Percent of tests passed %s' % percent_passed) 279 cros_lib.Info('Percent of tests passed %s' % percent_passed)
270 break 280 break
271 281
272 return int(percent_passed) 282 return int(percent_passed)
OLDNEW
« no previous file with comments | « au_test_harness/au_test.py ('k') | au_test_harness/parallel_test_job.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698