From 9edb94fb6b1972554393d037d3a72fa8619adc27 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 19 Mar 2018 18:18:21 -0700 Subject: [PATCH] adb: skip IPv6 test if IPv6 isn't available. Bug: http://b/69813298 Test: none Change-Id: I0793e793bd52c5f1c639faedf09a513df263db78 (cherry picked from commit 4abb5074bebe7e001ff4a8373718b3ce7fcfdc61) --- adb/test_adb.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/adb/test_adb.py b/adb/test_adb.py index 98c8a5922..e7711062c 100644 --- a/adb/test_adb.py +++ b/adb/test_adb.py @@ -217,8 +217,12 @@ class NonApiTest(unittest.TestCase): ipv4.listen(1) ipv6 = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) - ipv6.bind(('::1', ipv4.getsockname()[1] + 1)) - ipv6.listen(1) + try: + ipv6.bind(('::1', ipv4.getsockname()[1] + 1)) + ipv6.listen(1) + except socket.error: + print("IPv6 not available, skipping") + return for s in (ipv4, ipv6): port = s.getsockname()[1]