• Tim Ebringer's avatar
    net: improve netsh usage in Windows unit tests · 489f65b5
    Tim Ebringer authored
    The TestInterfaceAddrsWithNetsh Windows unit test parses and compares the
    output of the "netsh" command against more low level Windows API calls. In
    at least two cases, some quirks of netsh cause these comparisons to fail.
    
    One example appears to be wi-fi adapters. After a reboot, before it has
    been allowed to connect to a network, netsh for IPv4 will not show an
    address, whereas netsh for IPv6 will. If the interface is allowed to
    connect, and then disconnected, netsh for IPv4 now shows an address and
    the test will pass.
    
    The fix is to not compare netsh output if the interface is down.
    
    A related issue is that the IPv6 version of "netsh" can return an
    IPv4-embedded IPv6 address where the IPv4 component of the address
    is in decimal form, whilst the test is expecting hexadecimal form.
    
    For example, output might be:
    
      Address fe80::5efe:192.168.1.7%6 Parameters
        ...
    
    Whilst this is valid notation, the fix is to recognise this format in the
    "netsh" output and re-parse the address into the all-hexadecimal
    representation that the test is expecting.
    
    Fixes #13981
    
    Change-Id: Ie8366673f4d43d07bad80d6d5d1d6e33f654b6cc
    Reviewed-on: https://go-review.googlesource.com/18711Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
    Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    489f65b5
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
vendor Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...