Skip to content

Commit 2298ed6

Browse files
josealekhineclaude
andcommitted
test: add smoke test target to Makefile
Add `make smoke` that builds the binary and runs basic commands: - ctx init (creates .context/) - ctx status (shows context summary) - ctx agent (outputs context packet) - ctx drift (checks for issues) - ctx add task (adds a task) - ctx session save (saves session) This provides a quick verification that the binary works end-to-end, suitable for CI or pre-release checks. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5010803 commit 2298ed6

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

.context/TASKS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
- [x] `ctx agent` returns context packet
5252
- [x] Set unit test coverage target (70% for internal/cli, internal/context)
5353
- [x] Add coverage reporting to `make test`
54-
- [ ] Add smoke test to CI/Makefile: build binary, run basic commands
54+
- [x] Add smoke test to CI/Makefile: build binary, run basic commands
5555
- [ ] Verify built binary executes subcommands (not silently falling through to root help)
5656

5757
### Phase 8: Task Archival & Snapshots `#priority:medium` `#area:cli`

Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Common targets for Go developers
44

5-
.PHONY: build test vet fmt lint clean all release dogfood help test-coverage
5+
.PHONY: build test vet fmt lint clean all release dogfood help test-coverage smoke
66

77
# Default binary name and output
88
BINARY := ctx
@@ -47,6 +47,29 @@ test-coverage:
4747
echo "Coverage check passed (internal/context >= 70%)"; \
4848
rm -f /tmp/ctx-coverage.txt
4949

50+
## smoke: Build and run basic commands to verify binary works
51+
smoke: build
52+
@echo "Running smoke tests..."
53+
@TMPDIR=$$(mktemp -d) && \
54+
cd $$TMPDIR && \
55+
echo " Testing: ctx --help" && \
56+
$(CURDIR)/$(BINARY) --help > /dev/null && \
57+
echo " Testing: ctx init" && \
58+
CTX_SKIP_PATH_CHECK=1 $(CURDIR)/$(BINARY) init > /dev/null && \
59+
echo " Testing: ctx status" && \
60+
$(CURDIR)/$(BINARY) status > /dev/null && \
61+
echo " Testing: ctx agent" && \
62+
$(CURDIR)/$(BINARY) agent > /dev/null && \
63+
echo " Testing: ctx drift" && \
64+
$(CURDIR)/$(BINARY) drift > /dev/null && \
65+
echo " Testing: ctx add task 'smoke test task'" && \
66+
$(CURDIR)/$(BINARY) add task "smoke test task" > /dev/null && \
67+
echo " Testing: ctx session save" && \
68+
$(CURDIR)/$(BINARY) session save > /dev/null && \
69+
rm -rf $$TMPDIR && \
70+
echo "" && \
71+
echo "Smoke tests passed!"
72+
5073
## vet: Run go vet
5174
vet:
5275
go vet ./...

0 commit comments

Comments
 (0)