Skip to content

Make Targets

All targets run in Docker. Nothing is installed on the host.


Root Makefile

Target Description
test Run the unit and integration suites.
unit Run the unit suite only.
integration Run the integration suite only.
watch Run all tests, then re-run whenever a file under src/, test/ or files/ changes.
lint Compile-check every ucode file, sh -n every shell script, parse every JSON file under luci/ with ucode and every LuCI script under luci/ with quickjs (as the function body LuCI compiles it into), fail on innerHTML, outerHTML, insertAdjacentHTML, document.write or %s in a .format() template in those scripts (devenv/scripts/luci-dom-lint.sh, which lint first proves still catches each), check the pinned documentation links with devenv/scripts/docs-links.sh (see Link check), and run test/feed/feed_makefile_test.sh against the feed Makefile generator. Then check that luci/po/templates/wgpathd.pot is what pot would write, and that the scanner gave no warning.
leak Run test/leak/leak.uc in the development container: the prober against loopback, a discovery fetch against the publisher and a command, each on the real uloop, about a thousand times. Fails if any keeps more than 64 bytes of memory per use after a warm-up. Needs raw sockets for the prober.
shell Open a throwaway shell in the development image.
image Rebuild the development image, pulling the base image again.
package Build bin/wgpathd-<version>-r<release>.apk and bin/luci-app-wgpathd-<version>-r<release>.apk in the OpenWrt SDK.
package-check Run package, then install both packages offline in an OpenWrt rootfs container that already carries their dependencies (no network, NET_ADMIN in its own empty namespace) and check files, modes, package scripts, clean failure paths, that the package ships no firewall rules and that an upgrade from a release with the fw4 include unloads its rules, the app's pin to the daemon's version, that the app's JSON and views parse and its scripts clear LuCI's caches, and removal.
pot Write luci/po/templates/wgpathd.pot, the translation template of luci-app-wgpathd, with openwrt/luci's build/i18n-scan.pl, run over luci/ laid out as applications/luci-app-wgpathd of the luci tree. The scanner is the one of the luci commit the OpenWrt 25.12.5 SDK pins (devenv/services/i18n/Dockerfile), in image wgpathd-i18n:<hash> (Alpine with perl and gettext), which runs without network. Fails, and writes nothing, when the scanner warns.
browser Run package, then the Playwright tests in test/browser/ against the LuCI pages. LuCI (uhttpd on 127.0.0.1, rpcd with the package's own wgpathd.config plugin, ubusd, the built packages and a fake wgpathd ubus object answering test/fixtures/luci/, which also lays out the configurations of test/fixtures/luci/config/) runs in an OpenWrt rootfs container with --network none and no capabilities; Playwright runs in a second container joined to its network namespace with --network container:, so the two share only its loopback. Both are removed when the run ends. Images wgpathd-luci:<arch>-<version> and wgpathd-browser:<playwright version>. Screenshots and, on failure, the error context and the LuCI log in bin/browser/.
e2e Run package, then the end-to-end failover scenarios against a hub and two spokes in OpenWrt containers (procd as PID 1, kernel WireGuard, fw4), compose project wgpathd-e2e, image wgpathd-e2e:<arch>-<version>-<ucode>. Refuses to start while another project's containers run, guards the host's Wi-Fi interface for the whole run, and always tears down. Results in bin/e2e/.
lab-up Run package, then start the e2e topology as compose project wgpathd-lab (containers wgpathd-lab-hub, wgpathd-lab-spoke-a, wgpathd-lab-spoke-b) with the WireGuard substrate in place and wgpathd installed but disabled (shipped /etc/config/wgpathd, enabled '0') on every node. Returns once the hub has handshakes with both spokes on wg_hub and wg_mesh. The same host guards as e2e apply, and the watchdog keeps running in the background until lab-down. Guard logs in bin/lab/.
lab-down Stop the lab's watchdog, tear the lab down and print the host report (sysctls, Wi-Fi interface, kernel log). Safe to run when the lab is not up.
lab-shell Open a login shell on the lab node named by NODE.
lab-fault Inject or clear a fault in the running lab, named by NAME: kill-direct drops the wg_mesh datagrams between the spokes (the e2e kill-direct fault: the hub leg, the relay and ICMPv6 stay up); relay-delay delays everything the hub sends by MS milliseconds (netem on the hub's eth0), which slows only the relay path, since the direct path never crosses the hub; restore clears every fault.
feed-makefile Write the wgpathd Makefile for the packages.ucode.dev feed with devenv/scripts/gen-feed-makefile.sh: openwrt/wgpathd/Makefile from the v<VERSION> release tarball, plus PKG_SOURCE, PKG_SOURCE_URL, PKG_HASH (the tarball's sha256), PKG_BUILD_DIR and PKG_LICENSE_FILES, with every ./src/, ./files/ and ./luci/ path pointing into the unpacked tarball. Downloads the tarball from GitHub unless TARBALL or HASH is given. Fails, and writes nothing, when the source Makefile has a shape the generator does not cover or copies a path the tarball lacks.
docs Build the documentation site (same as make -C docs build).
docs-mike Strict build with the versioned config (same as make -C docs build-mike).
docs-test Test the docs publishing tooling (same as make -C docs test).
docs-serve Serve the documentation with live reload (same as make -C docs serve).

test, unit, integration, watch, lint and shell run in the wgpathd-openwrt:<arch>-<version>-<ucode>-<hash> image, which is built on first use from devenv/services/openwrt/Dockerfile and rebuilt when that file or openwrt/wgpathd/Makefile changes. <hash> is taken from the Dockerfile and the daemon's dependencies, so two checkouts that need different images never overwrite each other's; images left behind by older hashes can be removed with docker image rm. The container has no network.

Variables

Variable Default Applies to Description
OPENWRT_VERSION 25.12.5 all OpenWrt release of the rootfs and SDK images.
UCODE stock test, unit, integration, watch, leak, lint, shell, e2e, lab-up stock keeps the ucode the rootfs ships; feed upgrades it from the release's package index, as a device installed or upgraded now has it. The two differ in how regular expressions treat newlines.
OPENWRT_ARCH x86_64 all Target architecture; selects the ghcr.io/openwrt/rootfs and ghcr.io/openwrt/sdk image tags. The package itself is architecture-independent.
FILTER — test, unit, integration, watch, browser Run only tests whose name matches this regular expression.
VERBOSE — tests, package Tests: detailed reporter with one line per test. package: verbose SDK build (V=s).
MODULES — test, unit, integration, watch Run only these test files or directories.
CI — all When set, runs containers without a TTY.
SCENARIO all e2e Run only these scenarios (space-separated names from test/e2e/).
NODE — lab-shell hub, spoke-a or spoke-b.
NAME — lab-fault kill-direct, relay-delay or restore.
MS — lab-fault Milliseconds of delay for NAME=relay-delay.
E2E_STRICT — e2e, lab-up Set to 1 to refuse to start while containers of other projects run. By default they are listed as a warning and the run goes ahead. The lab and the suite always refuse to run at the same time.
VERSION — feed-makefile Release to generate for, without the v: 0.1.0. Must be the PKG_VERSION of the Makefile it transforms.
OUT standard output feed-makefile File to write.
TARBALL — feed-makefile Use this tarball of the release instead of downloading it.
HASH — feed-makefile Offline: use this sha256 as PKG_HASH and transform the in-tree Makefile. Nothing checks that it matches the tag.
E2E_WATCH_IFACE wlan0 e2e, lab-up Host interface the e2e runner and the lab guard; the stack is torn down if it goes down.

Examples:

make unit FILTER='trial' VERBOSE=1
make unit MODULES=test/unit/wgpathd/decide_test.uc

docs/Makefile

Target Description
build Build the site into bin/site/ with mkdocs build --strict.
build-mike Build the site into bin/site/ with mkdocs build --strict --config-file mkdocs.mike.yml: the versioned config the release publish uses (mike plugin, version selector, outdated-version banner).
test Run test/docs/: the docs version, guard, publish and link-check scripts, with a full mike publish to a throwaway local repository, and the gh-pages 404 redirect. No network.
serve Serve the site with live reload on http://localhost:8000, or on the port set by DOCS_PORT. dev is an alias.
clean Remove bin/site/.
help List the targets. This is the default.

build and serve run the pinned squidfunk/mkdocs-material:9.5.17 image as the invoking user. build-mike and test run wgpathd-docs:9.5.17, the same image plus the pinned mike from devenv/services/docs/requirements.txt, git and Node, built on first use from devenv/services/docs/Dockerfile and rebuilt when it or the requirements change. DOCS_PORT (default 8000) sets the host port for serve, for example when another project's preview already uses 8000: make -C docs serve DOCS_PORT=8001. It also works from the root: make docs-serve DOCS_PORT=8001.