1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00

os: fix TestChdirAndGetwd/ReaddirnamesOneAtATime on wasip1 to run on Windows hosts

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>
This commit is contained in:
Takeshi Yoneda 2023-04-27 13:37:48 +09:00 committed by Gopher Robot
parent 972774c444
commit 0835701224

View 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.