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

Side by Side Diff: build/android/pylib/device/device_utils_test.py

Issue 1077173002: [Android] Tune DeviceUtils commands that are prone to large outputs. (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 unified diff | Download patch
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 """ 6 """
7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). 7 Unit tests for the contents of device_utils.py (mostly DeviceUtils).
8 """ 8 """
9 9
10 # pylint: disable=C0321 10 # pylint: disable=C0321
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 with self.assertCalls( 613 with self.assertCalls(
614 (self.call.adb.Shell(cmd), self.ShellError('', None)), 614 (self.call.adb.Shell(cmd), self.ShellError('', None)),
615 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.adb), 615 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.adb),
616 temp_file), 616 temp_file),
617 (self.call.adb.Shell(cmd_redirect)), 617 (self.call.adb.Shell(cmd_redirect)),
618 (self.call.device.ReadFile(mock.ANY), 'something')): 618 (self.call.device.ReadFile(mock.ANY), 'something')):
619 self.assertEquals(['something'], 619 self.assertEquals(['something'],
620 self.device.RunShellCommand(cmd, check_return=True)) 620 self.device.RunShellCommand(cmd, check_return=True))
621 621
622 622
623 class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
624
625 def testRunPipedShellCommand_success(self):
626 with self.assertCall(
627 self.call.device.RunShellCommand(
628 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
629 check_return=True),
630 ['This line contains foo', 'PIPESTATUS: 0 0']):
631 self.assertEquals(['This line contains foo'],
632 self.device._RunPipedShellCommand('ps | grep foo'))
633
634 def testRunPipedShellCommand_firstCommandFails(self):
635 with self.assertCall(
636 self.call.device.RunShellCommand(
637 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
638 check_return=True),
639 ['PIPESTATUS: 1 0']):
640 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
641 self.device._RunPipedShellCommand('ps | grep foo')
642 self.assertEquals([1, 0], ec.exception.status)
643
644 def testRunPipedShellCommand_secondCommandFails(self):
645 with self.assertCall(
646 self.call.device.RunShellCommand(
647 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
648 check_return=True),
649 ['PIPESTATUS: 0 1']):
650 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
651 self.device._RunPipedShellCommand('ps | grep foo')
652 self.assertEquals([0, 1], ec.exception.status)
653
654 def testRunPipedShellCommand_outputCutOff(self):
655 with self.assertCall(
656 self.call.device.RunShellCommand(
657 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
658 check_return=True),
659 ['foo.bar'] * 256 + ['foo.ba']):
660 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
661 self.device._RunPipedShellCommand('ps | grep foo')
662 self.assertIs(None, ec.exception.status)
663
664
623 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest): 665 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest):
624 666
625 def testGetDevicePieWrapper_jb(self): 667 def testGetDevicePieWrapper_jb(self):
626 with self.assertCall( 668 with self.assertCall(
627 self.call.device.build_version_sdk(), 669 self.call.device.build_version_sdk(),
628 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): 670 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN):
629 self.assertEqual('', self.device.GetDevicePieWrapper()) 671 self.assertEqual('', self.device.GetDevicePieWrapper())
630 672
631 def testGetDevicePieWrapper_ics(self): 673 def testGetDevicePieWrapper_ics(self):
632 with self.assertCalls( 674 with self.assertCalls(
633 (self.call.device.build_version_sdk(), 675 (self.call.device.build_version_sdk(),
634 constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH), 676 constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH),
635 (mock.call.pylib.constants.GetOutDirectory(), '/foo/bar'), 677 (mock.call.pylib.constants.GetOutDirectory(), '/foo/bar'),
636 (mock.call.os.path.exists(mock.ANY), True), 678 (mock.call.os.path.exists(mock.ANY), True),
637 (self.call.adb.Push(mock.ANY, mock.ANY), '')): 679 (self.call.adb.Push(mock.ANY, mock.ANY), '')):
638 self.assertNotEqual('', self.device.GetDevicePieWrapper()) 680 self.assertNotEqual('', self.device.GetDevicePieWrapper())
639 681
640 682
641 @mock.patch('time.sleep', mock.Mock()) 683 @mock.patch('time.sleep', mock.Mock())
642 class DeviceUtilsKillAllTest(DeviceUtilsTest): 684 class DeviceUtilsKillAllTest(DeviceUtilsTest):
643 685
644 def testKillAll_noMatchingProcesses(self): 686 def testKillAll_noMatchingProcesses(self):
645 with self.assertCall(self.call.adb.Shell('ps'), 687 with self.assertCall(self.call.device.GetPids('test_process'), []):
646 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'):
647 with self.assertRaises(device_errors.CommandFailedError): 688 with self.assertRaises(device_errors.CommandFailedError):
648 self.device.KillAll('test_process') 689 self.device.KillAll('test_process')
649 690
650 def testKillAll_nonblocking(self): 691 def testKillAll_nonblocking(self):
651 with self.assertCalls( 692 with self.assertCalls(
652 (self.call.adb.Shell('ps'), 693 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
653 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
654 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
655 (self.call.adb.Shell('kill -9 1234'), '')): 694 (self.call.adb.Shell('kill -9 1234'), '')):
656 self.assertEquals(1, 695 self.assertEquals(
657 self.device.KillAll('some.process', blocking=False)) 696 1, self.device.KillAll('some.process', blocking=False))
658 697
659 def testKillAll_blocking(self): 698 def testKillAll_blocking(self):
660 with self.assertCalls( 699 with self.assertCalls(
661 (self.call.adb.Shell('ps'), 700 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
662 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
663 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
664 (self.call.adb.Shell('kill -9 1234'), ''), 701 (self.call.adb.Shell('kill -9 1234'), ''),
665 (self.call.adb.Shell('ps'), 702 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
666 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 703 (self.call.device.GetPids('some.process'), [])):
667 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'), 704 self.assertEquals(
668 (self.call.adb.Shell('ps'), 705 1, self.device.KillAll('some.process', blocking=True))
669 'USER PID PPID VSIZE RSS WCHAN PC NAME\n')):
670 self.assertEquals(1,
671 self.device.KillAll('some.process', blocking=True))
672 706
673 def testKillAll_root(self): 707 def testKillAll_root(self):
674 with self.assertCalls( 708 with self.assertCalls(
675 (self.call.adb.Shell('ps'), 709 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
676 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
677 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
678 (self.call.device.NeedsSU(), True), 710 (self.call.device.NeedsSU(), True),
679 (self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')): 711 (self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')):
680 self.assertEquals(1, 712 self.assertEquals(
681 self.device.KillAll('some.process', as_root=True)) 713 1, self.device.KillAll('some.process', as_root=True))
682 714
683 def testKillAll_sigterm(self): 715 def testKillAll_sigterm(self):
684 with self.assertCalls( 716 with self.assertCalls(
685 (self.call.adb.Shell('ps'), 717 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
686 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
687 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
688 (self.call.adb.Shell('kill -15 1234'), '')): 718 (self.call.adb.Shell('kill -15 1234'), '')):
689 self.assertEquals(1, 719 self.assertEquals(
690 self.device.KillAll('some.process', signum=signal.SIGTERM)) 720 1, self.device.KillAll('some.process', signum=signal.SIGTERM))
691 721
692 722
693 class DeviceUtilsStartActivityTest(DeviceUtilsTest): 723 class DeviceUtilsStartActivityTest(DeviceUtilsTest):
694 724
695 def testStartActivity_actionOnly(self): 725 def testStartActivity_actionOnly(self):
696 test_intent = intent.Intent(action='android.intent.action.VIEW') 726 test_intent = intent.Intent(action='android.intent.action.VIEW')
697 with self.assertCall( 727 with self.assertCall(
698 self.call.adb.Shell('am start ' 728 self.call.adb.Shell('am start '
699 '-a android.intent.action.VIEW'), 729 '-a android.intent.action.VIEW'),
700 'Starting: Intent { act=android.intent.action.VIEW }'): 730 'Starting: Intent { act=android.intent.action.VIEW }'):
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 with self.assertRaises(device_errors.CommandFailedError): 1138 with self.assertRaises(device_errors.CommandFailedError):
1109 self.device._ReadFileWithPull('/path/to/device/file') 1139 self.device._ReadFileWithPull('/path/to/device/file')
1110 1140
1111 def testReadFile_exists(self): 1141 def testReadFile_exists(self):
1112 with self.assertCalls( 1142 with self.assertCalls(
1113 (self.call.device.RunShellCommand( 1143 (self.call.device.RunShellCommand(
1114 ['ls', '-l', '/read/this/test/file'], 1144 ['ls', '-l', '/read/this/test/file'],
1115 as_root=False, check_return=True), 1145 as_root=False, check_return=True),
1116 ['-rw-rw---- root foo 256 1970-01-01 00:00 file']), 1146 ['-rw-rw---- root foo 256 1970-01-01 00:00 file']),
1117 (self.call.device.RunShellCommand( 1147 (self.call.device.RunShellCommand(
1118 ['cat', '/read/this/test/file'], as_root=False, check_return=True), 1148 ['cat', '/read/this/test/file'],
1149 as_root=False, check_return=True),
1119 ['this is a test file'])): 1150 ['this is a test file'])):
1120 self.assertEqual('this is a test file\n', 1151 self.assertEqual('this is a test file\n',
1121 self.device.ReadFile('/read/this/test/file')) 1152 self.device.ReadFile('/read/this/test/file'))
1122 1153
1123 def testReadFile_doesNotExist(self): 1154 def testReadFile_doesNotExist(self):
1124 with self.assertCall( 1155 with self.assertCall(
1125 self.call.device.RunShellCommand( 1156 self.call.device.RunShellCommand(
1126 ['ls', '-l', '/this/file/does.not.exist'], 1157 ['ls', '-l', '/this/file/does.not.exist'],
1127 as_root=False, check_return=True), 1158 as_root=False, check_return=True),
1128 self.CommandError('File does not exist')): 1159 self.CommandError('File does not exist')):
1129 with self.assertRaises(device_errors.CommandFailedError): 1160 with self.assertRaises(device_errors.CommandFailedError):
1130 self.device.ReadFile('/this/file/does.not.exist') 1161 self.device.ReadFile('/this/file/does.not.exist')
1131 1162
1163 def testReadFile_zeroSize(self):
1164 with self.assertCalls(
1165 (self.call.device.RunShellCommand(
1166 ['ls', '-l', '/this/file/has/zero/size'],
1167 as_root=False, check_return=True),
1168 ['-r--r--r-- root foo 0 1970-01-01 00:00 zero_size_file']),
1169 (self.call.device._ReadFileWithPull('/this/file/has/zero/size'),
1170 'but it has contents\n')):
1171 self.assertEqual('but it has contents\n',
1172 self.device.ReadFile('/this/file/has/zero/size'))
1173
1132 def testReadFile_withSU(self): 1174 def testReadFile_withSU(self):
1133 with self.assertCalls( 1175 with self.assertCalls(
1134 (self.call.device.RunShellCommand( 1176 (self.call.device.RunShellCommand(
1135 ['ls', '-l', '/this/file/can.be.read.with.su'], 1177 ['ls', '-l', '/this/file/can.be.read.with.su'],
1136 as_root=True, check_return=True), 1178 as_root=True, check_return=True),
1137 ['-rw------- root root 256 1970-01-01 00:00 can.be.read.with.su']), 1179 ['-rw------- root root 256 1970-01-01 00:00 can.be.read.with.su']),
1138 (self.call.device.RunShellCommand( 1180 (self.call.device.RunShellCommand(
1139 ['cat', '/this/file/can.be.read.with.su'], 1181 ['cat', '/this/file/can.be.read.with.su'],
1140 as_root=True, check_return=True), 1182 as_root=True, check_return=True),
1141 ['this is a test file', 'read with su'])): 1183 ['this is a test file', 'read with su'])):
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 with self.assertCalls( 1422 with self.assertCalls(
1381 (self.call.adb.Shell('setprop test.property new_value'), ''), 1423 (self.call.adb.Shell('setprop test.property new_value'), ''),
1382 (self.call.adb.Shell('getprop test.property'), 'old_value')): 1424 (self.call.adb.Shell('getprop test.property'), 'old_value')):
1383 with self.assertRaises(device_errors.CommandFailedError): 1425 with self.assertRaises(device_errors.CommandFailedError):
1384 self.device.SetProp('test.property', 'new_value', check=True) 1426 self.device.SetProp('test.property', 'new_value', check=True)
1385 1427
1386 1428
1387 class DeviceUtilsGetPidsTest(DeviceUtilsTest): 1429 class DeviceUtilsGetPidsTest(DeviceUtilsTest):
1388 1430
1389 def testGetPids_noMatches(self): 1431 def testGetPids_noMatches(self):
1390 with self.assertCall(self.call.adb.Shell('ps'), 1432 with self.assertCall(
1391 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1433 self.call.device._RunPipedShellCommand(
1392 'user 1000 100 1024 1024 ffffffff 00000000 no.match\n'): 1434 "'ps | grep -F does.not.match'"),
1435 []):
1393 self.assertEqual({}, self.device.GetPids('does.not.match')) 1436 self.assertEqual({}, self.device.GetPids('does.not.match'))
1394 1437
1395 def testGetPids_oneMatch(self): 1438 def testGetPids_oneMatch(self):
1396 with self.assertCall(self.call.adb.Shell('ps'), 1439 with self.assertCall(
1397 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1440 self.call.device._RunPipedShellCommand(
1398 'user 1000 100 1024 1024 ffffffff 00000000 not.a.match\n' 1441 "'ps | grep -F one.match'"),
1399 'user 1001 100 1024 1024 ffffffff 00000000 one.match\n'): 1442 ['user 1001 100 1024 1024 ffffffff 00000000 one.match']):
1400 self.assertEqual({'one.match': '1001'}, self.device.GetPids('one.match')) 1443 self.assertEqual({'one.match': '1001'}, self.device.GetPids('one.match'))
1401 1444
1402 def testGetPids_mutlipleMatches(self): 1445 def testGetPids_mutlipleMatches(self):
1403 with self.assertCall(self.call.adb.Shell('ps'), 1446 with self.assertCall(
1404 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1447 self.call.device._RunPipedShellCommand(
1405 'user 1000 100 1024 1024 ffffffff 00000000 not\n' 1448 "'ps | grep -F match'"),
1406 'user 1001 100 1024 1024 ffffffff 00000000 one.match\n' 1449 ['user 1001 100 1024 1024 ffffffff 00000000 one.match',
1407 'user 1002 100 1024 1024 ffffffff 00000000 two.match\n' 1450 'user 1002 100 1024 1024 ffffffff 00000000 two.match',
1408 'user 1003 100 1024 1024 ffffffff 00000000 three.match\n'): 1451 'user 1003 100 1024 1024 ffffffff 00000000 three.match']):
1409 self.assertEqual( 1452 self.assertEqual(
1410 {'one.match': '1001', 'two.match': '1002', 'three.match': '1003'}, 1453 {'one.match': '1001', 'two.match': '1002', 'three.match': '1003'},
1411 self.device.GetPids('match')) 1454 self.device.GetPids('match'))
1412 1455
1413 def testGetPids_exactMatch(self): 1456 def testGetPids_exactMatch(self):
1414 with self.assertCall(self.call.adb.Shell('ps'), 1457 with self.assertCall(
1415 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1458 self.call.device._RunPipedShellCommand(
1416 'user 1000 100 1024 1024 ffffffff 00000000 not.exact.match\n' 1459 "'ps | grep -F exact.match'"),
1417 'user 1234 100 1024 1024 ffffffff 00000000 exact.match\n'): 1460 ['user 1000 100 1024 1024 ffffffff 00000000 not.exact.match',
1461 'user 1234 100 1024 1024 ffffffff 00000000 exact.match']):
1418 self.assertEqual( 1462 self.assertEqual(
1419 {'not.exact.match': '1000', 'exact.match': '1234'}, 1463 {'not.exact.match': '1000', 'exact.match': '1234'},
1420 self.device.GetPids('exact.match')) 1464 self.device.GetPids('exact.match'))
1421 1465
1422 1466
1423 class DeviceUtilsTakeScreenshotTest(DeviceUtilsTest): 1467 class DeviceUtilsTakeScreenshotTest(DeviceUtilsTest):
1424 1468
1425 def testTakeScreenshot_fileNameProvided(self): 1469 def testTakeScreenshot_fileNameProvided(self):
1426 with self.assertCalls( 1470 with self.assertCalls(
1427 (mock.call.pylib.utils.device_temp_file.DeviceTempFile( 1471 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(
1428 self.adb, suffix='.png'), 1472 self.adb, suffix='.png'),
1429 MockTempFile('/tmp/path/temp-123.png')), 1473 MockTempFile('/tmp/path/temp-123.png')),
1430 (self.call.adb.Shell('/system/bin/screencap -p /tmp/path/temp-123.png'), 1474 (self.call.adb.Shell('/system/bin/screencap -p /tmp/path/temp-123.png'),
1431 ''), 1475 ''),
1432 self.call.device.PullFile('/tmp/path/temp-123.png', 1476 self.call.device.PullFile('/tmp/path/temp-123.png',
1433 '/test/host/screenshot.png')): 1477 '/test/host/screenshot.png')):
1434 self.device.TakeScreenshot('/test/host/screenshot.png') 1478 self.device.TakeScreenshot('/test/host/screenshot.png')
1435 1479
1436 1480
1437 class DeviceUtilsGetMemoryUsageForPidTest(DeviceUtilsTest): 1481 class DeviceUtilsGetMemoryUsageForPidTest(DeviceUtilsTest):
1438 1482
1439 def setUp(self): 1483 def setUp(self):
1440 super(DeviceUtilsGetMemoryUsageForPidTest, self).setUp() 1484 super(DeviceUtilsGetMemoryUsageForPidTest, self).setUp()
1441 1485
1442 def testGetMemoryUsageForPid_validPid(self): 1486 def testGetMemoryUsageForPid_validPid(self):
1443 with self.assertCalls( 1487 with self.assertCalls(
1444 (self.call.device.RunShellCommand( 1488 (self.call.device._RunPipedShellCommand(
1445 ['showmap', '1234'], as_root=True, check_return=True), 1489 'showmap 1234 | grep TOTAL', as_root=True),
1446 ['100 101 102 103 104 105 106 107 TOTAL']), 1490 ['100 101 102 103 104 105 106 107 TOTAL']),
1447 (self.call.device.ReadFile('/proc/1234/status', as_root=True), 1491 (self.call.device.ReadFile('/proc/1234/status', as_root=True),
1448 'VmHWM: 1024 kB\n')): 1492 'VmHWM: 1024 kB\n')):
1449 self.assertEqual( 1493 self.assertEqual(
1450 { 1494 {
1451 'Size': 100, 1495 'Size': 100,
1452 'Rss': 101, 1496 'Rss': 101,
1453 'Pss': 102, 1497 'Pss': 102,
1454 'Shared_Clean': 103, 1498 'Shared_Clean': 103,
1455 'Shared_Dirty': 104, 1499 'Shared_Dirty': 104,
1456 'Private_Clean': 105, 1500 'Private_Clean': 105,
1457 'Private_Dirty': 106, 1501 'Private_Dirty': 106,
1458 'VmHWM': 1024 1502 'VmHWM': 1024
1459 }, 1503 },
1460 self.device.GetMemoryUsageForPid(1234)) 1504 self.device.GetMemoryUsageForPid(1234))
1461 1505
1462 def testGetMemoryUsageForPid_noSmaps(self): 1506 def testGetMemoryUsageForPid_noSmaps(self):
1463 with self.assertCalls( 1507 with self.assertCalls(
1464 (self.call.device.RunShellCommand( 1508 (self.call.device._RunPipedShellCommand(
1465 ['showmap', '4321'], as_root=True, check_return=True), 1509 'showmap 4321 | grep TOTAL', as_root=True),
1466 ['cannot open /proc/4321/smaps: No such file or directory']), 1510 ['cannot open /proc/4321/smaps: No such file or directory']),
1467 (self.call.device.ReadFile('/proc/4321/status', as_root=True), 1511 (self.call.device.ReadFile('/proc/4321/status', as_root=True),
1468 'VmHWM: 1024 kb\n')): 1512 'VmHWM: 1024 kb\n')):
1469 self.assertEquals({'VmHWM': 1024}, self.device.GetMemoryUsageForPid(4321)) 1513 self.assertEquals({'VmHWM': 1024}, self.device.GetMemoryUsageForPid(4321))
1470 1514
1471 def testGetMemoryUsageForPid_noStatus(self): 1515 def testGetMemoryUsageForPid_noStatus(self):
1472 with self.assertCalls( 1516 with self.assertCalls(
1473 (self.call.device.RunShellCommand( 1517 (self.call.device._RunPipedShellCommand(
1474 ['showmap', '4321'], as_root=True, check_return=True), 1518 'showmap 4321 | grep TOTAL', as_root=True),
1475 ['100 101 102 103 104 105 106 107 TOTAL']), 1519 ['100 101 102 103 104 105 106 107 TOTAL']),
1476 (self.call.device.ReadFile('/proc/4321/status', as_root=True), 1520 (self.call.device.ReadFile('/proc/4321/status', as_root=True),
1477 self.CommandError())): 1521 self.CommandError())):
1478 self.assertEquals( 1522 self.assertEquals(
1479 { 1523 {
1480 'Size': 100, 1524 'Size': 100,
1481 'Rss': 101, 1525 'Rss': 101,
1482 'Pss': 102, 1526 'Pss': 102,
1483 'Shared_Clean': 103, 1527 'Shared_Clean': 103,
1484 'Shared_Dirty': 104, 1528 'Shared_Dirty': 104,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 self.assertEqual(client_cache_one, {'test': 1}) 1584 self.assertEqual(client_cache_one, {'test': 1})
1541 self.assertEqual(client_cache_two, {'test': 1}) 1585 self.assertEqual(client_cache_two, {'test': 1})
1542 self.device._ClearCache() 1586 self.device._ClearCache()
1543 self.assertEqual(client_cache_one, {}) 1587 self.assertEqual(client_cache_one, {})
1544 self.assertEqual(client_cache_two, {}) 1588 self.assertEqual(client_cache_two, {})
1545 1589
1546 if __name__ == '__main__': 1590 if __name__ == '__main__':
1547 logging.getLogger().setLevel(logging.DEBUG) 1591 logging.getLogger().setLevel(logging.DEBUG)
1548 unittest.main(verbosity=2) 1592 unittest.main(verbosity=2)
1549 1593
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698