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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import logging 5 import logging
6 import os 6 import os
7 import pickle 7 import pickle
8 import re 8 import re
9 import sys 9 import sys
10 10
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 def _GetTestsFromPickle(self, pickle_path, jar_path): 329 def _GetTestsFromPickle(self, pickle_path, jar_path):
330 if not os.path.exists(pickle_path): 330 if not os.path.exists(pickle_path):
331 raise self.ProguardPickleException('%s does not exist.' % pickle_path) 331 raise self.ProguardPickleException('%s does not exist.' % pickle_path)
332 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path): 332 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path):
333 raise self.ProguardPickleException( 333 raise self.ProguardPickleException(
334 '%s newer than %s.' % (jar_path, pickle_path)) 334 '%s newer than %s.' % (jar_path, pickle_path))
335 335
336 with open(pickle_path, 'r') as pickle_file: 336 with open(pickle_path, 'r') as pickle_file:
337 pickle_data = pickle.loads(pickle_file.read()) 337 pickle_data = pickle.loads(pickle_file.read())
338 jar_md5, _ = md5sum.CalculateHostMd5Sums(jar_path)[0] 338 jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path]
339 339
340 try: 340 try:
341 if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION: 341 if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION:
342 raise self.ProguardPickleException('PICKLE_FORMAT_VERSION has changed.') 342 raise self.ProguardPickleException('PICKLE_FORMAT_VERSION has changed.')
343 if pickle_data['JAR_MD5SUM'] != jar_md5: 343 if pickle_data['JAR_MD5SUM'] != jar_md5:
344 raise self.ProguardPickleException('JAR file MD5 sum differs.') 344 raise self.ProguardPickleException('JAR file MD5 sum differs.')
345 return pickle_data['TEST_METHODS'] 345 return pickle_data['TEST_METHODS']
346 except TypeError as e: 346 except TypeError as e:
347 logging.error(pickle_data) 347 logging.error(pickle_data)
348 raise self.ProguardPickleException(str(e)) 348 raise self.ProguardPickleException(str(e))
(...skipping 21 matching lines...) Expand all
370 return { 370 return {
371 'class': c['class'], 371 'class': c['class'],
372 'annotations': recursive_get_class_annotations(c), 372 'annotations': recursive_get_class_annotations(c),
373 'methods': [m for m in c['methods'] if is_test_method(m)], 373 'methods': [m for m in c['methods'] if is_test_method(m)],
374 } 374 }
375 375
376 return [stripped_test_class(c) for c in p['classes'] 376 return [stripped_test_class(c) for c in p['classes']
377 if is_test_class(c)] 377 if is_test_class(c)]
378 378
379 def _SaveTestsToPickle(self, pickle_path, jar_path, tests): 379 def _SaveTestsToPickle(self, pickle_path, jar_path, tests):
380 jar_md5, _ = md5sum.CalculateHostMd5Sums(jar_path)[0] 380 jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path]
381 pickle_data = { 381 pickle_data = {
382 'VERSION': _PICKLE_FORMAT_VERSION, 382 'VERSION': _PICKLE_FORMAT_VERSION,
383 'JAR_MD5SUM': jar_md5, 383 'JAR_MD5SUM': jar_md5,
384 'TEST_METHODS': tests, 384 'TEST_METHODS': tests,
385 } 385 }
386 with open(pickle_path, 'w') as pickle_file: 386 with open(pickle_path, 'w') as pickle_file:
387 pickle.dump(pickle_data, pickle_file) 387 pickle.dump(pickle_data, pickle_file)
388 388
389 def _FilterTests(self, tests): 389 def _FilterTests(self, tests):
390 390
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 def GenerateTestResults( 453 def GenerateTestResults(
454 result_code, result_bundle, statuses, start_ms, duration_ms): 454 result_code, result_bundle, statuses, start_ms, duration_ms):
455 return GenerateTestResults(result_code, result_bundle, statuses, 455 return GenerateTestResults(result_code, result_bundle, statuses,
456 start_ms, duration_ms) 456 start_ms, duration_ms)
457 457
458 #override 458 #override
459 def TearDown(self): 459 def TearDown(self):
460 if self._isolate_delegate: 460 if self._isolate_delegate:
461 self._isolate_delegate.Clear() 461 self._isolate_delegate.Clear()
462 462
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698