-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing: retry spurious errors from RemoveAll for temp directories
This works around what appears to be either a kernel bug or a Go runtime or syscall bug affecting certain Windows versions (possibly all pre-2016?). The retry loop is a simplified version of the one used in cmd/go/internal/robustio. We use the same 2-second arbitrary timeout as was used in that package, since it seems to be reliable in practice on the affected builders. (If it proves to be too short, we can lengthen it, within reason, in a followup CL.) Since this puts a higher-level workaround in place, we can also revert the lower-level workaround added to a specific test in CL 345670. This addresses the specific occurrences of the bug for users of (*testing.T).TempDir, but does not fix the underlying bug for Go users outside the "testing" package (which remains open as #25965). Fixes #50051 Updates #48012 Updates #25965 Change-Id: I35be7125f32f05c8350787f5ca9a22974b8d0770 Reviewed-on: https://go-review.googlesource.com/c/go/+/371296 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Patrik Nyblom <pnyb@google.com> Trust: Patrik Nyblom <pnyb@google.com> Run-TryBot: Patrik Nyblom <pnyb@google.com>
- Loading branch information
Bryan C. Mills
committed
Dec 14, 2021
1 parent
265fbaa
commit d407a8c
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build !windows | ||
|
||
package testing | ||
|
||
// isWindowsAccessDenied reports whether err is ERROR_ACCESS_DENIED, | ||
// which is defined only on Windows. | ||
func isWindowsAccessDenied(err error) bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build windows | ||
|
||
package testing | ||
|
||
import ( | ||
"errors" | ||
"syscall" | ||
) | ||
|
||
// isWindowsAccessDenied reports whether err is ERROR_ACCESS_DENIED, | ||
// which is defined only on Windows. | ||
func isWindowsAccessDenied(err error) bool { | ||
return errors.Is(err, syscall.ERROR_ACCESS_DENIED) | ||
} |