summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-06 22:59:26 +0800
committerruki <[email protected]>2024-02-06 22:59:26 +0800
commit3c4ce8986b515d8553ef1e6cb1108d56e62f809e (patch)
treefb076f8dddef39e86f66a439a4eb5208a77314af
parentc2d5a4a059d88134ef426cb58499994ef02508b2 (diff)
improve test jobs
-rw-r--r--xmake/actions/test/main.lua2
-rw-r--r--xmake/actions/test/xmake.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua
index 620c63134..ccc69e897 100644
--- a/xmake/actions/test/main.lua
+++ b/xmake/actions/test/main.lua
@@ -269,7 +269,7 @@ function _run_tests(tests)
local spent = os.mclock()
print("running tests ...")
local report = {passed = 0, total = #ordertests}
- local jobs = tonumber(option.get("jobs") or "1")
+ local jobs = tonumber(option.get("jobs")) or os.default_njob()
runjobs("run_tests", function (index)
local testinfo = ordertests[index]
if testinfo then
diff --git a/xmake/actions/test/xmake.lua b/xmake/actions/test/xmake.lua
index b72de7b02..a248623a6 100644
--- a/xmake/actions/test/xmake.lua
+++ b/xmake/actions/test/xmake.lua
@@ -34,7 +34,7 @@ task("test")
"e.g.",
" xmake test -w .",
" xmake test --workdir=`pwd`" },
- {'j', "jobs", "kv", "1", "Set the number of parallel compilation jobs." },
+ {'j', "jobs", "kv", tostring(os.default_njob()), "Set the number of parallel compilation jobs." },
{'r', "rebuild", "k", nil , "Rebuild the target." },
{},
{nil, "tests", "vs", nil , "The test names. It support pattern matching.",