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

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

Issue 2805533003: [build/android] Load/dump pickles directly form/to files (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | build/android/pylib/local/device/local_device_perf_test_run.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 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 collections 5 import collections
6 import copy 6 import copy
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import pickle 10 import pickle
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return tests 314 return tests
315 315
316 316
317 def _GetTestsFromPickle(pickle_path, jar_path): 317 def _GetTestsFromPickle(pickle_path, jar_path):
318 if not os.path.exists(pickle_path): 318 if not os.path.exists(pickle_path):
319 raise TestListPickleException('%s does not exist.' % pickle_path) 319 raise TestListPickleException('%s does not exist.' % pickle_path)
320 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path): 320 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path):
321 raise TestListPickleException( 321 raise TestListPickleException(
322 '%s newer than %s.' % (jar_path, pickle_path)) 322 '%s newer than %s.' % (jar_path, pickle_path))
323 323
324 with open(pickle_path, 'r') as pickle_file: 324 with open(pickle_path, 'r') as f:
325 pickle_data = pickle.loads(pickle_file.read()) 325 pickle_data = pickle.load(f)
326 jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path] 326 jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path]
327 327
328 if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION: 328 if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION:
329 raise TestListPickleException('PICKLE_FORMAT_VERSION has changed.') 329 raise TestListPickleException('PICKLE_FORMAT_VERSION has changed.')
330 if pickle_data['JAR_MD5SUM'] != jar_md5: 330 if pickle_data['JAR_MD5SUM'] != jar_md5:
331 raise TestListPickleException('JAR file MD5 sum differs.') 331 raise TestListPickleException('JAR file MD5 sum differs.')
332 return pickle_data['TEST_METHODS'] 332 return pickle_data['TEST_METHODS']
333 333
334 334
335 def _GetTestsFromProguard(jar_path): 335 def _GetTestsFromProguard(jar_path):
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 882
883 @staticmethod 883 @staticmethod
884 def GenerateTestResults( 884 def GenerateTestResults(
885 result_code, result_bundle, statuses, start_ms, duration_ms): 885 result_code, result_bundle, statuses, start_ms, duration_ms):
886 return GenerateTestResults(result_code, result_bundle, statuses, 886 return GenerateTestResults(result_code, result_bundle, statuses,
887 start_ms, duration_ms) 887 start_ms, duration_ms)
888 888
889 #override 889 #override
890 def TearDown(self): 890 def TearDown(self):
891 pass 891 pass
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/local/device/local_device_perf_test_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698