[build/android] Load/dump pickles directly form/to files

No need to build intermediate (possibly quite large) strings. This
might also help with large objects failing to pickle.

BUG=680935

Review-Url: https://codereview.chromium.org/2805533003
Cr-Original-Commit-Position: refs/heads/master@{#462553}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: be6dcf5eec3df0153f9e67b0b1a15cf4416144b7
This commit is contained in:
perezju 2017-04-06 11:21:00 -07:00 коммит произвёл Commit bot
Родитель 3e16f6a546
Коммит 8313f506a0
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -321,8 +321,8 @@ def _GetTestsFromPickle(pickle_path, jar_path):
raise TestListPickleException(
'%s newer than %s.' % (jar_path, pickle_path))
with open(pickle_path, 'r') as pickle_file:
pickle_data = pickle.loads(pickle_file.read())
with open(pickle_path, 'r') as f:
pickle_data = pickle.load(f)
jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path]
if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION:

Просмотреть файл

@ -206,10 +206,10 @@ class TestShard(object):
pickled = os.path.join(constants.PERF_OUTPUT_DIR, result['name'])
if os.path.exists(pickled):
with file(pickled, 'r') as f:
previous = pickle.loads(f.read())
previous = pickle.load(f)
result['output'] = previous['output'] + result['output']
with file(pickled, 'w') as f:
f.write(pickle.dumps(result))
pickle.dump(result, f)
def _TestTearDown(self):
if self._output_dir:

Просмотреть файл

@ -26,7 +26,7 @@ def _GetPersistedResult(test_name):
return None
with file(file_name, 'r') as f:
return pickle.loads(f.read())
return pickle.load(f)
def _GetChromiumRevision():