net: TestInterfaceAddrsWithNetsh fail on Windows 7 #14130
Go1.6rc1 on Windows 7, CGO_ENABLE=0:
The underlying cause is that netsh doesn't print anything when queried for this interface:
But all information is output if not asked for this specific interface:
If the adapter is disabled this tests passes but then TestInterfaceHardwareAddrWithGetmac fails:
There might be some problem with this interface on Windows side.
The text was updated successfully, but these errors were encountered:
@alexbrainman Now it is Blootooth... :
$ go test -v -run TestInterfaceHardwareAddrWithGetmac net
@vdobler I am confused now. Your last error messages says:
But regardless of you changed the code. I don't see how TestInterfaceHardwareAddrWithGetmac is at fault here. The test has found "Bluetooth Network Connection" in the output of
to see if it makes TestInterfaceHardwareAddrWithGetmac PASS? If TestInterfaceHardwareAddrWithGetmac is still broken, show us output of
@alexbrainman Thanks for the feedback. And please excuse the confusion I produced, I'll try to be more systematic.
I think the Go code itself is okay and works properly.
But the test code executes
I verified the following on go1.6rc1 and go1.6rc2 with a clean Go source tree and a (halfway freshly booted Windows 7 Enterprise Service Pack 1 with VMware Player 7.1.2 build-2780323 installed).
but the problem is not the Go code as "192.168.209.1/24" is fine as it is the proper address as can be seen by running:
Unfortunately the test code tries to get the address by executing
which returns 0 but prints just one blank line:
This is strange and clearly a Windows-only, maybe even a "my-computer-only" problem.
The test code relies on the fact that
Maybe parsing the whole output of
If I disable (through Control Panel\Network and Internet\Network Connections) "VMware Network Adapter VMnet8" and have the wireless network turned off via the hardware switch then:
If I peek at TestInterfaceHardwareAddrWithGetmac around line 507 there is no code to test for the string "Disabled" or "N/A" as a value for "Physical Address" which explains the failed test.
A simple fix would be (I could prepare a complete CL):
@vdobler thank you for investigation. I agree we have to adjust these tests.
I will try that.
for ipv4, and
Your proposed change looks good to me.
I will write a CL when I have some time. If you want to do it yourself (or even half of it), feel free to do it.
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 <firstname.lastname@example.org> Run-TryBot: Alex Brainman <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Russ Cox <email@example.com>