Skip to content

Commit c5f0e2b

Browse files
committed
test(loader): cover WASI preview 2 TLS selection
1 parent 703d593 commit c5f0e2b

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

loader/goroot.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,8 @@ func needsSyscallPackage(buildTags []string) bool {
225225
return false
226226
}
227227

228-
// needsTLSStubPackage returns whether the crypto/tls package should be
229-
// overridden with the TinyGo stub version, whose handshake is a no-op. A target
230-
// with no OS below it has neither the code size for a full TLS implementation
231-
// nor usually a socket to speak it over.
232-
//
233-
// Hosted linux and macOS have both, so they use the real crypto/tls of the Go
234-
// standard library. GOOS alone cannot decide this, because a baremetal target
235-
// reports GOOS=linux, so the build tags decide as well.
228+
// Keep the netdev TLS wrapper except on hosted Linux and Darwin.
229+
// The baremetal tag is needed because those targets also report GOOS=linux.
236230
func needsTLSStubPackage(goos string, buildTags []string) bool {
237231
if goos != "linux" && goos != "darwin" {
238232
return true

loader/goroot_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ func TestNeedsTLSStubPackage(t *testing.T) {
1313
{"hosted darwin", "darwin", []string{"darwin", "arm64"}, false},
1414
{"windows", "windows", []string{"windows", "amd64"}, true},
1515
{"wasip1", "wasip1", []string{"wasip1", "tinygo.wasm"}, true},
16+
{"wasip2", "wasip2", []string{"wasip2", "tinygo.wasm"}, true},
1617
// A baremetal target reports GOOS=linux, so the build tags have to
1718
// keep the stub for it.
1819
{"baremetal", "linux", []string{"linux", "arm", "baremetal"}, true},

0 commit comments

Comments
 (0)