Skip to content

Commit 5aa0916

Browse files
committed
refactor(tests): migrate to device-parametrized TEST_P infrastructure
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.
1 parent bf9aebe commit 5aa0916

28 files changed

+677
-2936
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[submodule "third_party/googletest"]
2+
path = third_party/googletest
3+
url = https://github.com/google/googletest.git
14
[submodule "third_party/glog"]
25
path = third_party/glog
36
url = https://github.com/google/glog.git

CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ option(USE_CUDA "Support NVIDIA CUDA" OFF)
44
option(PROFILE_MODE "ENABLE PROFILE MODE" OFF)
55
option(USE_OMP "Use OpenMP as backend for Eigen" ON)
66
option(USE_NCCL "Build project for distributed running" ON)
7-
option(BUILD_TEST "Build InfiniTrain tests" ON)
7+
option(BUILD_TEST "Build InfiniTrain tests" OFF)
88

99
project(infini_train VERSION 0.5.0 LANGUAGES CXX)
1010

@@ -16,17 +16,15 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1616
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1717

1818
# ------------------------------------------------------------------------------
19-
# GoogleTest (FetchContent)
19+
# GoogleTest (submodule)
2020
# ------------------------------------------------------------------------------
2121
if(BUILD_TEST)
22-
include(FetchContent)
23-
FetchContent_Declare(
24-
googletest
25-
GIT_REPOSITORY https://github.com/google/googletest.git
26-
GIT_TAG v1.14.0
27-
)
22+
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest/CMakeLists.txt)
23+
message(FATAL_ERROR "googletest submodule not found at third_party/googletest. "
24+
"Run: git submodule update --init third_party/googletest")
25+
endif()
2826
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
29-
FetchContent_MakeAvailable(googletest)
27+
add_subdirectory(third_party/googletest)
3028
enable_testing()
3129
endif()
3230

test/hook/test_hook.cc

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)