From 35953285644fe231b7d9ae4d1e48110613f4a4f6 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 5 Jun 2015 13:11:43 -0700 Subject: [PATCH] Fix test_adb.py against production builds. Also use assertEqual for better errors. (I accidentally tested against a non-AOSP build that doesn't have the \r fix.) Change-Id: Ib032c01efa4e1efb14467ca776a14160fff4ad39 --- adb/tests/test_adb.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/adb/tests/test_adb.py b/adb/tests/test_adb.py index 0be1efc21..730f66839 100755 --- a/adb/tests/test_adb.py +++ b/adb/tests/test_adb.py @@ -249,7 +249,8 @@ class AdbBasic(unittest.TestCase): def _test_root(self): adb = AdbWrapper() - adb.root() + if "adbd cannot run as root in production builds" in adb.root(): + return adb.wait() self.assertEqual("root", adb.shell("id -un").strip()) @@ -317,16 +318,13 @@ class AdbBasic(unittest.TestCase): Bug: http://b/19735063 """ - output = AdbWrapper().shell("uname"); + output = AdbWrapper().shell("uname") if sys.platform == 'win32': # adb.exe running on Windows does translation to the Windows \r\n # convention, so we should expect those chars. - self.assertTrue(output.endswith("\r\n")); - # If the server outputs \r\n and adb.exe translates that to \r\r\n - # we want to catch that server problem. - self.assertFalse(output.endswith("\r\r\n")); + self.assertEqual(output, "Linux\r\n") else: - self.assertFalse(output.endswith("\r\n")) + self.assertEqual(output, "Linux\n") class AdbFile(unittest.TestCase):