about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-09-29 07:48:42 +0000
committerPjotr <wrk@bosa.lan>2026-09-29 07:48:42 +0000
commitf76f79b8c095fdafc20fe8e054d5ff8ca5ee019f (patch)
treedb3b11c5f1c1a2c962f83d24f088ba561b56c8e6
parent0a39376cf2df6a25d96bdd1027569e36bdba67f5 (diff)
downloadgn-bnw-f76f79b8c095fdafc20fe8e054d5ff8ca5ee019f.tar.gz
build: add a Makefile test driver (test/run/clean) and document it
'make test' builds the BNW package from this checkout (BNW_LOCAL_SOURCE
in guix-bioinformatics) and runs the full container test cycle; 'make
run' leaves the container up on :8881; 'make clean' removes test logs,
the /tmp VM image and leaked test VMs.
-rw-r--r--Makefile32
-rw-r--r--README.md15
2 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..b75e6458
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+# BNW test driver.
+#
+# The container tests build the BNW package from THIS checkout via the
+# BNW_LOCAL_SOURCE hook in guix-bioinformatics/gn/packages/bnw.scm, so
+# source changes here are what gets tested -- no upstream tarball, no
+# patch.  Requires the factory layout (../guix-bioinformatics,
+# ../gn-machines, ../run-guix-container) and the run-guix-system-container
+# daemon on 127.0.0.1:8900.
+#
+#   make            build from this checkout and run the container tests
+#   make run        same, but leave the container running (web on :8881)
+#   make clean      remove test artifacts and leaked test VMs
+
+BNW_ROOT := $(CURDIR)
+
+.PHONY: test run clean
+
+test:
+	@echo "== building BNW from $(BNW_ROOT) and running the container tests =="
+	@BNW_LOCAL_SOURCE="$(BNW_ROOT)" ./test/run_container_tests.sh
+
+run:
+	@BNW_LOCAL_SOURCE="$(BNW_ROOT)" ./test/run_container_tests.sh --keep
+
+clean:
+	rm -rf test/__pycache__ test/logs
+	rm -f /tmp/bnw-vm.qcow2 /tmp/bnw-vm*.log /tmp/bnw-container-test.log
+	@-for p in $$(ls /proc 2>/dev/null | grep -E '^[0-9]+$$'); do \
+	  case "$$(tr '\0' ' ' < /proc/$$p/cmdline 2>/dev/null)" in \
+	    *qemu-system*bnw-vm.qcow2*) kill -9 $$p 2>/dev/null && echo "killed leaked test VM (pid $$p)";; \
+	  esac; \
+	done
diff --git a/README.md b/README.md
index 382816f1..87b003e0 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,21 @@ stops the container again (kept running on failure, or with --keep):
 test/run_container_tests.sh          # or --keep to inspect afterwards
 ```
 
+The same cycle is available as `make` targets from the repo root:
+
+```sh
+make            # build from this checkout and run the container tests
+make run        # leave the container running afterwards (web on :8881)
+make clean      # remove test artifacts (logs, pycache, /tmp VM image)
+                # and kill any leaked test VM
+```
+
+`make` (and the scripts) export `BNW_LOCAL_SOURCE`, which makes
+`gn/packages/bnw.scm` in guix-bioinformatics build the package from
+this checkout instead of the upstream git origin + patch file — so a
+`make test` always exercises exactly the source in this tree.  If
+`make` is not on your PATH, run it via `guix shell make -- make test`.
+
 Memory footprint measured in a Guix system container (8-node example
 run, php-fpm + nginx + octave + shepherd):