Skip to content

[WIP]Feat(tests): build test infrastructure#144

Open
chen2021673 wants to merge 6 commits intomasterfrom
CTest-clean
Open

[WIP]Feat(tests): build test infrastructure#144
chen2021673 wants to merge 6 commits intomasterfrom
CTest-clean

Conversation

@chen2021673
Copy link
Copy Markdown
Contributor

@chen2021673 chen2021673 commented Apr 14, 2026

Summary

This PR refactors InfiniTrain’s test infrastructure around CTest and GoogleTest.

It consolidates the old test/ and tests/ layout into a single tests/ directory, introduces shared CMake utilities for test registration, and migrates applicable tests to device-parameterized TEST_P so CPU/CUDA cases can share the same test logic where appropriate.

Closes #120.

Changes

  • merge the old test/ directory into tests/
  • add shared CMake/GTest utilities under tests/common/
  • reduce repeated test registration boilerplate in per-suite CMakeLists.txt
  • migrate applicable tests from fixed-device TEST_F to device-parameterized TEST_P
  • replace hardcoded device selection with shared helpers such as GetDevice()
  • improve label-based selection for CPU/CUDA-related tests
  • refactor registration for all tests

How to run

ctest --output-on-failure
ctest -L cpu --output-on-failure
ctest -L cuda --output-on-failure

Impact

This is mainly a test infrastructure refactor. It is not intended to change training/runtime behavior, but it does change how tests are organized and registered.

Result

ctest --output-on-failure -j1 (并行可能抢占,先串行)

image

luoyueyuguang and others added 4 commits April 22, 2026 09:54
- Add infini_train_add_test CMake macro for simplified test registration
- Integrate gtest_discover_tests for automatic test case discovery
- Refactor all test directories to use unified macro (autograd, optimizer, hook, slow, lora)
- Reduce test CMakeLists.txt code by 68%
- Add LoRA tests (12 test cases)
- Delete TEST_REPORT.md
- Test labels: cpu/cuda/distributed/slow for flexible test execution
- Add shared test_macros.cmake in tests/common/

BREAKING CHANGE: Test registration now uses macro instead of manual add_test()

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Replace TEST_F with TEST_P across all test suites so each suite runs on
both CPU and CUDA without duplicating test logic. Adds InfiniTrainTestP,
TensorTestBaseP, AutogradTestBaseP, and DistributedInfiniTrainTestP base
classes with automatic CUDA/NCCL skip guards. Introduces
INFINI_TRAIN_REGISTER_TEST* C++ macros and infini_train_add_test_suite
CMake macro to eliminate repetitive INSTANTIATE_TEST_SUITE_P /
infini_train_add_test boilerplate. Removes deprecated test/, slow/, and
split optimizer test files; consolidates optimizer tests into a single
binary with creation  + step suites.
@chen2021673 chen2021673 force-pushed the CTest-clean branch 5 times, most recently from c29f9bc to 1f15e00 Compare April 23, 2026 06:41
- Simplify CMakeLists: single CTest target per suite, remove label splitting
- Migrate old test/ directory into tests/ and delete test/
…structure - Simplify CMakeLists: single CTest target per suite, remove label splitting - Migrate old test/ directory into tests/ and delete test/
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