From 0c6dbd99c570874ef5ec353298708677c1675dd0 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 21 Nov 2024 08:43:23 -0800 Subject: [PATCH] os: fix Root tests on Plan9 Fixes #70484 Change-Id: I609834aca3e97bf494565da513cd2b8a83123c89 Reviewed-on: https://go-review.googlesource.com/c/go/+/630216 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI --- src/os/root_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/os/root_test.go b/src/os/root_test.go index 288b4060cd..95c30606f1 100644 --- a/src/os/root_test.go +++ b/src/os/root_test.go @@ -810,6 +810,10 @@ func (test rootConsistencyTest) run(t *testing.T, f func(t *testing.T, path stri if f := test.detailedErrorMismatch; f != nil { detailedErrorMismatch = f(t) } + if runtime.GOOS == "plan9" { + // Plan9 syscall errors aren't comparable. + detailedErrorMismatch = true + } if !detailedErrorMismatch && e1.Err != e2.Err { t.Errorf("with root: err=%v", e1.Err) t.Errorf("without root: err=%v", e2.Err) @@ -1143,9 +1147,11 @@ func TestRootRaceRenameDir(t *testing.T) { // and then rename a directory near the root. time.Sleep(avg / 4) if err := os.Rename(dir+"/base/a", dir+"/b"); err != nil { - // Windows won't let us rename a directory if we have + // Windows and Plan9 won't let us rename a directory if we have // an open handle for it, so an error here is expected. - if runtime.GOOS != "windows" { + switch runtime.GOOS { + case "windows", "plan9": + default: t.Fatal(err) } } -- 2.48.1