Skip to content

[ML] Replace shell test runner with portable CMake/CTest infrastructure#2903

Open
edsavage wants to merge 1 commit intoelastic:mainfrom
edsavage:portable-test-infrastructure
Open

[ML] Replace shell test runner with portable CMake/CTest infrastructure#2903
edsavage wants to merge 1 commit intoelastic:mainfrom
edsavage:portable-test-infrastructure

Conversation

@edsavage
Copy link
Contributor

Summary

  • Replace run_tests_as_seperate_processes.sh with a portable CMake/CTest-based parallel test runner (cmake/run-tests-individually.cmake)
  • Works across Linux, macOS, and Windows (including multi-config generators)
  • Tune test parallelism: -j 2 for <=4 cores, ceil(ncpus/2) for higher counts
  • Fix CMultiFileDataAdderTest parallel isolation using PID instead of random numbers
  • Wire up test_individually target in Gradle for CI

Test plan

  • Verified on Linux x86_64, Linux aarch64, macOS aarch64, Windows x86_64
  • Benchmarked parallelism across platforms to find optimal -j values
  • Confirmed CKMostCorrelatedTest/testScale passes reliably at -j 2 on 4-core machines

Made with Cursor

@prodsecmachine
Copy link

prodsecmachine commented Feb 19, 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.

@edsavage edsavage force-pushed the portable-test-infrastructure branch from c40dc83 to b18aaf5 Compare March 9, 2026 22:00
Replace run_tests_as_seperate_processes.sh with a portable CMake script
(cmake/run-tests-individually.cmake) that works on Linux, macOS and
Windows without requiring bash, sed, awk or xargs.

The new script discovers Boost.Test cases via --list_content, generates
a temporary CTest project, and runs them in parallel via ctest --parallel.
It supports the same environment variables as the old shell script
(BOOST_TEST_MAX_ARGS, BOOST_TEST_MAX_PROCS, BOOST_TEST_OUTPUT_FORMAT_FLAGS)
plus TEST_FLAGS for additional flags.

Other changes:
- Add include(CTest) to CMakeLists.txt and rename custom "test" target
  to "ml_test" to avoid conflict with CTest's built-in target
- Upgrade add_test() to modern NAME/COMMAND form with JUNIT output and
  WORKING_DIRECTORY
- Fix CMultiFileDataAdderTest parallel isolation: use PID instead of a
  random number in [1,100] for unique temp filenames, eliminating the
  collision risk that caused intermittent test failures
- Handle seccomp test specially (force HRF logging to avoid sandbox I/O
  restrictions)
- Consolidate isMultiConfig branches for test_individually targets

Made-with: Cursor
@edsavage edsavage force-pushed the portable-test-infrastructure branch from d55a944 to 0d4d137 Compare March 9, 2026 23:08
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.

2 participants