Skip to content

Commit 5c41d17

Browse files
committed
feat: add test-migrate target to Makefile
1 parent d39ba30 commit 5c41d17

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

Makefile

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DEFAULT_GOAL := help
2-
.PHONY: help install install-dev lint lint-fix format format-md typecheck quality test test-parallel test-teardown docs-serve docs-build docs-clean build clean all dev
2+
.PHONY: help install install-dev lint lint-fix format format-md typecheck quality test test-parallel test-migrate test-teardown docs-serve docs-build docs-clean build clean all dev
33

44
# Colors for output
55
YELLOW := \033[33m
@@ -86,6 +86,35 @@ test-parallel: ## Run tests in parallel on 4 instances (auto-starts if needed)
8686
fi
8787
$(PYTEST) -n 4 --port $(word 1,$(TEST_PORTS)) --port $(word 2,$(TEST_PORTS)) --port $(word 3,$(TEST_PORTS)) --port $(word 4,$(TEST_PORTS)) tests/lua/
8888

89+
test-migrate: ## Run replay.py on all JSONL files in tests/runs/ using 4 parallel instances
90+
@echo "$(YELLOW)Running replay migration on tests/runs/ files...$(RESET)"
91+
@running_count=$$($(BALATRO_SCRIPT) --status | grep -E "($(word 1,$(TEST_PORTS))|$(word 2,$(TEST_PORTS))|$(word 3,$(TEST_PORTS))|$(word 4,$(TEST_PORTS)))" | wc -l); \
92+
if [ "$$running_count" -ne 4 ]; then \
93+
echo "Starting Balatro instances on ports: $(TEST_PORTS)"; \
94+
$(BALATRO_SCRIPT) --headless --fast -p $(word 1,$(TEST_PORTS)) -p $(word 2,$(TEST_PORTS)) -p $(word 3,$(TEST_PORTS)) -p $(word 4,$(TEST_PORTS)); \
95+
sleep 1; \
96+
fi
97+
@jsonl_files=$$(find tests/runs -name "*.jsonl" -not -name "*.skip" | sort); \
98+
if [ -z "$$jsonl_files" ]; then \
99+
echo "$(RED)No .jsonl files found in tests/runs/$(RESET)"; \
100+
exit 1; \
101+
fi; \
102+
file_count=$$(echo "$$jsonl_files" | wc -l); \
103+
echo "Found $$file_count .jsonl files to process"; \
104+
ports=($(TEST_PORTS)); \
105+
port_idx=0; \
106+
for file in $$jsonl_files; do \
107+
port=$${ports[$$port_idx]}; \
108+
echo "Processing $$file on port $$port..."; \
109+
$(PYTHON) bots/replay.py --input "$$file" --port $$port & \
110+
port_idx=$$((port_idx + 1)); \
111+
if [ $$port_idx -eq 4 ]; then \
112+
port_idx=0; \
113+
fi; \
114+
done; \
115+
wait; \
116+
echo "$(GREEN)✓ All replay migrations completed$(RESET)"
117+
89118
test-teardown: ## Kill all Balatro instances
90119
@echo "$(YELLOW)Killing all Balatro instances...$(RESET)"
91120
$(BALATRO_SCRIPT) --kill

0 commit comments

Comments
 (0)