summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2025-08-27 19:18:44 +0100
committerMax Bernstein <tekknolagi@gmail.com>2025-08-28 06:20:30 -0700
commit6b7ed4cad208ab7528070a66b1c97906606fa499 (patch)
tree2644e9ba4d83bf22ec52cb0d0eebcf3d55958123
parent2edfc51acf55bcb1db907b8e5542564529facb19 (diff)
ZJIT: Add zjit-test-update for updating insta snapshot
-rw-r--r--zjit/.gitignore1
-rw-r--r--zjit/zjit.mk17
2 files changed, 16 insertions, 2 deletions
diff --git a/zjit/.gitignore b/zjit/.gitignore
index 2f7896d1d1..100c0dfb5c 100644
--- a/zjit/.gitignore
+++ b/zjit/.gitignore
@@ -1 +1,2 @@
target/
+*.pending-snap
diff --git a/zjit/zjit.mk b/zjit/zjit.mk
index 43caa2e35a..e395207a9b 100644
--- a/zjit/zjit.mk
+++ b/zjit/zjit.mk
@@ -59,7 +59,7 @@ ZJIT_BINDGEN_DIFF_OPTS =
# Generate Rust bindings. See source for details.
# Needs `./configure --enable-zjit=dev` and Clang.
ifneq ($(strip $(CARGO)),) # if configure found Cargo
-.PHONY: zjit-bindgen zjit-bindgen-show-unused zjit-test zjit-test-lldb
+.PHONY: zjit-bindgen zjit-bindgen-show-unused zjit-test zjit-test-lldb zjit-test-update
zjit-bindgen: zjit.$(OBJEXT)
ZJIT_SRC_ROOT_PATH='$(top_srcdir)' BINDGEN_JIT_NAME=zjit $(CARGO) run --manifest-path '$(top_srcdir)/zjit/bindgen/Cargo.toml' -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS)
$(Q) if [ 'x$(HAVE_GIT)' = xyes ]; then $(GIT) -C "$(top_srcdir)" diff $(ZJIT_BINDGEN_DIFF_OPTS) zjit/src/cruby_bindings.inc.rs; fi
@@ -77,10 +77,23 @@ ZJIT_NEXTEST_ENV := RUBY_BUILD_DIR='$(TOP_BUILD_DIR)' \
# On darwin, it's available through `brew install cargo-nextest`. See
# https://nexte.st/docs/installation/pre-built-binaries/ otherwise.
zjit-test: libminiruby.a
+ @set +e; \
$(ZJIT_NEXTEST_ENV) $(CARGO) nextest run \
--manifest-path '$(top_srcdir)/zjit/Cargo.toml' \
'--features=$(ZJIT_TEST_FEATURES)' \
- $(ZJIT_TESTS)
+ $(ZJIT_TESTS); \
+ exit_code=$$?; \
+ if [ -f '$(top_srcdir)/zjit/src/.hir.rs.pending-snap' ]; then \
+ echo ""; \
+ echo "Pending snapshots found. Accept with: make zjit-test-update"; \
+ fi; \
+ exit $$exit_code
+
+# Accept all pending snapshots (requires cargo-insta)
+# Install with: cargo install cargo-insta
+zjit-test-update:
+ @$(CARGO) insta --version >/dev/null 2>&1 || { echo "Error: cargo-insta is not installed. Install with: cargo install cargo-insta"; exit 1; }
+ @$(CARGO) insta accept --manifest-path '$(top_srcdir)/zjit/Cargo.toml'
# Run a ZJIT test written with Rust #[test] under LLDB
zjit-test-lldb: libminiruby.a