Skip to content

Commit e06e29b

Browse files
millerresearchgopherbot
authored andcommitted
os: allow for variant plan9 error messages in TestOpenError
Different Plan 9 file servers may return different error strings on an attempt to open a directory for writing: EISDIR, EACCES or EPERM. TestOpenError allows for the first two, but it needs to allow for EPERM as well. Fixes #70440 Change-Id: I705cc086e21630ca254499ca922ede78c9901b11 Reviewed-on: https://go-review.googlesource.com/c/go/+/629635 Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Bypass: Dmitri Shuralyov <[email protected]>
1 parent e697783 commit e06e29b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/os/os_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,9 +1840,11 @@ func testOpenError(t *testing.T, dir string, rooted bool) {
18401840
expectedErrStr := strings.Replace(tt.error.Error(), "file ", "", 1)
18411841
if !strings.HasSuffix(syscallErrStr, expectedErrStr) {
18421842
// Some Plan 9 file servers incorrectly return
1843-
// EACCES rather than EISDIR when a directory is
1843+
// EPERM or EACCES rather than EISDIR when a directory is
18441844
// opened for write.
1845-
if tt.error == syscall.EISDIR && strings.HasSuffix(syscallErrStr, syscall.EACCES.Error()) {
1845+
if tt.error == syscall.EISDIR &&
1846+
(strings.HasSuffix(syscallErrStr, syscall.EPERM.Error()) ||
1847+
strings.HasSuffix(syscallErrStr, syscall.EACCES.Error())) {
18461848
continue
18471849
}
18481850
t.Errorf("%v = _, %q; want suffix %q", name, syscallErrStr, expectedErrStr)

0 commit comments

Comments
 (0)