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 <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Damien Neil 2024-11-21 08:43:23 -08:00
parent 5a22174eee
commit 0c6dbd99c5
1 changed files with 8 additions and 2 deletions

View File

@ -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)
}
}