From fb982abf6c52cb095b77bbd9413d74e8dce16b5c Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 9 Sep 2025 23:42:37 +0800 Subject: improve build_targets test --- tests/benchmarks/build_targets/test.lua | 11 +++++++++-- 1 file 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 -- cgit v1.3.1