Skip to content

[Feature]: 优化构建+Test用例的执行速度 #3521

Closed

Description

@xzxiaoshan

现在构建+Test用例的执行周期太长了,逐渐增长,已经到20多分钟了,需要分析优化。

Activity

  1. added
    enhancement
    on Oct 12, 2026
  2. CryoThrust commented on Oct 13, 2026

    @CryoThrust
    Contributor

    One measured starting point on current main (25698366): WaitAsyncResultsToolTest.timeoutClampedToMax really waits for 120 seconds. During a local JDK 17 mvn -B -T1 -pl agentscope-harness -am clean verify, its Surefire testcase time was 120.014 s, while the complete Harness module took 4:10. A thread dump during the run showed the test thread in WaitAsyncResultsTool.doWaitForResults → Thread.sleep, not dependency resolution or a deadlock. This does not establish the cause of the entire 20-minute CI run, but it is a reproducible contributor to this module's time.

    The fixture calls waitForResults(600, ctx()) with an empty inbox. Although its comment says we cannot wait 120 s in a unit test, the real clamped wait is what it executes. Also, nullTimeoutUsesDefault calls waitForResults(1, ctx()), so it does not currently test the null/default path.

    I would start with a narrow timeout-test slice: keep the real wait loop and its guardrails, provide package-local clock/sleep control for deterministic tests, and cover 600 → 120, null → 60, the short caller budget and empty-wait accounting using virtual elapsed time. Keep a small real-time cancellation/deadline smoke test; do not lower production timeouts or just skip these assertions. The ongoing async-completion work in #2797 touches this class too, so I would coordinate/rebase that slice rather than mix it into a different feature.

    I would not enable broad test parallelism as the first step: Harness has a global MemoryBackgroundTasks tracker drained by an auto-registered after-each extension, and shared-resource concurrency fixtures already exercise deliberate races. Those need an isolation audit before changing the execution policy. The local module verification passed; no CI speedup or patch is claimed yet.

  3. xzxiaoshan commented on Oct 14, 2026

    @xzxiaoshan
    CollaboratorAuthor
  4. jujn commented on Oct 14, 2026

    @jujn
    Collaborator

    7. #3526 #3539

    其实也可以大规模简化下测试,目前来看至少可以删掉 1/3 的非必要测试

  5. added
    help wanted
    on Oct 14, 2026
  6. xzxiaoshan commented on Oct 14, 2026

    @xzxiaoshan
    CollaboratorAuthor
  7. aiyili commented on Oct 28, 2026

    @aiyili
    Contributor

    Hi, I'd like to help with this (help-wanted). To scope it concretely before writing code, I'll profile the current CI test execution (module-level times from recent run logs) and propose the highest-leverage, low-risk wins first — e.g. parallel surefire where modules are independent, splitting the long-pole module's suite, trimming redundant coverage re-runs — as an incremental PR series rather than one big build change. Initial analysis comment coming shortly, then PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions