Skip to content

[ML] Run all test suites in parallel via unified CTest invocation#2913

Merged
edsavage merged 1 commit intoelastic:mainfrom
edsavage:parallel-test-suites
Feb 23, 2026
Merged

[ML] Run all test suites in parallel via unified CTest invocation#2913
edsavage merged 1 commit intoelastic:mainfrom
edsavage:parallel-test-suites

Conversation

@edsavage
Copy link
Contributor

@edsavage edsavage commented Feb 20, 2026

Summary

  • Add cmake/run-all-tests-parallel.cmake — a CMake script that discovers ALL test cases from ALL 10 test suites and runs them in a single ctest --parallel pool
  • Add test_all_parallel CMake target that builds all tests then invokes the unified runner
  • Wire test_all_parallel into docker_entrypoint.sh (Linux x86_64) and build.gradle (macOS/Windows)

How it works

  1. For each of the 10 test suites, runs the executable with --list_content to discover test cases
  2. Groups test cases into batches of MAX_ARGS (default: 2) within each suite
  3. Generates a single CTestTestfile.cmake with all batches across all suites
  4. Runs ctest --parallel N where N = ceil(cpus/2) for >4 cores, 2 otherwise
  5. Merges JUnit results per suite for Buildkite test-collector compatibility

Key details

  • Batches stay within the same suite (each needs its own working directory and executable)
  • BOOST_TEST_OUTPUT_FORMAT_FLAGS is cleared during --list_content discovery to prevent JUnit logger interference, then restored for execution
  • Handles multi-config generators (Windows) by accepting a BUILD_TYPE variable for config-specific executable paths
  • Windows PATH and CPP_SRC_HOME are set for DLL discovery and resource files

Performance

Local benchmark (14-core Mac, MAX_PROCS=7, MAX_ARGS=2):

  • 1588 test cases across 10 suites
  • 797 batches, 100% passed
  • ~64 seconds wall-clock (vs several minutes sequential)

Test plan

  • Verified locally on macOS (100% pass, JUnit files produced)
  • CI: Linux x86_64 (Docker, docker_entrypoint.sh)
  • CI: Linux aarch64 (Docker, docker_entrypoint.sh)
  • CI: macOS aarch64 (Gradle, build.gradle)
  • CI: Windows x86_64 (Gradle, build.gradle)

Made with Cursor

Replace the sequential per-suite test execution with a single CTest
invocation that discovers all test cases across all 10 suites and
schedules them optimally across available CPU cores.

The new test_all_parallel target:
- Discovers 1588 test cases from all suites via --list_content
- Groups them into batches (MAX_ARGS=2) within each suite
- Runs all batches in a single ctest --parallel pool
- Produces per-suite JUnit files for Buildkite test-collector
- Handles multi-config generators (Windows) and BOOST_TEST_OUTPUT_FORMAT_FLAGS

Local benchmark (14-core Mac): 64s vs several minutes sequential.

Co-authored-by: Cursor <cursoragent@cursor.com>
@prodsecmachine
Copy link

prodsecmachine commented Feb 20, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Contributor

@valeriy42 valeriy42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@edsavage edsavage merged commit 7b89c1b into elastic:main Feb 23, 2026
11 checks passed
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Feb 26, 2026
…astic#2913)

Replace the sequential per-suite test execution with a single CTest
invocation that discovers all test cases across all 10 suites and
schedules them optimally across available CPU cores.

The new test_all_parallel target:
- Discovers 1588 test cases from all suites via --list_content
- Groups them into batches (MAX_ARGS=2) within each suite
- Runs all batches in a single ctest --parallel pool
- Produces per-suite JUnit files for Buildkite test-collector
- Handles multi-config generators (Windows) and BOOST_TEST_OUTPUT_FORMAT_FLAGS

Local benchmark (14-core Mac): 64s vs several minutes sequential.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants