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) |