aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Dobler <dr.volker.dobler@gmail.com>2016-02-09 14:39:52 +0100
committerRuss Cox <rsc@golang.org>2016-02-10 14:42:30 +0000
commit811b785193e04c630f26f1cff83d276a572e150d (patch)
tree998572181f21d2e3064e2b0730fe74d2d697ccc0
parent79d9f48c73124eb21db99efa4b97cee044f52700 (diff)
downloadgo-811b785193e04c630f26f1cff83d276a572e150d.tar.gz
go-811b785193e04c630f26f1cff83d276a572e150d.zip
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 <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r--src/net/net_windows_test.go12
1 files 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 = ""