Skip to content

Commit 1c13fba

Browse files
committed
Merge the wasi-tls crates into a single one with feature flags
prtest:full
1 parent cf13898 commit 1c13fba

17 files changed

Lines changed: 149 additions & 257 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,13 @@ jobs:
425425
-p wasmtime-wasi --no-default-features --features p2
426426
-p wasmtime-wasi --no-default-features --features p3
427427
428+
- name: wasmtime-wasi-tls
429+
checks: |
430+
-p wasmtime-wasi-tls --no-default-features
431+
-p wasmtime-wasi-tls --no-default-features --features rustls
432+
-p wasmtime-wasi-tls --no-default-features --features nativetls
433+
-p wasmtime-wasi-tls --no-default-features --features openssl
434+
428435
- name: wasmtime-wizer
429436
checks: |
430437
-p wasmtime-wizer --no-default-features
@@ -942,17 +949,17 @@ jobs:
942949
# Run the tests!
943950
- run: cargo test -p wasmtime-wasi-nn --features ${{ matrix.feature }}
944951

945-
# Test `wasmtime-wasi-tls-nativetls` & `wasmtime-wasi-tls-openssl` in their
946-
# own job. This is because they depends on OpenSSL, which is not easily
947-
# available on all platforms.
952+
# Test `wasmtime-wasi-tls` in its own job, as not all of its providers are
953+
# compatible with all targets. The primary culprit is the OpenSSL dependency,
954+
# which is not easily available on all platforms.
948955
#
949956
# The Windows base image has OpenSSL installed by default, but not in a way
950957
# that is automatically discoverable by `openssl-sys`. We need to configure
951958
# the OPENSSL_DIR & OPENSSL_LIB_DIR paths manually.
952959
# Additionally, the GH actions Windows image does not ship with a CA cert
953960
# bundle, so we use the one from cUrl.
954961
test_wasi_tls:
955-
name: Test wasi-tls using native-tls & openssl providers
962+
name: Test wasi-tls
956963
needs: determine
957964
if: needs.determine.outputs.run-full
958965
runs-on: ${{ matrix.os }}
@@ -976,8 +983,7 @@ jobs:
976983
"SSL_CERT_FILE=$sslCertFile" | Out-File -FilePath $env:GITHUB_ENV -Append
977984
"OPENSSL_DIR=$opensslDir" | Out-File -FilePath $env:GITHUB_ENV -Append
978985
"OPENSSL_LIB_DIR=$opensslLibDir" | Out-File -FilePath $env:GITHUB_ENV -Append
979-
- run: cargo test -p wasmtime-wasi-tls-openssl
980-
- run: cargo test -p wasmtime-wasi-tls-nativetls
986+
- run: cargo test -p wasmtime-wasi-tls --all-features
981987

982988
# Test the `wasmtime-fuzzing` crate. Split out from the main tests because
983989
# `--all-features` brings in OCaml, which is a pain to get setup for all

Cargo.lock

Lines changed: 5 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ members = [
165165
"crates/test-programs",
166166
"crates/wasi-preview1-component-adapter",
167167
"crates/wasi-preview1-component-adapter/verify",
168-
"crates/wasi-tls-nativetls",
169-
"crates/wasi-tls-openssl",
170168
"crates/debugger",
171169
"crates/wizer/fuzz",
172170
"crates/wizer/tests/regex-test",
@@ -253,8 +251,6 @@ wasmtime-wasi-config = { path = "crates/wasi-config", version = "44.0.0" }
253251
wasmtime-wasi-keyvalue = { path = "crates/wasi-keyvalue", version = "44.0.0" }
254252
wasmtime-wasi-threads = { path = "crates/wasi-threads", version = "44.0.0" }
255253
wasmtime-wasi-tls = { path = "crates/wasi-tls", version = "44.0.0" }
256-
wasmtime-wasi-tls-nativetls = { path = "crates/wasi-tls-nativetls", version = "44.0.0" }
257-
wasmtime-wasi-tls-openssl = { path = "crates/wasi-tls-openssl", version = "44.0.0" }
258254
wasmtime-wast = { path = "crates/wast", version = "=44.0.0" }
259255

260256
# Internal Wasmtime-specific crates.

ci/run-tests.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
# - wasmtime-wasi-nn: mutually-exclusive features that aren't available for all
88
# targets, needs its own CI job.
99
#
10-
# - wasmtime-wasi-tls-nativetls: the openssl dependency does not play nice with
11-
# cross compilation. This crate is tested in a separate CI job.
12-
#
13-
# - wasmtime-wasi-tls-openssl: the openssl dependency does not play nice with
10+
# - wasmtime-wasi-tls: the openssl dependency does not play nice with
1411
# cross compilation. This crate is tested in a separate CI job.
1512
#
1613
# - wasmtime-fuzzing: enabling all features brings in OCaml which is a pain to
@@ -29,8 +26,7 @@
2926
args = ['cargo', 'test', '--workspace', '--all-features']
3027
args.append('--exclude=test-programs')
3128
args.append('--exclude=wasmtime-wasi-nn')
32-
args.append('--exclude=wasmtime-wasi-tls-nativetls')
33-
args.append('--exclude=wasmtime-wasi-tls-openssl')
29+
args.append('--exclude=wasmtime-wasi-tls')
3430
args.append('--exclude=wasmtime-fuzzing')
3531
args.append('--exclude=wasm-spec-interpreter')
3632
args.append('--exclude=veri_engine')

crates/wasi-tls-nativetls/Cargo.toml

Lines changed: 0 additions & 25 deletions
This file was deleted.

crates/wasi-tls-nativetls/tests/main.rs

Lines changed: 0 additions & 68 deletions
This file was deleted.

crates/wasi-tls-openssl/Cargo.toml

Lines changed: 0 additions & 25 deletions
This file was deleted.

crates/wasi-tls-openssl/tests/main.rs

Lines changed: 0 additions & 68 deletions
This file was deleted.

crates/wasi-tls/Cargo.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ description = "Wasmtime implementation of the wasi-tls API"
1111
[lints]
1212
workspace = true
1313

14+
[features]
15+
default = ["rustls"]
16+
rustls = ["dep:rustls", "dep:tokio-rustls", "dep:webpki-roots"]
17+
nativetls = ["dep:native-tls", "dep:tokio-native-tls"]
18+
openssl = ["dep:openssl", "dep:tokio-openssl"]
19+
1420
[dependencies]
1521
bytes = { workspace = true }
1622
tokio = { workspace = true, features = [
@@ -21,10 +27,14 @@ tokio = { workspace = true, features = [
2127
] }
2228
wasmtime = { workspace = true, features = ["runtime", "component-model"] }
2329
wasmtime-wasi = { workspace = true }
24-
25-
tokio-rustls = { workspace = true }
26-
rustls = { workspace = true }
27-
webpki-roots = { workspace = true }
30+
cfg-if = { workspace = true }
31+
tokio-rustls = { workspace = true, optional = true }
32+
rustls = { workspace = true, optional = true }
33+
webpki-roots = { workspace = true, optional = true }
34+
tokio-native-tls = { workspace = true, optional = true }
35+
native-tls = { workspace = true, optional = true }
36+
tokio-openssl = { workspace = true, optional = true }
37+
openssl = { workspace = true, optional = true }
2838

2939
[dev-dependencies]
3040
test-programs-artifacts = { workspace = true }

0 commit comments

Comments
 (0)