summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-06 22:48:02 +0800
committerruki <[email protected]>2025-09-06 22:48:02 +0800
commitde42dd38b31b2f1d083cb1469cc42f3c62ad77e4 (patch)
tree0ce671b5edf2141ec76f98e0ebd1e5ad1a00bcc3
parentfc2b0dc9491ee838275c283b57fc316935471d4f (diff)
improve test
-rw-r--r--tests/benchmarks/config_targets/test.lua35
1 files changed, 21 insertions, 14 deletions
diff --git a/tests/benchmarks/config_targets/test.lua b/tests/benchmarks/config_targets/test.lua
index 66aec4ff1..08d441e87 100644
--- a/tests/benchmarks/config_targets/test.lua
+++ b/tests/benchmarks/config_targets/test.lua
@@ -1,3 +1,5 @@
+import("lib.detect.find_tool")
+
function test_config(t)
-- xmake
@@ -8,21 +10,26 @@ function test_config(t)
print("config targets/1k: xmake: %d ms", dt1)
-- cmake
- os.tryrm("build")
- os.mkdir("build")
- local dt2 = os.mclock()
- os.runv("cmake", {"..", "-G", "Ninja"}, {curdir = "build"})
- dt2 = os.mclock() - dt2
- print("config targets/1k: cmake: %d ms", dt2)
+ local cmake = find_tool("cmake")
+ if cmake then
+ os.tryrm("build")
+ os.mkdir("build")
+ local dt2 = os.mclock()
+ os.runv(cmake.program, {"..", "-G", "Ninja"}, {curdir = "build"})
+ dt2 = os.mclock() - dt2
+ print("config targets/1k: cmake: %d ms", dt2)
+ t:require((dt2 > dt1) or (dt2 + 1000 > dt1))
+ end
-- meson
- os.tryrm("build")
- local dt3 = os.mclock()
- os.runv("meson", {"setup", "build"})
- dt3 = os.mclock() - dt3
- print("config targets/1k: meson: %d ms", dt3)
-
- t:require((dt2 > dt1) or (dt2 + 1000 > dt1))
- t:require((dt3 > dt1) or (dt3 + 1000 > dt1))
+ local meson = find_tool("meson")
+ if meson then
+ os.tryrm("build")
+ local dt3 = os.mclock()
+ os.runv(meson.program, {"setup", "build"})
+ dt3 = os.mclock() - dt3
+ print("config targets/1k: meson: %d ms", dt3)
+ t:require((dt3 > dt1) or (dt3 + 1000 > dt1))
+ end
end