-
Notifications
You must be signed in to change notification settings - Fork 2
feat: streamlined output, failure detection, and call chain support for external errors #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 4D Unit Testing Framework Makefile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SHELL := /bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get current user's home directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HOME_DIR := $(shell echo $$HOME) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -35,7 +36,14 @@ EXCLUDE_TAGS_COMBINED := $(strip $(DEFAULT_EXCLUDE_TAGS) $(excludeTags)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BASE_PARAMS := $(if $(EXCLUDE_TAGS_COMBINED),excludeTags=$(subst $(space),$(comma),$(EXCLUDE_TAGS_COMBINED))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build user parameters from make variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| USER_PARAMS := $(strip $(BASE_PARAMS) $(if $(format),format=$(format)) $(if $(tags),tags=$(tags)) $(if $(test),test=$(test)) $(if $(requireTags),requireTags=$(requireTags)) $(if $(parallel),parallel=$(parallel)) $(if $(maxWorkers),maxWorkers=$(maxWorkers)) $(if $(outputPath),outputPath=$(outputPath)) $(if $(verbose),verbose=$(verbose)) $(if $(callchain),callchain=$(callchain))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| USER_PARAMS := $(strip $(BASE_PARAMS) $(if $(format),format=$(format)) $(if $(tags),tags=$(tags)) $(if $(test),test=$(test)) $(if $(requireTags),requireTags=$(requireTags)) $(if $(parallel),parallel=$(parallel)) $(if $(maxWorkers),maxWorkers=$(maxWorkers)) $(if $(outputPath),outputPath=$(outputPath)) $(if $(verbose),verbose=$(verbose)) $(if $(callchain),callchain=$(callchain)) $(if $(triggers),triggers=$(triggers))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Output filtering: suppress tool4d diagnostic noise by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - stderr redirected to /dev/null (tool4d.4DRT errors) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - stdout cooperative-yield warnings stripped via FIFO + grep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Pass debug=true to disable stderr suppression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| STDERR_REDIRECT := $(if $(debug),,2>/dev/null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| YIELD_FILTER := grep --line-buffered -v '^tool4d\.APPL Cooperative process doesn.t yield enough' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Ensure tool4d is installed (currently implemented for Linux only) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(TOOL4D): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -57,11 +65,19 @@ $(TOOL4D): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Usage: make test [key=value key2=value2 ...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Example: make test format=json tags=unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: $(TOOL4D) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @if [ -n "$(USER_PARAMS)" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(TOOL4D) $(BASE_OPTS) --user-param "$(USER_PARAMS)"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @fifo=$$(mktemp -u).fifo; mkfifo $$fifo; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(YIELD_FILTER) < $$fifo & filter_pid=$$!; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$(USER_PARAMS)" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(TOOL4D) $(BASE_OPTS) --user-param "$(USER_PARAMS)" $(STDERR_REDIRECT) > $$fifo & \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(TOOL4D) $(BASE_OPTS); \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(TOOL4D) $(BASE_OPTS) $(STDERR_REDIRECT) > $$fifo & \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pid=$$!; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| trap 'disown $$pid $$filter_pid 2>/dev/null; kill -KILL $$pid $$filter_pid 2>/dev/null; rm -f $$fifo; exit 130' INT TERM; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait $$pid; ret=$$?; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kill $$filter_pid 2>/dev/null; wait $$filter_pid 2>/dev/null; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -f $$fifo; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit $$ret | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+83
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear stale If a stale marker exists (e.g., interrupted previous run), this target exits 1 even when current tests pass. Suggested fix test: $(TOOL4D)
- `@fifo`=$$(mktemp -u).fifo; mkfifo $$fifo; \
+ `@rm` -f "$(ERROR_FILE)"; \
+ fifo=$$(mktemp -u).fifo; mkfifo $$fifo; \
$(YIELD_FILTER) < $$fifo & filter_pid=$$!; \
if [ -n "$(USER_PARAMS)" ]; then \
$(TOOL4D) $(BASE_OPTS) --user-param "$(USER_PARAMS)" $(STDERR_REDIRECT) > $$fifo & \
else \
$(TOOL4D) $(BASE_OPTS) $(STDERR_REDIRECT) > $$fifo & \
fi; \
pid=$$!; \
- trap 'disown $$pid $$filter_pid 2>/dev/null; kill -KILL $$pid $$filter_pid 2>/dev/null; rm -f $$fifo; exit 130' INT TERM; \
+ trap 'disown $$pid $$filter_pid 2>/dev/null; kill -KILL $$pid $$filter_pid 2>/dev/null; rm -f $$fifo "$(ERROR_FILE)"; exit 130' INT TERM; \
wait $$pid; ret=$$?; \📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run all tests with JSON output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test-json: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -150,6 +166,9 @@ help: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " test-parallel-workers - Run tests in parallel with custom worker count" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " help - Show this help message" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Options:" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " debug=true - Show tool4d diagnostic stderr (suppressed by default)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Examples:" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test format=json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -167,6 +186,7 @@ help: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test-parallel-json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test-parallel-workers WORKERS=4" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test parallel=true maxWorkers=6" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo " make test debug=true # Show tool4d stderr output" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tool4d: $(TOOL4D) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "tool4d ready at $(TOOL4D)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gate stderr suppression only on explicit
debug=true.Current condition treats any non-empty
debugvalue (includingdebug=false) as debug mode.Suggested fix
🤖 Prompt for AI Agents