aboutsummaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-01-03 09:35:48 +0100
committerPer Larsson <[email protected]>2022-01-03 09:35:48 +0100
commitba662c25cf77a5e3010ed29e5643d272dad8be62 (patch)
tree68843f02537d08b8eb3747b141658bf1b74d6d21 /xmake.lua
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-ba662c25cf77a5e3010ed29e5643d272dad8be62.tar.xz
zen-ba662c25cf77a5e3010ed29e5643d272dad8be62.zip
Run tests via xmake instead of executing target.
Diffstat (limited to 'xmake.lua')
-rw-r--r--xmake.lua42
1 files changed, 18 insertions, 24 deletions
diff --git a/xmake.lua b/xmake.lua
index e0c6f6cd3..e56261f27 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -225,47 +225,41 @@ task("bundle")
print(string.format("bundle '%s' ok!", bundle_name))
end)
-task("runtest")
+task("test")
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"}
+ {'r', "run", "kv", "all", "Run test(s)", " - all", " - core ", " - store", " - server", " - integration"}
}
}
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 = {
+ local testname = option.get("run")
+ local available_tests = {
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
+
+ print(os.exec("xmake config -c -m debug -a x64"))
+ print(os.exec("xmake"))
+
+ local tests = {}
+ for name, test in pairs(available_tests) do
+ if name == testname or testname == "all" then
+ tests[name] = test
end
end
-
- for name, target in pairs(targets) do
- printf("=== %s ===\n", target)
- local cmd = string.format("%s/%s%s", output_dir, target, ext)
+
+ for name, test in pairs(tests) do
+ printf("=== %s ===\n", test)
+ local cmd = string.format("xmake run %s", test)
if name == "server" then
- print(os.execv(cmd, {"test"}))
- else
- print(os.exec(cmd))
+ cmd = string.format("xmake run %s test", test)
end
+ print(os.exec(cmd))
end
end)