Merge "Fix adb tcpip tests."
am: d865b655d5
Change-Id: I1b9938c36b59db8ce991928349ba6ee9c8459de1
This commit is contained in:
commit
37f256423b
2 changed files with 9 additions and 5 deletions
|
|
@ -1588,9 +1588,13 @@ int adb_commandline(int argc, const char** argv) {
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
} else if (!strcmp(argv[0], "tcpip")) {
|
||||||
else if (!strcmp(argv[0], "tcpip") && argc > 1) {
|
if (argc != 2) return syntax_error("tcpip requires an argument");
|
||||||
return adb_connect_command(android::base::StringPrintf("tcpip:%s", argv[1]));
|
int port;
|
||||||
|
if (!android::base::ParseInt(argv[1], &port, 1, 65535)) {
|
||||||
|
return syntax_error("tcpip: invalid port: %s", argv[1]);
|
||||||
|
}
|
||||||
|
return adb_connect_command(android::base::StringPrintf("tcpip:%d", port));
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[0], "remount") ||
|
else if (!strcmp(argv[0], "remount") ||
|
||||||
!strcmp(argv[0], "reboot") ||
|
!strcmp(argv[0], "reboot") ||
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ class NonApiTest(unittest.TestCase):
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
out, _ = p.communicate()
|
out, _ = p.communicate()
|
||||||
self.assertEqual(1, p.returncode)
|
self.assertEqual(1, p.returncode)
|
||||||
self.assertIn('help message', out)
|
self.assertIn('requires an argument', out)
|
||||||
|
|
||||||
p = subprocess.Popen(['adb', 'tcpip', 'foo'], stdout=subprocess.PIPE,
|
p = subprocess.Popen(['adb', 'tcpip', 'foo'], stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
out, _ = p.communicate()
|
out, _ = p.communicate()
|
||||||
self.assertEqual(1, p.returncode)
|
self.assertEqual(1, p.returncode)
|
||||||
self.assertIn('error', out)
|
self.assertIn('invalid port', out)
|
||||||
|
|
||||||
# Helper method that reads a pipe until it is closed, then sets the event.
|
# Helper method that reads a pipe until it is closed, then sets the event.
|
||||||
def _read_pipe_and_set_event(self, pipe, event):
|
def _read_pipe_and_set_event(self, pipe, event):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue