From 08357012247db5c84002b7a4c1693411a1a9b295 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Thu, 27 Apr 2023 13:37:48 +0900 Subject: [PATCH] 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 Reviewed-by: Johan Brandhorst-Satzkorn Reviewed-by: Dmitri Shuralyov Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor Run-TryBot: Johan Brandhorst-Satzkorn --- src/os/os_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/os_test.go b/src/os/os_test.go index 55651d8ace4..a0d9411b6ec 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -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.