Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7096d478 authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Merge "Fix adb tcpip tests." am: d865b655

am: 37f25642

Change-Id: I6f212225b8fe88235d4803b1129b66f5d650d1e4
parents 5982a46c 37f25642
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1588,9 +1588,13 @@ int adb_commandline(int argc, const char** argv) {
        } else {
            return 0;
        }
    } else if (!strcmp(argv[0], "tcpip")) {
        if (argc != 2) return syntax_error("tcpip requires an argument");
        int port;
        if (!android::base::ParseInt(argv[1], &port, 1, 65535)) {
            return syntax_error("tcpip: invalid port: %s", argv[1]);
        }
    else if (!strcmp(argv[0], "tcpip") && argc > 1) {
        return adb_connect_command(android::base::StringPrintf("tcpip:%s", argv[1]));
        return adb_connect_command(android::base::StringPrintf("tcpip:%d", port));
    }
    else if (!strcmp(argv[0], "remount") ||
             !strcmp(argv[0], "reboot") ||
+2 −2
Original line number Diff line number Diff line
@@ -60,13 +60,13 @@ class NonApiTest(unittest.TestCase):
                             stderr=subprocess.STDOUT)
        out, _ = p.communicate()
        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,
                             stderr=subprocess.STDOUT)
        out, _ = p.communicate()
        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.
    def _read_pipe_and_set_event(self, pipe, event):