aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile31
1 files changed, 20 insertions, 11 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 8fd2e0c..dc12732 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -100,8 +100,10 @@ endif
fi; \
printf "$(YELLOW)Running tests in $$TESTFILE...$(NC)\n"; \
$(EMACS_BATCH) -l ert -l "$$TESTFILE" \
- --eval "$(ERT_FAST_SELECTOR)" 2>&1 | tee $(PROJECT_ROOT)/tests/test-file-output.log; \
- if [ $$? -eq 0 ]; then \
+ --eval "$(ERT_FAST_SELECTOR)" > $(PROJECT_ROOT)/tests/test-file-output.log 2>&1; \
+ status=$$?; \
+ cat $(PROJECT_ROOT)/tests/test-file-output.log; \
+ if [ $$status -eq 0 ]; then \
printf "$(GREEN)✓ All tests in $$TESTFILE passed!$(NC)\n"; \
else \
printf "$(RED)✗ Some tests failed.$(NC)\n"; \
@@ -152,17 +154,22 @@ test-unit: check-deps
# Run only integration tests (excluding :slow)
test-integration: check-deps
@printf "$(YELLOW)Running integration tests ($(words $(INTEGRATION_TESTS)) files, excluding :slow)...$(NC)\n"
- @failed=0; \
+ @failed=0; ran=0; \
for testfile in $(INTEGRATION_TESTS); do \
echo " Testing $$testfile..."; \
- $(EMACS_BATCH) -l ert -l "$$testfile" \
- --eval "$(ERT_FAST_SELECTOR)" || failed=$$((failed + 1)); \
+ out=$$($(EMACS_BATCH) -l ert -l "$$testfile" \
+ --eval "$(ERT_FAST_SELECTOR)" 2>&1) || failed=$$((failed + 1)); \
+ printf '%s\n' "$$out"; \
+ n=$$(printf '%s\n' "$$out" | sed -n 's/^Ran \([0-9][0-9]*\) tests.*/\1/p' | tail -1); \
+ ran=$$((ran + $${n:-0})); \
done; \
- if [ $$failed -eq 0 ]; then \
- printf "$(GREEN)[✓] All integration tests passed$(NC)\n"; \
- else \
+ if [ $$failed -gt 0 ]; then \
printf "$(RED)[✗] $$failed integration test file(s) failed$(NC)\n"; \
exit 1; \
+ elif [ $$ran -eq 0 ]; then \
+ printf "$(YELLOW)[i] Integration tests skipped: every one is tagged :slow. Run 'make test-all'.$(NC)\n"; \
+ else \
+ printf "$(GREEN)[✓] All integration tests passed ($$ran tests)$(NC)\n"; \
fi
# Run tests matching a name pattern (ERT selector)
@@ -201,7 +208,7 @@ validate:
for file in ../chime.el test-*.el testutil-*.el; do \
if [ -f "$$file" ] && [ ! -d "$$file" ]; then \
total=$$((total + 1)); \
- output=$$(emacs --batch -Q --eval "(progn \
+ raw=$$(emacs --batch -Q --eval "(progn \
(setq byte-compile-error-on-warn nil) \
(find-file \"$$file\") \
(condition-case err \
@@ -210,8 +217,10 @@ validate:
(message \"✓ $$file - parentheses balanced\")) \
(error \
(message \"✗ $$file: %s\" (error-message-string err)) \
- (kill-emacs 1))))" 2>&1 | grep -E '(✓|✗)'); \
- if [ $$? -eq 0 ]; then \
+ (kill-emacs 1))))" 2>&1); \
+ status=$$?; \
+ output=$$(printf '%s\n' "$$raw" | grep -E '(✓|✗)'); \
+ if [ $$status -eq 0 ]; then \
printf "$(GREEN)$$output$(NC)\n"; \
else \
printf "$(RED)$$output$(NC)\n"; \