summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-06 22:54:04 +0800
committerruki <[email protected]>2025-09-06 22:54:04 +0800
commitebebaad16cf7720e37afe507799ab1f9b399ad30 (patch)
tree2d0b3db273b5674ec3b39de411e73a14962861de
parentde42dd38b31b2f1d083cb1469cc42f3c62ad77e4 (diff)
add makefile cmake test
-rw-r--r--tests/benchmarks/config_targets/test.lua40
1 files changed, 26 insertions, 14 deletions
diff --git a/tests/benchmarks/config_targets/test.lua b/tests/benchmarks/config_targets/test.lua
index 08d441e87..915fd6f28 100644
--- a/tests/benchmarks/config_targets/test.lua
+++ b/tests/benchmarks/config_targets/test.lua
@@ -4,32 +4,44 @@ function test_config(t)
-- xmake
os.tryrm("build")
- local dt1 = os.mclock()
+ local xmake_dt = os.mclock()
os.runv(os.programfile(), {"config", "-c"})
- dt1 = os.mclock() - dt1
- print("config targets/1k: xmake: %d ms", dt1)
+ xmake_dt = os.mclock() - xmake_dt
+ print("config targets/1k: xmake: %d ms", xmake_dt)
-- cmake
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))
+ if find_tool("ninja") then
+ os.tryrm("build")
+ os.mkdir("build")
+ local cmake_ninja_dt = os.mclock()
+ os.runv(cmake.program, {"..", "-G", "Ninja"}, {curdir = "build"})
+ cmake_ninja_dt = os.mclock() - cmake_ninja_dt
+ print("config targets/1k: cmake/ninja: %d ms", cmake_ninja_dt)
+ t:require((cmake_ninja_dt > xmake_dt) or (cmake_ninja_dt + 1000 > xmake_dt))
+ end
+
+ if find_tool("make") then
+ os.tryrm("build")
+ os.mkdir("build")
+ local cmake_makefile_dt = os.mclock()
+ os.runv(cmake.program, {"..", "-G", "Unix Makefiles"}, {curdir = "build"})
+ cmake_makefile_dt = os.mclock() - cmake_makefile_dt
+ print("config targets/1k: cmake/makefile: %d ms", cmake_makefile_dt)
+ t:require((cmake_makefile_dt > xmake_dt) or (cmake_makefile_dt + 1000 > xmake_dt))
+ end
end
-- meson
local meson = find_tool("meson")
if meson then
os.tryrm("build")
- local dt3 = os.mclock()
+ local meson_dt = 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))
+ meson_dt = os.mclock() - meson_dt
+ print("config targets/1k: meson: %d ms", meson_dt)
+ t:require((meson_dt > xmake_dt) or (meson_dt + 1000 > xmake_dt))
end
end