Run make try against a temporary directory (closes #12) #14

Merged
clawbot merged 1 commits from fix-make-try into next 2026-10-06 01:59:57 +02:00
2 changed files with 22 additions and 14 deletions
+18 -11
View File
@@ -1,7 +1,5 @@
.PHONY: default bootstrap setup test lint fmt fmt-check check docker hooks build clean try .PHONY: default bootstrap setup test lint fmt fmt-check check docker hooks build clean try
TESTDIR := $(HOME)/Documents/_SYSADMIN/cyberdyne
# The version `make build` stamps into the binary: the git tag or short # The version `make build` stamps into the binary: the git tag or short
# commit, -dirty with uncommitted changes. `make build VERSION=x` stamps x, # commit, -dirty with uncommitted changes. `make build VERSION=x` stamps x,
# which is how the Dockerfile passes its version in. # which is how the Dockerfile passes its version in.
@@ -45,13 +43,22 @@ build: clean
clean: clean:
@rm -f attrsum @rm -f attrsum
# Runs the binary on three small files in a new temporary directory, which
# the trap removes when the recipe ends, also when a step fails. The check
# after clear is expected to fail, so its exit status is ignored.
try: build try: build
./attrsum sum add -v $(TESTDIR) @set -ex; \
./attrsum check -v $(TESTDIR) dir=$$(mktemp -d); \
./attrsum clear -v $(TESTDIR) trap 'rm -rf "$$dir"' EXIT; \
-./attrsum check -v $(TESTDIR) echo one >"$$dir/a"; \
./attrsum sum add -v $(TESTDIR) echo two >"$$dir/b"; \
./attrsum check -v $(TESTDIR) echo three >"$$dir/c"; \
touch $(TESTDIR)/* ./attrsum sum add -v "$$dir"; \
./attrsum sum update -v $(TESTDIR) ./attrsum check -v "$$dir"; \
./attrsum check -v $(TESTDIR) ./attrsum clear -v "$$dir"; \
./attrsum check -v "$$dir" || true; \
./attrsum sum add -v "$$dir"; \
./attrsum check -v "$$dir"; \
touch "$$dir"/*; \
./attrsum sum update -v "$$dir"; \
./attrsum check -v "$$dir"
+4 -3
View File
@@ -20,12 +20,13 @@ have landed since the tag.
Policy scaffold commit: add LICENSE, REPO_POLICIES.md, .editorconfig, Policy scaffold commit: add LICENSE, REPO_POLICIES.md, .editorconfig,
.golangci.yml, and a comprehensive .gitignore (currently only the .golangci.yml, and a comprehensive .gitignore (currently only the
attrsum binary), and extend the Makefile (only test/build/clean/try attrsum binary), and extend the Makefile (only test/build/clean/try
today) with lint, fmt, fmt-check, check, and hooks targets. Fix the try today) with lint, fmt, fmt-check, check, and hooks targets.
target to use a temp fixture instead of the hardcoded
$(HOME)/Documents/_SYSADMIN/cyberdyne path.
# Completed Steps # Completed Steps
* 2026-10-05: `make try` runs on three small files in a temporary
directory that it removes afterwards, also when a step fails,
instead of on a fixed directory on one person's machine
* 2026-10-02: `attrsum --version` reports the git tag or short commit, * 2026-10-02: `attrsum --version` reports the git tag or short commit,
stamped by `make build` and by a plain `docker build .` of a clone; stamped by `make build` and by a plain `docker build .` of a clone;
`.dockerignore` sends `.git` without `.git/config` and keeps a `.dockerignore` sends `.git` without `.git/config` and keeps a