]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix TestChdirAndGetwd/ReaddirnamesOneAtATime on wasip1 to run on Windows hosts
authorTakeshi Yoneda <t.y.mathetake@gmail.com>
Thu, 27 Apr 2023 04:37:48 +0000 (13:37 +0900)
committerGopher Robot <gobot@golang.org>
Fri, 28 Apr 2023 17:26:10 +0000 (17:26 +0000)
TestReaddirnamesOneAtATime and TestChdirAndGetwd assumes the underlying file system
has /usr/bin but it is not the case when running it on WASI runtime hosted on Windows.

This change adds wasip1 in the special cased switch case to make them host OS agonstic.

Change-Id: Idb667021b565f939c814b9cd9e637cd75f9a610d
Reviewed-on: https://go-review.googlesource.com/c/go/+/489575
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

src/os/os_test.go

index 55651d8ace470087fc85b3bc10601e0aa0dd5310..a0d9411b6ec4ab3aa1bd359dbb59b82a20c4c00e 100644 (file)
@@ -633,7 +633,7 @@ func TestReaddirnamesOneAtATime(t *testing.T) {
        switch runtime.GOOS {
        case "android":
                dir = "/system/bin"
-       case "ios":
+       case "ios", "wasip1":
                wd, err := Getwd()
                if err != nil {
                        t.Fatal(err)
@@ -1490,7 +1490,7 @@ func TestChdirAndGetwd(t *testing.T) {
                dirs = []string{"/system/bin"}
        case "plan9":
                dirs = []string{"/", "/usr"}
-       case "ios", "windows":
+       case "ios", "windows", "wasip1":
                dirs = nil
                for _, dir := range []string{t.TempDir(), t.TempDir()} {
                        // Expand symlinks so path equality tests work.