Skip to content

Commit 810783f

Browse files
authored
Merge pull request #120 from wingo/first-wasip3-test
First wasip3 test
2 parents cf25f75 + 001c798 commit 810783f

File tree

14 files changed

+2802
-6
lines changed

14 files changed

+2802
-6
lines changed

.github/workflows/compile-tests.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,22 @@ jobs:
4747
- name: Check out repository code
4848
uses: actions/checkout@v3
4949

50-
- name: Install wasm32-wasip1 target for Rust
50+
- name: Install nightly wasm32-wasip2 target for Rust
5151
uses: actions-rust-lang/setup-rust-toolchain@v1
5252
with:
53+
toolchain: nightly
54+
target: wasm32-wasip2
55+
56+
- name: Install stable wasm32-wasip1 target for Rust
57+
uses: actions-rust-lang/setup-rust-toolchain@v1
58+
with:
59+
toolchain: stable
5360
target: wasm32-wasip1
5461

5562
- name: Build tests
5663
working-directory: tests/rust
5764
run: |
58-
./build.py
65+
./build.py --toolchain=wasm32-wasip3:nightly
5966
6067
- name: Upload precompiled tests
6168
if: matrix.os == 'ubuntu-latest'

tests/rust/build.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@
1515
help="print commands to be executed")
1616
parser.add_argument("--release", action="store_true",
1717
help="build tests in release mode")
18+
parser.add_argument("--toolchain", action="append",
19+
help="TARGET:TOOLCHAIN, pass +TOOLCHAIN to cargo for TARGET")
1820

1921
args = parser.parse_args()
2022
if args.dry_run:
2123
args.verbose = True
2224

25+
TOOLCHAINS={}
26+
if args.toolchain is not None:
27+
for toolchain_arg in args.toolchain:
28+
match toolchain_arg.split(':'):
29+
case (target, toolchain):
30+
TOOLCHAINS[target] = toolchain
31+
case arg:
32+
print(f"expected --toolchain=TARGET:TOOLCHAIN, got {toolchain_arg}",
33+
file=sys.stderr)
34+
sys.exit(1)
35+
36+
CARGO = ['cargo']
2337
SYSTEMS = ['wasm32']
24-
VERSIONS = ['wasip1'] # + ['wasip2', 'wasip3']
38+
VERSIONS = ['wasip1', 'wasip3']
2539

2640
def compute_target(system, version):
2741
return f"{system}-{version}"
@@ -74,10 +88,13 @@ def mkdir_p(path):
7488
target = compute_target(system, version)
7589
build_target = compute_build_target(system, version)
7690
build_mode = "release" if args.release else "debug"
91+
toolchain = [f"+{TOOLCHAINS[target]}"] if target in TOOLCHAINS else []
7792

78-
build_args = ["cargo", "build",
79-
f"--manifest-path={BASE_DIR / target / 'Cargo.toml'}",
80-
f"--target={build_target}"]
93+
build_args = CARGO + toolchain + [
94+
"build",
95+
f"--manifest-path={BASE_DIR / target / 'Cargo.toml'}",
96+
f"--target={build_target}"
97+
]
8198
if args.release:
8299
build_args.append("--release")
83100
run(build_args)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

0 commit comments

Comments
 (0)