Skip to content

Commit 0559504

Browse files
ydnardeadprogram
authored andcommitted
all: change references of 'wasi' to 'wasip1'; test hygiene
1 parent cfcc894 commit 0559504

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

builder/builder_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestClangAttributes(t *testing.T) {
3333
"k210",
3434
"nintendoswitch",
3535
"riscv-qemu",
36-
"wasi",
36+
"wasip1",
3737
"wasm",
3838
"wasm-unknown",
3939
}

corpus_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func TestCorpus(t *testing.T) {
5151
if *testTarget != "" {
5252
target = *testTarget
5353
}
54+
isWASI := strings.HasPrefix(target, "wasi")
5455

5556
repos, err := loadRepos(*corpus)
5657
if err != nil {
@@ -69,7 +70,7 @@ func TestCorpus(t *testing.T) {
6970
t.Run(name, func(t *testing.T) {
7071
t.Parallel()
7172

72-
if target == "wasi" && repo.SkipWASI {
73+
if isWASI && repo.SkipWASI {
7374
t.Skip("skip wasi")
7475
}
7576
if repo.Slow && testing.Short() {
@@ -135,7 +136,7 @@ func TestCorpus(t *testing.T) {
135136
t.Run(dir.Pkg, func(t *testing.T) {
136137
t.Parallel()
137138

138-
if target == "wasi" && dir.SkipWASI {
139+
if isWASI && dir.SkipWASI {
139140
t.Skip("skip wasi")
140141
}
141142
if dir.Slow && testing.Short() {

main_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestBuild(t *testing.T) {
179179
})
180180
t.Run("WASI", func(t *testing.T) {
181181
t.Parallel()
182-
runPlatTests(optionsFromTarget("wasi", sema), tests, t)
182+
runPlatTests(optionsFromTarget("wasip1", sema), tests, t)
183183
})
184184
}
185185
}
@@ -192,7 +192,10 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
192192
t.Fatal("failed to load target spec:", err)
193193
}
194194

195-
isWebAssembly := options.Target == "wasi" || options.Target == "wasm" || (options.Target == "" && options.GOARCH == "wasm")
195+
// FIXME: this should really be:
196+
// isWebAssembly := strings.HasPrefix(spec.Triple, "wasm")
197+
isWASI := strings.HasPrefix(options.Target, "wasi")
198+
isWebAssembly := isWASI || strings.HasPrefix(options.Target, "wasm") || (options.Target == "" && strings.HasPrefix(options.GOARCH, "wasm"))
196199

197200
for _, name := range tests {
198201
if options.GOOS == "linux" && (options.GOARCH == "arm" || options.GOARCH == "386") {
@@ -252,13 +255,13 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
252255
runTest("alias.go", options, t, nil, nil)
253256
})
254257
}
255-
if options.Target == "" || options.Target == "wasi" {
258+
if options.Target == "" || isWASI {
256259
t.Run("filesystem.go", func(t *testing.T) {
257260
t.Parallel()
258261
runTest("filesystem.go", options, t, nil, nil)
259262
})
260263
}
261-
if options.Target == "" || options.Target == "wasi" || options.Target == "wasm" {
264+
if options.Target == "" || options.Target == "wasm" || isWASI {
262265
t.Run("rand.go", func(t *testing.T) {
263266
t.Parallel()
264267
runTest("rand.go", options, t, nil, nil)
@@ -492,7 +495,7 @@ func TestTest(t *testing.T) {
492495

493496
// Node/Wasmtime
494497
targ{"WASM", optionsFromTarget("wasm", sema)},
495-
targ{"WASI", optionsFromTarget("wasi", sema)},
498+
targ{"WASI", optionsFromTarget("wasip1", sema)},
496499
)
497500
}
498501
for _, targ := range targs {

0 commit comments

Comments
 (0)