Skip to content

Commit 17569c0

Browse files
authored
Landonxjames/wasm tests (#4477)
2 parents 80ea5b9 + fc9971b commit 17569c0

File tree

20 files changed

+449
-263
lines changed

20 files changed

+449
-263
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
[build]
2-
target = ["wasm32-unknown-unknown", "wasm32-wasip1"]
2+
target = ["wasm32-unknown-unknown", "wasm32-wasip2"]
33

4-
[target.wasm32-wasi]
5-
rustflags = ["-C", "opt-level=1"]
4+
[target.wasm32-wasip2]
65
runner = [
76
"wasmtime",
87
"-C", "cache=n",
98
"-S", "preview2=y",
109
"-S", "http=y"
1110
]
1211

13-
# Requires for getrandom crate to compile
14-
# https://docs.rs/getrandom/0.3.3/getrandom/#webassembly-support
12+
1513
[target.wasm32-unknown-unknown]
14+
# Required for getrandom crate to compile
15+
# https://docs.rs/getrandom/0.3.3/getrandom/#webassembly-support
1616
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
17+
runner = [
18+
"./run-wasm32-unknown-unknown.sh",
19+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"rust-analyzer.cargo.target": "wasm32-wasip1"
2+
"rust-analyzer.cargo.target": "wasm32-wasip2"
33
}

aws/sdk/integration-tests/webassembly/Cargo.toml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,27 @@ license = "Apache-2.0"
1414
repository = "https://github.com/smithy-lang/smithy-rs"
1515
publish = false
1616

17-
18-
[features]
19-
default = ["test-util"]
20-
test-util = []
21-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
22-
2317
[target.'cfg(target_family = "wasm")'.dependencies]
2418
aws-config = { path = "../../build/aws-sdk/sdk/aws-config", default-features = false, features = [
2519
"rt-tokio",
2620
"behavior-version-latest"
2721
] }
2822
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["hardcoded-credentials"] }
2923
aws-sdk-s3 = { path = "../../build/aws-sdk/sdk/s3", default-features = false }
24+
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", default-features = false, features = ["test-util", "rt-tokio"] }
3025
aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" }
26+
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", default-features = false, features = ["test-util"] }
3127
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client"] }
3228
aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client"] }
3329
aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" }
3430
aws-smithy-wasm = { path = "../../build/aws-sdk/sdk/aws-smithy-wasm" }
35-
http = "0.2.9"
31+
http-1x = { package = "http", version = "1" }
3632
tokio = { version = "1.32.0", features = ["macros", "rt"] }
3733
# getrandom is a transitive dependency, but requires the wasm_js feature to compile for wasm
3834
# also requires a compiler flag which is set in .cargo/config.toml
3935
# https://docs.rs/getrandom/0.3.3/getrandom/#webassembly-support
4036
getrandom = {version="0.3.3", features = ["wasm_js"]}
4137

42-
[target.'cfg(all(target_family = "wasm", target_env = "p1"))'.dependencies]
43-
wit-bindgen = { version = "0.16.0", features = ["macros", "realloc"] }
44-
4538
[lib]
4639
crate-type = ["cdylib"]
4740

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
#
3+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
wasmtime --invoke main -D logging=y -D debug-info=y -D address-map=y "$@" 0 0

aws/sdk/integration-tests/webassembly/src/http_client.rs

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

aws/sdk/integration-tests/webassembly/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
#![allow(dead_code)]
6+
#![cfg(target_family = "wasm")]
77

8-
#[cfg(target_family = "wasm")]
9-
mod http_client;
10-
#[cfg(all(target_family = "wasm", target_env = "p1"))]
11-
mod wasi;
8+
// Note the tests here are not gated since they should pass successfully in both
9+
// wasm32-unknown-unknown and wasm32-wasip2
10+
mod wasm32_unknown_unknown;
11+
12+
#[cfg(all(target_arch = "wasm32", target_env = "p2"))]
13+
mod wasm32_wasip2;

aws/sdk/integration-tests/webassembly/src/wasi.rs

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

0 commit comments

Comments
 (0)