summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-03-11 09:26:08 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2025-04-18 21:52:59 +0900
commit9137e24b54e6ae3d2bb0703adbb97c0d392a04d2 (patch)
treeb7e18c3436a6eae610e54fb6b96bc5af6ed74ce5
parentbe8c78f20dd5eaf31d1514319e60d904aad6dbd5 (diff)
Add a make target to run all ZJIT tests (https://github.com/Shopify/zjit/pull/49)
* Add a make target to run all ZJIT tests * Remove an unused variable * Write up a document about testing * Explain zjit-test-all first * Clarify what's zjit-test-all
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--doc/zjit.md44
-rw-r--r--zjit/zjit.mk11
2 files changed, 46 insertions, 9 deletions
diff --git a/doc/zjit.md b/doc/zjit.md
index 5ca0018d01..264677f0b1 100644
--- a/doc/zjit.md
+++ b/doc/zjit.md
@@ -31,7 +31,33 @@ To run code snippets with ZJIT:
You can also try https://www.rubyexplorer.xyz/ to view Ruby YARV disasm output with syntax highlighting
in a way that can be easily shared with other team members.
-## Unit Testing (`make zjit-test`)
+## Testing
+
+### make zjit-test-all
+
+This command runs all ZJIT tests: `make zjit-test` and `test/ruby/test_zjit.rb`.
+
+```
+make zjit-test-all
+```
+
+### make zjit-test
+
+This command runs Rust unit tests.
+
+```
+make zjit-test
+```
+
+You can also run a single test case by specifying the function name:
+
+```
+make zjit-test ZJIT_TESTS=test_putobject
+```
+
+<details>
+
+<summary>Setting up zjit-test</summary>
ZJIT uses `cargo-nextest` for Rust unit tests instead of `cargo test`.
`cargo-nextest` runs each test in its own process, which is valuable since
@@ -44,3 +70,19 @@ Since it uses Cargo, you'll also need a `configure --enable-zjit=dev ...` build
for `make zjit-test`. Since the tests need to link against CRuby, directly
calling `cargo test`, or `cargo nextest` likely won't build. Make sure to
use `make`.
+
+</details>
+
+### test/ruby/test\_zjit.rb
+
+This command runs Ruby execution tests.
+
+```
+make test-all TESTS="test/ruby/test_zjit.rb"
+```
+
+You can also run a single test case by matching the method name:
+
+```
+make test-all TESTS="test/ruby/test_zjit.rb -n test_putobject"
+```
diff --git a/zjit/zjit.mk b/zjit/zjit.mk
index 1f66558e7c..b7d06a3b76 100644
--- a/zjit/zjit.mk
+++ b/zjit/zjit.mk
@@ -88,15 +88,10 @@ update-zjit-bench:
$(Q) $(tooldir)/git-refresh -C $(srcdir) --branch main \
https://github.com/Shopify/zjit-bench zjit-bench $(GIT_OPTS)
-RUST_VERSION = +1.58.0
-
# Gives quick feedback about ZJIT. Not a replacement for a full test run.
-.PHONY: zjit-smoke-test
-zjit-smoke-test:
-ifneq ($(strip $(CARGO)),)
- $(CARGO) $(RUST_VERSION) test --all-features -q --manifest-path='$(top_srcdir)/zjit/Cargo.toml'
-endif
- $(MAKE) btest RUN_OPTS='--zjit-call-threshold=1' BTESTS=-j
+.PHONY: zjit-test-all
+zjit-test-all:
+ $(MAKE) zjit-test
$(MAKE) test-all TESTS='$(top_srcdir)/test/ruby/test_zjit.rb'
ZJIT_BINDGEN_DIFF_OPTS =