diff options
| author | Per Larsson <[email protected]> | 2021-12-15 12:00:13 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-15 12:00:13 +0100 |
| commit | 321d62f05580608441ce67520f390a5d642a5969 (patch) | |
| tree | d25a421bb62627e56a1b2e08fbf640f6352018b8 /xmake.lua | |
| parent | Refreshed thirdparty/trace (diff) | |
| download | zen-321d62f05580608441ce67520f390a5d642a5969.tar.xz zen-321d62f05580608441ce67520f390a5d642a5969.zip | |
Added runtest xmake task.
Diffstat (limited to 'xmake.lua')
| -rw-r--r-- | xmake.lua | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -185,3 +185,48 @@ task("bundle") description = "Create zip bundle from binaries", options = {} } + +task("runtest") + set_menu { + usage = "xmake runtest [core|store|server|integration|all]", + description = "Run Zen tests", + options = { + {'c', "core", "k", nil, "Run core tests"}, + {'t', "store", "k", nil, "Run store tests"}, + {'s', "server", "k", nil, "Run server tests"}, + {'i', "integration", "k", nil, "Run server integration tests"}, + {'a', "all", "k", nil, "Run all tests"} + } + } + on_run(function() + import("core.base.option") + + local arch = "x64" + local mode = is_mode("release") and "release" or "debug" + local output_dir = string.format("$(curdir)/$(buildir)/$(os)/%s/%s", arch, mode) + local ext = is_plat("windows") and ".exe" or "" + + local available_targets = { + core = "zencore-test", + store = "zenstore-test", + server = "zenserver", + integration = "zenserver-test" + } + + local targets = {} + for name, target in pairs(available_targets) do + if option.get(name) or option.get('all') then + targets[name] = target + end + end + + for name, target in pairs(targets) do + printf("=== %s ===\n", target) + local cmd = string.format("%s/%s%s", output_dir, target, ext) + if name == "server" then + print(os.execv(cmd, {"test"})) + else + print(os.exec(cmd)) + end + end + end) |