]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix Root tests on Plan9
authorDamien Neil <dneil@google.com>
Thu, 21 Nov 2024 16:43:23 +0000 (08:43 -0800)
committerDamien Neil <dneil@google.com>
Thu, 21 Nov 2024 21:54:35 +0000 (21:54 +0000)
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>

src/os/root_test.go

index 288b4060cd8e404342880e2558fb19fcd67ec233..95c30606f12a17e76a8744c4254e5bbef4fdaa2d 100644 (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)
                        }
                }