Skip to content

Commit

Permalink
windows: make TestSystemModuleVersions more tolerant
Browse files Browse the repository at this point in the history
One file can't be read on LUCI's Windows image:

    syscall_windows_test.go:892: CimFS.SYS: The specified resource type cannot be found in the image file.

That doesn't seem like a good enough reason to fail the test. Skip the
file if this error is encountered.

Change-Id: Id9a65b3ff748bbf7ef7fac37d3741c16e001a4b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/505220
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
  • Loading branch information
heschi authored and gopherbot committed Jun 27, 2023
1 parent d1abdad commit 0a92922
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions windows/syscall_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,22 +888,21 @@ func TestSystemModuleVersions(t *testing.T) {
var zero windows.Handle
infoSize, err := windows.GetFileVersionInfoSize(driverPath, &zero)
if err != nil {
if err != windows.ERROR_FILE_NOT_FOUND {
t.Error(err)
if err != windows.ERROR_FILE_NOT_FOUND && err != windows.ERROR_RESOURCE_TYPE_NOT_FOUND {
t.Errorf("%v: %v", moduleName, err)
}
continue
}
versionInfo := make([]byte, infoSize)
err = windows.GetFileVersionInfo(driverPath, 0, infoSize, unsafe.Pointer(&versionInfo[0]))
if err != nil && err != windows.ERROR_FILE_NOT_FOUND {
t.Error(err)
if err = windows.GetFileVersionInfo(driverPath, 0, infoSize, unsafe.Pointer(&versionInfo[0])); err != nil {
t.Errorf("%v: %v", moduleName, err)
continue
}
var fixedInfo *windows.VS_FIXEDFILEINFO
fixedInfoLen := uint32(unsafe.Sizeof(*fixedInfo))
err = windows.VerQueryValue(unsafe.Pointer(&versionInfo[0]), `\`, (unsafe.Pointer)(&fixedInfo), &fixedInfoLen)
if err != nil {
t.Error(err)
t.Errorf("%v: %v", moduleName, err)
continue
}
t.Logf("%s: v%d.%d.%d.%d", moduleName,
Expand Down

0 comments on commit 0a92922

Please sign in to comment.