-
Notifications
You must be signed in to change notification settings - Fork 44
【训练营】基于 CTest + gtest 的测试体系搭建与工程化集成 #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| [submodule "third_party/glog"] | ||
| path = third_party/glog | ||
| url = git@github.com:google/glog.git | ||
| url = https://github.com/google/glog.git | ||
| [submodule "third_party/gflags"] | ||
| path = third_party/gflags | ||
| url = git@github.com:gflags/gflags.git | ||
| url = https://github.com/gflags/gflags.git | ||
| [submodule "third_party/eigen"] | ||
| path = third_party/eigen | ||
| url = git@github.com:InfiniTensor/eigen-mirror.git | ||
| url = https://github.com/eigenteam/eigen-git-mirror.git |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Tests CMakeLists.txt | ||
| # This file manages the test infrastructure for InfiniTrain | ||
|
|
||
| # Include shared test macros (must be before any test subdirectory) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/common/test_macros.cmake) | ||
|
|
||
| # Common test utilities | ||
| add_subdirectory(common) | ||
|
|
||
| # Tensor tests | ||
| add_subdirectory(tensor) | ||
|
|
||
| # Optimizer tests | ||
| add_subdirectory(optimizer) | ||
|
|
||
| # Autograd operator tests | ||
| add_subdirectory(autograd) | ||
|
|
||
| # LoRA tests | ||
| add_subdirectory(lora) | ||
|
|
||
| # Hook tests | ||
| add_subdirectory(hook) | ||
|
|
||
| # Slow label tests | ||
| add_subdirectory(slow) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # ============================================================================ | ||
| # Autograd tests | ||
| # ============================================================================ | ||
| # 重构版本:使用 infini_train_add_test 宏简化配置 | ||
| # | ||
| # 新增测试只需 1 行: | ||
| # infini_train_add_test(test_name SOURCES test_name.cc LABELS cpu) | ||
|
||
| # ============================================================================ | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Elementwise tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_elementwise_forward SOURCES test_autograd_elementwise_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_elementwise_backward SOURCES test_autograd_elementwise_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Matmul tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_matmul_forward SOURCES test_autograd_matmul_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_matmul_backward SOURCES test_autograd_matmul_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Reduction tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_reduction_forward SOURCES test_autograd_reduction_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_reduction_backward SOURCES test_autograd_reduction_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Linear tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_linear_forward SOURCES test_autograd_linear_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_linear_backward SOURCES test_autograd_linear_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Softmax tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_softmax_forward SOURCES test_autograd_softmax_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_softmax_backward SOURCES test_autograd_softmax_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Transform tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_transform_forward SOURCES test_autograd_transform_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_transform_backward SOURCES test_autograd_transform_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Normalization tests | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_normalization_forward SOURCES test_autograd_normalization_forward.cc LABELS cpu) | ||
| infini_train_add_test(test_autograd_normalization_backward SOURCES test_autograd_normalization_backward.cc LABELS cpu) | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Legacy combined tests | ||
| # 注意:使用 gtest_discover_tests,所有 TEST_F 都会被自动发现 | ||
| # ----------------------------------------------------------------------------- | ||
| infini_train_add_test(test_autograd_legacy SOURCES test_autograd.cc LABELS cpu cuda distributed) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这版的风险是新增测试的接入成本和漏配风险都比较高。新增一个普通 autograd CPU 测试,至少要手动写:
建议简化。例如把功能整合到一个函数里,新增测试只调用一次;或者考虑使用gtest_discover_tests,不用再手工写 add_test() 和 set_tests_properties()