1
0
mirror of https://github.com/golang/go synced 2024-11-18 00:04:43 -07:00

internal/syscall/windows/registry: fix strict assumptions in TestWalkFullRegistry

It turns out that Windows has "legitimate" keys that have bogus type
values or bogus lengths that don't correspond with their type. On up to
date Windows 10 systems, this test always fails for this reason.

So, this commit alters the test to simply log the discrepancy and move
on.

Fixes #35084

Change-Id: I56e12cc62aff49cfcc38ff01a19dfe53153976a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/202678
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Jason A. Donenfeld 2019-10-22 22:39:30 +02:00 committed by Brad Fitzpatrick
parent dded58760d
commit 0195a29399

View File

@ -551,7 +551,9 @@ func walkKey(t *testing.T, k registry.Key, kname string) {
case registry.DWORD, registry.QWORD:
_, _, err := k.GetIntegerValue(name)
if err != nil {
t.Error(err)
// Sometimes legitimate keys have the wrong sizes, which don't correspond with
// their required size, due to Windows bugs.
t.Logf("warning: GetIntegerValue for type %d of %s of %s failed: %v", valtype, name, kname, err)
}
case registry.BINARY:
_, _, err := k.GetBinaryValue(name)
@ -566,7 +568,8 @@ func walkKey(t *testing.T, k registry.Key, kname string) {
case registry.FULL_RESOURCE_DESCRIPTOR, registry.RESOURCE_LIST, registry.RESOURCE_REQUIREMENTS_LIST:
// TODO: not implemented
default:
t.Fatalf("value type %d of %s of %s failed: %v", valtype, name, kname, err)
// Sometimes legitimate keys have the wrong value type, due to Windows bugs.
t.Logf("warning: value type %d of %s of %s failed: %v", valtype, name, kname, err)
}
}