/xmake-skills:xmake-unit-testsfrom xmake-skills
Runs and writes xmake's own internal unit test suite in the xmake-io/xmake source tree, including invoking tests/run.lua, creating runner.lua test files, and loading srcenv.profile.
Ships in xmake-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill is about the xmake project's own internal test suite — useful when you are fixing a bug in xmake itself, adding a new API, or verifying a backport. For testing your own C/C++ project, see xmake-tests.
The suite lives under tests/ in the xmake source tree. Each subdirectory is a self-contained test (usually a mini project) driven by a runner.lua or a test.lua.
You need a checkout of xmake and the source-level env loaded:
git clone --recursive https://github.com/xmake-io/xmake.git
cd xmake
./configure && make -j # or on Windows: cd core && xmake
source scripts/srcenv.profile # so `xmake` points at the local checkout
xmake l xmake.programdir # verify: should end in .../xmake/xmake
See xmake-dev for the full build-from-source flow.
xmake l tests/run.lua
Iterates every subdirectory under tests/ that contains a runner.lua and runs it. Expect a scroll of "pass/skip" output.
xmake l tests/run.lua actions/build
xmake l tests/run.lua apis/add_files
xmake l tests/run.lua modules/lib_detect_find_tool
xmake l tests/run.lua plugins/project
xmake l tests/run.lua projects/c/console
The argument is a relative path under tests/. Any sub-tree works:
actions/ — tests for xmake build, xmake run, etc.apis/ — per-API tests (add_files, add_defines, target:add, …)modules/ — library module tests (lib.detect.find_tool, net.http, …)plugins/ — plugin tests (project generator, doxygen, …)projects/ — end-to-end mini projects per languagecli/ — CLI flag testsbenchmarks/ — performance benchmarksxmake l -vD tests/run.lua actions/build
-v shows each sub-command the test runs; -D dumps a Lua traceback on failure. Use this whenever a test fails — the default output is terse.
A typical test directory:
tests/apis/add_files/
├── runner.lua # entry point
└── (optional support files, sample sources, etc.)
runner.lua:
-- tests/apis/add_files/runner.lua
function main(t)
-- t is a context table with helpers (tmpdir, assertions, etc.)
local tmpdir = os.tmpdir()
os.cd(tmpdir)
os.mkdir("src")
io.writefile("src/main.cpp", [[int main(){ return 0; }]])
io.writefile("xmake.lua", [[
target("demo")
set_kind("binary")
add_files("src/*.cpp")
]])
os.exec("xmake -r")
assert(os.isfile("build/" .. os.host() .. "/" .. os.arch() .. "/release/demo"))
end
Conventions:
main(t) is the entry point. Any uncaught error (including assert failures) marks the test as failed.os.exec for commands that must succeed (it raises on non-zero).os.iorun / os.iorunv when you need to capture output.raise("message") for explicit failures with a custom message.os.tmpdir().tests/apis/<name>/; action tests under tests/actions/<action>/<case>/; module tests under tests/modules/<module>/; end-to-end projects under tests/projects/<lang>/<case>/.runner.lua.os.tmpdir(), no network unless required, no assumptions about parallelism.xmake l -vD tests/run.lua apis/mynew
xmake l tests/run.lua
source scripts/srcenv.profile
# Edit xmake Lua source (no rebuild needed)
vim xmake/actions/build/main.lua
# Rerun the specific test
xmake l -vD tests/run.lua actions/build/basic
# If native C core changed, rebuild first
make -j && xmake l tests/run.lua
Lua edits don't need a rebuild — srcenv.profile points XMAKE_PROGRAM_DIR at your checkout, so xmake l tests/run.lua always runs the Lua you just edited.
xmake l tests/run.lua benchmarks/<name>
Benchmarks live under tests/benchmarks/ and print timing data instead of pass/fail. Use them when evaluating a performance change in xmake itself (see xmake-build-optimization for project-level optimization).
Xmake's CI runs xmake l tests/run.lua on every push across Windows / Linux / macOS. If you open a PR, read the CI logs — failures usually point at a specific subtest path you can reproduce locally with:
xmake l -vD tests/run.lua <failing-test-path>
source scripts/srcenv.profile. Tests run against the installed xmake instead of your checkout — Lua edits have no effect. Check with xmake l xmake.programdir.os.cd(os.tmpdir()) at the top; otherwise a later test may inherit the wrong directory.tests/ runs on all three OSes in CI. Gate platform-only cases with is_host("windows") etc., not hard-coded paths.tests/net/ and tag it so CI can skip it when offline.make only matters for C changes under core/src/.add_tests / xmake test → xmake-testsxmake-devxmake-troubleshootingWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub xmake-io/xmake-skills --plugin xmake-skills58 skills in this plugin
/xmake-addon-developmentUse when writing an Xmake addon — the `addon.lua` manifest, the payload layout (plugins/rules/toolchains/modules/includes/templates), `@self` references, shipping package definitions with an addon, `add_globalmodules`, testing it locally, and publishing it to xmake-repo as an `addon` kind package./xmake-addonsUse when installing or using an Xmake addon — `xmake addon --install/--list/--remove/--upgrade/--search`, declaring `add_addons(...)` in a project, and referencing addon payloads with `@addon/<name>/<rule>`, `@addon.<name>.<module>` or `@self`. For writing and publishing one, see xmake-addon-development./xmake-async-jobsUse when running parallel / async work inside xmake scripts — `async.runjobs` for parallel job execution, `async.jobgraph` (DAG) for dependency-ordered jobs, `async.jobpool` (tree structure), `core.base.scheduler` coroutine scheduling, semaphores, and `on_build_files(..., {jobgraph = true})` in rules. For running external compile jobs faster, see `xmake-build-optimization`.Other plugins' skills for the same job