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 8baf5f9
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 20 deletions.
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions CI/check-wasi-testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ install_tools
SOURCE_DIR="$(cd $(dirname $0)/.. && pwd)"
(
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
32 changes: 22 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,44 @@ 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: wasi-test
wasi-test: $(WASI_TESTSUITE_DIR)
python3 -m pip install -r $(WASI_TESTSUITE_DIR)/test-runner/requirements.txt
./IntegrationTests/WASI/run-tests.sh

### Utilities

.PHONY: generate
generate:
Expand Down
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 8baf5f9

Please sign in to comment.