From 811b785193e04c630f26f1cff83d276a572e150d Mon Sep 17 00:00:00 2001 From: Volker Dobler Date: Tue, 9 Feb 2016 14:39:52 +0100 Subject: [PATCH] net: make getmac based tests on windows more robust The Windows 7 getmac command may report the physical address of an adapter as "Disabled" or "N/A". Handle these two cases to make the tests more robust when building on Windows with manually disabled adapters or turned off hardware. Addresses issue #14130. Change-Id: I0c2f8554b4b6810568e4e60ed53857599401f296 Reviewed-on: https://go-review.googlesource.com/19411 Reviewed-by: Alex Brainman Run-TryBot: Alex Brainman TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- src/net/net_windows_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/net/net_windows_test.go b/src/net/net_windows_test.go index 095a339e02..c26c6a77c9 100644 --- a/src/net/net_windows_test.go +++ b/src/net/net_windows_test.go @@ -487,8 +487,13 @@ func TestInterfaceHardwareAddrWithGetmac(t *testing.T) { // //Connection Name: Bluetooth Network Connection //Network Adapter: Bluetooth Device (Personal Area Network) - //Physical Address: XX-XX-XX-XX-XX-XX - //Transport Name: Media disconnected + //Physical Address: N/A + //Transport Name: Hardware not present + // + //Connection Name: VMware Network Adapter VMnet8 + //Network Adapter: VMware Virtual Ethernet Adapter for VMnet8 + //Physical Address: Disabled + //Transport Name: Disconnected // want := make(map[string]string) var name string @@ -516,6 +521,9 @@ func TestInterfaceHardwareAddrWithGetmac(t *testing.T) { if addr == "" { t.Fatal("empty address on \"Physical Address\" line: %q", line) } + if addr == "disabled" || addr == "n/a" { + continue + } addr = strings.Replace(addr, "-", ":", -1) want[name] = addr name = "" -- 2.48.1