summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-09 23:42:37 +0800
committerruki <[email protected]>2025-09-10 21:52:30 +0800
commitfb982abf6c52cb095b77bbd9413d74e8dce16b5c (patch)
tree44314dd688c36b9287a12fb05e0d901d8ac61ed9
parentec15e5a20f2912f00038263be42b6c88a695ee70 (diff)
improve build_targets test
-rw-r--r--tests/benchmarks/build_targets/test.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/benchmarks/build_targets/test.lua b/tests/benchmarks/build_targets/test.lua
index aae80702b..1111cbb2e 100644
--- a/tests/benchmarks/build_targets/test.lua
+++ b/tests/benchmarks/build_targets/test.lua
@@ -66,10 +66,17 @@ function test_build(t)
local meson = find_tool("meson")
if meson then
os.tryrm("build")
- local meson_dt = os.mclock()
+ local meson_setup_dt = os.mclock()
os.runv(meson.program, {"setup", "build"})
+ meson_setup_dt = os.mclock() - meson_setup_dt
+
+ -- ccache will cache object files globally, which may affect the results of the second run.
+ io.replace("build/build.ninja", "ccache", "")
+
+ local meson_build_dt = os.mclock()
os.runv(meson.program, {"compile", "-C", "build"})
- meson_dt = os.mclock() - meson_dt
+ meson_build_dt = os.mclock() - meson_build_dt
+ local meson_dt = meson_setup_dt + meson_build_dt
print("build targets/30: meson: %d ms", meson_dt)
t:require((meson_dt > xmake_dt) or (meson_dt + 2000 > xmake_dt))
end