]> Cypherpunks repositories - gostls13.git/commitdiff
internal/syscall/windows/registry: fix strict assumptions in TestWalkFullRegistry
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 22 Oct 2019 20:39:30 +0000 (22:39 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 23 Oct 2019 03:08:00 +0000 (03:08 +0000)
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>
src/internal/syscall/windows/registry/registry_test.go

index c77329cb1e4036b65bbd9a15636da63dc6c90466..9c75e57889544846ae4c2340f7effc39a3e844a7 100644 (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)
                }
        }