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

Unified Diff: build/android/pylib/utils/md5sum_test.py

Issue 1106573002: [Android] Fix checksum handling when md5sum generates unexpected output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/utils/md5sum_test.py
diff --git a/build/android/pylib/utils/md5sum_test.py b/build/android/pylib/utils/md5sum_test.py
index 6c689fbd2bb6bfb2959511f8acc0e3f7c3ba4fe9..31aed3f14617768f74f2ae9c387b30e47ebd8c16 100755
--- a/build/android/pylib/utils/md5sum_test.py
+++ b/build/android/pylib/utils/md5sum_test.py
@@ -177,6 +177,40 @@ class Md5SumTest(unittest.TestCase):
device.RunShellCommand.assert_called_once_with(
['sh', '/data/local/tmp/test/script/file.sh'])
+ def testCalculateDeviceMd5Sums_singlePath_linkerWarning(self):
+ # See crbug/479966
+ test_path = '/storage/emulated/legacy/test/file.dat'
+
+ device = mock.NonCallableMock()
+ device.adb = mock.NonCallableMock()
+ device.adb.Push = mock.Mock()
+ device_md5sum_output = [
+ 'WARNING: linker: /data/local/tmp/md5sum/md5sum_bin: '
+ 'unused DT entry: type 0x1d arg 0x15db',
+ '0123456789abcdeffedcba9876543210 '
+ '/storage/emulated/legacy/test/file.dat',
+ ]
+ device.RunShellCommand = mock.Mock(return_value=device_md5sum_output)
+
+ mock_temp_file = mock.mock_open()
+ mock_temp_file.return_value.name = '/tmp/test/script/file.sh'
+
+ mock_device_temp_file = mock.mock_open()
+ mock_device_temp_file.return_value.name = (
+ '/data/local/tmp/test/script/file.sh')
+
+ with mock.patch('tempfile.NamedTemporaryFile', new=mock_temp_file), (
+ mock.patch('pylib.utils.device_temp_file.DeviceTempFile',
+ new=mock_device_temp_file)):
+ out = md5sum.CalculateDeviceMd5Sums(test_path, device)
+ self.assertEquals(1, len(out))
+ self.assertEquals('0123456789abcdeffedcba9876543210', out[0].hash)
+ self.assertEquals('/storage/emulated/legacy/test/file.dat', out[0].path)
+ device.adb.Push.assert_called_once_with(
+ '/tmp/test/script/file.sh', '/data/local/tmp/test/script/file.sh')
+ device.RunShellCommand.assert_called_once_with(
+ ['sh', '/data/local/tmp/test/script/file.sh'])
+
if __name__ == '__main__':
unittest.main(verbosity=2)
« build/android/pylib/device/device_utils.py ('K') | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698