aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Reddig <[email protected]>2024-03-05 09:19:31 -0800
committerRon Evans <[email protected]>2024-03-27 16:01:40 +0100
commit055950421aa563c0b03e9904ce68785ec597133b (patch)
treedf76a4537fa348c75c74faf22be478a47c86b922
parentcfcc894855b517b2c0788ea1a423c4ed9b3c8a69 (diff)
downloadtinygo-055950421aa563c0b03e9904ce68785ec597133b.tar.gz
tinygo-055950421aa563c0b03e9904ce68785ec597133b.zip
all: change references of 'wasi' to 'wasip1'; test hygiene
-rw-r--r--builder/builder_test.go2
-rw-r--r--corpus_test.go5
-rw-r--r--main_test.go13
3 files changed, 12 insertions, 8 deletions
diff --git a/builder/builder_test.go b/builder/builder_test.go
index 0ed632da3..3bb3e9841 100644
--- a/builder/builder_test.go
+++ b/builder/builder_test.go
@@ -33,7 +33,7 @@ func TestClangAttributes(t *testing.T) {
"k210",
"nintendoswitch",
"riscv-qemu",
- "wasi",
+ "wasip1",
"wasm",
"wasm-unknown",
}
diff --git a/corpus_test.go b/corpus_test.go
index 1b27d6f6b..f17a9b9f5 100644
--- a/corpus_test.go
+++ b/corpus_test.go
@@ -51,6 +51,7 @@ func TestCorpus(t *testing.T) {
if *testTarget != "" {
target = *testTarget
}
+ isWASI := strings.HasPrefix(target, "wasi")
repos, err := loadRepos(*corpus)
if err != nil {
@@ -69,7 +70,7 @@ func TestCorpus(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()
- if target == "wasi" && repo.SkipWASI {
+ if isWASI && repo.SkipWASI {
t.Skip("skip wasi")
}
if repo.Slow && testing.Short() {
@@ -135,7 +136,7 @@ func TestCorpus(t *testing.T) {
t.Run(dir.Pkg, func(t *testing.T) {
t.Parallel()
- if target == "wasi" && dir.SkipWASI {
+ if isWASI && dir.SkipWASI {
t.Skip("skip wasi")
}
if dir.Slow && testing.Short() {
diff --git a/main_test.go b/main_test.go
index 9c28eb86d..0f0d52f4d 100644
--- a/main_test.go
+++ b/main_test.go
@@ -179,7 +179,7 @@ func TestBuild(t *testing.T) {
})
t.Run("WASI", func(t *testing.T) {
t.Parallel()
- runPlatTests(optionsFromTarget("wasi", sema), tests, t)
+ runPlatTests(optionsFromTarget("wasip1", sema), tests, t)
})
}
}
@@ -192,7 +192,10 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
t.Fatal("failed to load target spec:", err)
}
- isWebAssembly := options.Target == "wasi" || options.Target == "wasm" || (options.Target == "" && options.GOARCH == "wasm")
+ // FIXME: this should really be:
+ // isWebAssembly := strings.HasPrefix(spec.Triple, "wasm")
+ isWASI := strings.HasPrefix(options.Target, "wasi")
+ isWebAssembly := isWASI || strings.HasPrefix(options.Target, "wasm") || (options.Target == "" && strings.HasPrefix(options.GOARCH, "wasm"))
for _, name := range tests {
if options.GOOS == "linux" && (options.GOARCH == "arm" || options.GOARCH == "386") {
@@ -252,13 +255,13 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
runTest("alias.go", options, t, nil, nil)
})
}
- if options.Target == "" || options.Target == "wasi" {
+ if options.Target == "" || isWASI {
t.Run("filesystem.go", func(t *testing.T) {
t.Parallel()
runTest("filesystem.go", options, t, nil, nil)
})
}
- if options.Target == "" || options.Target == "wasi" || options.Target == "wasm" {
+ if options.Target == "" || options.Target == "wasm" || isWASI {
t.Run("rand.go", func(t *testing.T) {
t.Parallel()
runTest("rand.go", options, t, nil, nil)
@@ -492,7 +495,7 @@ func TestTest(t *testing.T) {
// Node/Wasmtime
targ{"WASM", optionsFromTarget("wasm", sema)},
- targ{"WASI", optionsFromTarget("wasi", sema)},
+ targ{"WASI", optionsFromTarget("wasip1", sema)},
)
}
for _, targ := range targs {