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

Side by Side Diff: build/android/pylib/utils/md5sum_test.py

Issue 1303363005: When updating md5sum_bin, wipe the directory first (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check_return=Tue Created 5 years, 3 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 | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 from pylib import cmd_helper 10 from pylib import cmd_helper
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 device.adb.Push = mock.Mock() 206 device.adb.Push = mock.Mock()
207 device_md5sum_output = [ 207 device_md5sum_output = [
208 'WARNING: linker: /data/local/tmp/md5sum/md5sum_bin: ' 208 'WARNING: linker: /data/local/tmp/md5sum/md5sum_bin: '
209 'unused DT entry: type 0x1d arg 0x15db', 209 'unused DT entry: type 0x1d arg 0x15db',
210 'THIS_IS_NOT_A_VALID_CHECKSUM_ZZZ some random text', 210 'THIS_IS_NOT_A_VALID_CHECKSUM_ZZZ some random text',
211 '0123456789abcdeffedcba9876543210 ' 211 '0123456789abcdeffedcba9876543210 '
212 '/storage/emulated/legacy/test/file.dat', 212 '/storage/emulated/legacy/test/file.dat',
213 ] 213 ]
214 error = device_errors.AdbShellCommandFailedError('cmd', 'out', 2) 214 error = device_errors.AdbShellCommandFailedError('cmd', 'out', 2)
215 device.RunShellCommand = mock.Mock( 215 device.RunShellCommand = mock.Mock(
216 side_effect=(error, device_md5sum_output)) 216 side_effect=(error, '', device_md5sum_output))
217 217
218 with mock.patch('os.path.getsize', return_value=1337): 218 with mock.patch('os.path.getsize', return_value=1337):
219 out = md5sum.CalculateDeviceMd5Sums(test_path, device) 219 out = md5sum.CalculateDeviceMd5Sums(test_path, device)
220 self.assertEquals(1, len(out)) 220 self.assertEquals(1, len(out))
221 self.assertTrue('/storage/emulated/legacy/test/file.dat' in out) 221 self.assertTrue('/storage/emulated/legacy/test/file.dat' in out)
222 self.assertEquals('0123456789abcdeffedcba9876543210', 222 self.assertEquals('0123456789abcdeffedcba9876543210',
223 out['/storage/emulated/legacy/test/file.dat']) 223 out['/storage/emulated/legacy/test/file.dat'])
224 self.assertEquals(2, len(device.RunShellCommand.call_args_list)) 224 self.assertEquals(3, len(device.RunShellCommand.call_args_list))
225 device.adb.Push.assert_called_once_with( 225 device.adb.Push.assert_called_once_with(
226 'test/out/directory/md5sum_dist', '/data/local/tmp/md5sum/') 226 'test/out/directory/md5sum_dist', '/data/local/tmp/md5sum/')
227 227
228 228
229 if __name__ == '__main__': 229 if __name__ == '__main__':
230 unittest.main(verbosity=2) 230 unittest.main(verbosity=2)
231 231
OLDNEW
« no previous file with comments | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698