Skip to content

Commit

Permalink
Checkout test suite repositories without git-submodules
Browse files Browse the repository at this point in the history
git-submodule was good for us to manage the dependencies without hassle,
but it adds quite a few overheads to fetch this package as a SwiftPM
package dependency. This commit removes the git-submodules and adds a
Makefile to fetch the test suite repositories manually.
  • Loading branch information
kateinoigakukun committed Jun 11, 2024
1 parent 17b9a64 commit 111adc5
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 21 deletions.
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

5 changes: 3 additions & 2 deletions CI/check-wasi-testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ install_tools() {
install_tools

SOURCE_DIR="$(cd $(dirname $0)/.. && pwd)"
exec make -C $SOURCE_DIR Vendor/wasi-testsuite
(
cd $SOURCE_DIR && \
python3 -m pip install -r ./Vendor/wasi-testsuite/test-runner/requirements.txt && \
exec ./IntegrationTests/WASI/run-tests.sh
python3 -m pip install -r ./Vendor/wasi-testsuite/test-runner/requirements.txt
)
exec make -C $SOURCE_DIR wasi-test
31 changes: 21 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,43 @@ test:
docs:
swift package generate-documentation --target WasmKit

WAST_ROOT = Vendor/testsuite
### Spectest (Core WebAssembly Specification Test Suite)

TESTSUITE_DIR = Vendor/testsuite
SPECTEST_ROOT = ./spectest
WAST_FILES = $(wildcard $(WAST_ROOT)/*.wast) $(wildcard $(WAST_ROOT)/proposals/memory64/*.wast)
JSON_FILES = $(WAST_FILES:$(WAST_ROOT)/%.wast=$(SPECTEST_ROOT)/%.json)
WAST_FILES = $(wildcard $(TESTSUITE_DIR)/*.wast) $(wildcard $(TESTSUITE_DIR)/proposals/memory64/*.wast)
JSON_FILES = $(WAST_FILES:$(TESTSUITE_DIR)/%.wast=$(SPECTEST_ROOT)/%.json)

.PHONY: spec
spec: $(JSON_FILES) $(SPECTEST_ROOT)/host.wasm

$(SPECTEST_ROOT)/host.wasm: ./Examples/wasm/host.wat
wat2wasm ./Examples/wasm/host.wat -o $(SPECTEST_ROOT)/host.wasm

$(SPECTEST_ROOT)/%.json: $(WAST_ROOT)/%.wast
$(TESTSUITE_DIR):
$(MAKE) -C Vendor testsuite
$(TESTSUITE_DIR)/%.wast: $(TESTSUITE_DIR)
$(SPECTEST_ROOT)/%.json: $(TESTSUITE_DIR) $(TESTSUITE_DIR)/%.wast
@mkdir -p $(@D)
wast2json $^ -o $@

.PHONY: spectest
spectest: spec
swift run Spectest $(SPECTEST_ROOT)

.PHONY: clean
clean:
@swift package clean

.PHONY: update
update:
@swift package update
### WASI Test Suite

WASI_TESTSUITE_DIR = Vendor/wasi-testsuite

$(WASI_TESTSUITE_DIR):
$(MAKE) -C Vendor wasi-testsuite

.PHONY: wasitest
wasitest: $(WASI_TESTSUITE_DIR)
./IntegrationTests/WASI/run-tests.sh

### Utilities

.PHONY: generate
generate:
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@ Add the URL of this repository to your `Package.swift` manifest. Then add the `W
To run the core spec test suite run this:

```sh
$ make spectest # Prepare core spec tests and check their assertions with WasmKit
# Prepare core spec tests and check their assertions with WasmKit
$ make spectest
# Download WASI spec test suite
$ make Vendor/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
```
2 changes: 2 additions & 0 deletions Vendor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/wasi-testsuite
/testsuite
15 changes: 15 additions & 0 deletions Vendor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TESTSUITE_DIR = testsuite
TESTSUITE_REPO = https://github.com/WebAssembly/testsuite.git
TESTSUITE_REVISION = 7ef86ddeed81458f9031a49a40b3a3f99c1c6a8a

$(TESTSUITE_DIR):
git clone $(TESTSUITE_REPO) $(TESTSUITE_DIR)
git -C $(TESTSUITE_DIR) checkout $(TESTSUITE_REVISION)

WASI_TESTSUITE_DIR = ./wasi-testsuite
WASI_TESTSUITE_REPO = https://github.com/WebAssembly/wasi-testsuite.git
WASI_TESTSUITE_REVISION = c9c751586fd86b321d595bbef13f2c7403cfdbc5

$(WASI_TESTSUITE_DIR):
git clone $(WASI_TESTSUITE_REPO) $(WASI_TESTSUITE_DIR)
git -C $(WASI_TESTSUITE_DIR) checkout $(WASI_TESTSUITE_REVISION)
1 change: 0 additions & 1 deletion Vendor/testsuite
Submodule testsuite deleted from 7ef86d
1 change: 0 additions & 1 deletion Vendor/wasi-testsuite
Submodule wasi-testsuite deleted from c9c751

0 comments on commit 111adc5

Please sign in to comment.