Skip to content

Run spectest and WASI integration tests as a part of XCTest suite #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ jobs:
"hostSdkRootPath": "$(xcrun --show-sdk-path --sdk macosx)"
}
EOS
- run: ./Vendor/checkout-dependency testsuite
- run: ./Vendor/checkout-dependency
- run: swift test
# TODO: Enable wasi-testsuite checks

build-linux:
strategy:
Expand Down Expand Up @@ -108,10 +107,9 @@ jobs:
"hostSwiftExecutablePath": "/usr/bin/swift"
}
EOS
- run: ./Vendor/checkout-dependency testsuite
- run: ./build-exec ./CI/install-wabt.sh
- run: ./Vendor/checkout-dependency
- run: ./build-exec swift test
- run: ./build-exec ./CI/check-spectest.sh
- run: ./build-exec ./CI/check-wasi-testsuite.sh

build-windows:
runs-on: windows-latest
Expand All @@ -121,7 +119,7 @@ jobs:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
- uses: actions/checkout@v4
- run: python3 ./Vendor/checkout-dependency testsuite
- run: python3 ./Vendor/checkout-dependency
# FIXME: CMake build is failing on CI due to "link: extra operand '/OUT:lib\\libXXXX.a'" error
# # Check Windows build with CMake
# - uses: Cyberboss/install-winget@v1
Expand All @@ -133,7 +131,6 @@ jobs:
# - run: cmake --build .build/cmake
# Run tests with SwiftPM
- run: swift test
- run: ./CI/check-wasi-testsuite.ps1

build-cmake:
runs-on: ubuntu-20.04
Expand Down
6 changes: 0 additions & 6 deletions CI/check-wasi-testsuite.ps1

This file was deleted.

30 changes: 0 additions & 30 deletions CI/check-wasi-testsuite.sh

This file was deleted.

8 changes: 2 additions & 6 deletions CI/check-spectest.sh → CI/install-wabt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ install_tools() {
echo "Use wasm2wat $(wasm2wat --version): $(which wasm2wat)"
}

# Currently wabt is unavailable in amazonlinux2, so we skip the spectest on it.
# Currently wabt is unavailable in amazonlinux2
if is_amazonlinux2; then
echo "Skip spectest on amazonlinux2"
echo "Skip wabt installation on amazonlinux2"
exit 0
fi

set -e

install_tools

SOURCE_DIR="$(cd $(dirname $0)/.. && pwd)"
./Vendor/checkout-dependency testsuite
exec make -C $SOURCE_DIR spectest
36 changes: 0 additions & 36 deletions IntegrationTests/WASI/adapter.py

This file was deleted.

37 changes: 0 additions & 37 deletions IntegrationTests/WASI/run-tests.py

This file was deleted.

8 changes: 0 additions & 8 deletions IntegrationTests/WASI/skip.json

This file was deleted.

23 changes: 0 additions & 23 deletions IntegrationTests/WASI/skip.windows.json

This file was deleted.

15 changes: 0 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ NAME := WasmKit
docs:
swift package generate-documentation --target WasmKit

### Spectest (Core WebAssembly Specification Test Suite)

TESTSUITE_DIR = Vendor/testsuite

.PHONY: spectest
spectest:
swift run --sanitize address Spectest $(TESTSUITE_DIR) $(TESTSUITE_DIR)/proposals/memory64


### WASI Test Suite

.PHONY: wasitest
wasitest:
./IntegrationTests/WASI/run-tests.py

### Utilities

.PHONY: generate
Expand Down
13 changes: 2 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let package = Package(
),
.testTarget(
name: "WASITests",
dependencies: ["WASI"]
dependencies: ["WASI", "WasmKitWASI"]
),
.target(
name: "SystemExtras",
Expand All @@ -91,15 +91,6 @@ let package = Package(
],
exclude: ["CMakeLists.txt"]
),
.executableTarget(
name: "Spectest",
dependencies: [
"WasmKit",
"WAT",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
]
),
.testTarget(name: "WATTests", dependencies: ["WAT"]),
.target(name: "WIT"),
.testTarget(name: "WITTests", dependencies: ["WIT"]),
Expand All @@ -121,7 +112,7 @@ let package = Package(
),
.testTarget(
name: "WasmKitTests",
dependencies: ["WasmKit"]
dependencies: ["WasmKit", "WAT"]
),
.testTarget(
name: "WasmParserTests",
Expand Down
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,15 @@ You can find API documentation on the [Swift Package Index](https://swiftpackage

## Testing

To run the core spec test suite run this:
To run the WasmKit test suite, you need to checkout the test suite repositories first.

```sh
# Checkout the core spec test suite
$ ./Vendor/checkout-dependency spectest
# Prepare core spec tests and check their assertions with WasmKit
$ make spectest

# Checkout WASI spec test suite
$ ./Vendor/checkout-dependency wasi-testsuite
# Install Python dependencies for running WASI spec tests
$ python3 -m pip install -r ./Vendor/wasi-testsuite/test-runner/requirements.txt
# Run WASI spec tests
$ make wasitest
# Checkout test suite repositories
$ ./Vendor/checkout-dependency
# Run tests
$ swift test
```


## Acknowledgement

This project is originally developed by [@akkyie](https://github.com/akkyie), and now maintained by the community.
Loading