aboutsummaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-12-15 12:00:13 +0100
committerPer Larsson <[email protected]>2021-12-15 12:00:13 +0100
commit321d62f05580608441ce67520f390a5d642a5969 (patch)
treed25a421bb62627e56a1b2e08fbf640f6352018b8 /xmake.lua
parentRefreshed thirdparty/trace (diff)
downloadzen-321d62f05580608441ce67520f390a5d642a5969.tar.xz
zen-321d62f05580608441ce67520f390a5d642a5969.zip
Added runtest xmake task.
Diffstat (limited to 'xmake.lua')
-rw-r--r--xmake.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/xmake.lua b/xmake.lua
index 06307b479..43faca933 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -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)