aboutsummaryrefslogtreecommitdiff
path: root/test_adb.py
diff options
context:
space:
mode:
authorJoshua Duong <joshuaduong@google.com>2020-03-31 10:58:50 -0700
committerJoshua Duong <joshuaduong@google.com>2020-04-22 08:43:15 -0700
commite22e161db4a5939e5c1f68b7d74e520a0b555fd8 (patch)
treea5d8cd20fa596c6d84440807aac4864949ea1f80 /test_adb.py
parentd7c49ec22c25b9b53929510f430befe7cac62217 (diff)
downloadadb-e22e161db4a5939e5c1f68b7d74e520a0b555fd8.tar.gz
[adb client] Add "adb mdns check" command.
This command will check if the mdns daemon is available on the host machine. Bug: 152510294 Test: pkill -9 mdnsd; adb mdns check; mdnsd; adb mdns check; Test: test_adb.py Change-Id: If644678a339763817a8a7adcbdc545626d161aba
Diffstat (limited to 'test_adb.py')
-rwxr-xr-xtest_adb.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test_adb.py b/test_adb.py
index c872fb0f..6989e3ba 100755
--- a/test_adb.py
+++ b/test_adb.py
@@ -576,6 +576,17 @@ class PowerTest(unittest.TestCase):
# If the power event was detected, the adb shell command should be broken very quickly.
self.assertLess(end - start, 2)
+"""Use 'adb mdns check' to see if mdns discovery is available."""
+def is_adb_mdns_available():
+ with adb_server() as server_port:
+ output = subprocess.check_output(["adb", "-P", str(server_port),
+ "mdns", "check"]).strip()
+ return output.startswith(b"mdns daemon version")
+
+@unittest.skipIf(not is_adb_mdns_available(), "mdns feature not available")
+class MdnsTest(unittest.TestCase):
+ """Tests for adb mdns."""
+ pass
def main():
"""Main entrypoint."""