Skip to content

Commit 7ff9fd3

Browse files
authored
Test: Split C++ unit tests for CI granularity (#3868)
Signed-off-by: Dom Brown <[email protected]>
1 parent 6ac1a54 commit 7ff9fd3

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

cpp/tests/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ add_subdirectory(unit_tests)
7373

7474
add_gtest(mpiUtilsTest runtime/mpiUtilsTest.cpp)
7575

76-
add_gtest(loraManagerTest runtime/loraManagerTest.cpp)
77-
add_gtest(loraCacheTest runtime/loraCacheTest.cpp)
7876
add_gtest(gptDecoderTest runtime/gptDecoderTest.cpp)
7977
add_gtest(gptDecoderBatchedTest runtime/gptDecoderBatchedTest.cpp)
8078
add_gtest(gptSessionTest runtime/gptSessionTest.cpp)

cpp/tests/unit_tests/runtime/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ add_gtest(cudaMemPoolTest cudaMemPoolTest.cpp)
1414
add_gtest(decodingLayerWorkspaceTest decodingLayerWorkspaceTest.cpp)
1515
add_gtest(iBufferTest iBufferTest.cpp)
1616
add_gtest(iTensorTest iTensorTest.cpp)
17+
add_gtest(loraCacheTest loraCacheTest.cpp)
18+
add_gtest(loraManagerTest loraManagerTest.cpp)
1719
add_gtest(loraUtilsTest loraUtilsTest.cpp)
1820
add_gtest(runtimeKernelTest runtimeKernelTest.cpp)
1921
add_gtest(samplingConfigTest samplingConfigTest.cpp)

tests/integration/defs/cpp_common.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@
4141
}
4242

4343

44-
def generate_excluded_model_tests() -> Generator[str, None, None]:
45-
yield "Gpt[^j]"
46-
yield "GptExecutor"
47-
yield "Gptj"
48-
yield "Llama"
49-
yield "ChatGlm"
50-
yield "Medusa"
51-
yield "Eagle"
52-
yield "ExplicitDraftTokensDecoding"
53-
yield "Mamba"
54-
yield "RecurrentGemma"
55-
yield "Encoder"
56-
yield "EncDec"
57-
yield "SpeculativeDecoding"
58-
59-
6044
def generate_included_model_tests(
6145
test_list: List[str]) -> Generator[str, None, None]:
6246

tests/integration/defs/test_cpp.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,24 @@ def _run(
301301

302302
@pytest.mark.parametrize("build_google_tests", ["80", "86", "89", "90"],
303303
indirect=True)
304-
def test_unit_tests(build_google_tests, build_dir, lora_setup):
304+
@pytest.mark.parametrize("test_group", [
305+
"batch_manager", "common", "executor", "kernels", "layers", "runtime",
306+
"thop", "utils"
307+
])
308+
def test_unit_tests(build_google_tests, test_group, build_dir, lora_setup):
309+
310+
xml_name = f"results-unit-tests-{test_group}.xml"
305311

306312
# Discover and run the actual gtests
307313
ctest_command = [
308314
"ctest",
309315
"--output-on-failure",
316+
"--test-dir",
317+
f"{build_dir}/tests/unit_tests/{test_group}",
310318
"--output-junit",
311-
"results-unit-tests.xml",
319+
f"{build_dir}/{xml_name}",
312320
]
313321

314-
excluded_tests = list(_cpp.generate_excluded_model_tests())
315-
316-
ctest_command.extend(["-E", "|".join(excluded_tests)])
317-
318322
parallel = _cpp.default_test_parallel
319323
if parallel_override := _os.environ.get("LLM_TEST_PARALLEL_OVERRIDE", None):
320324
parallel = int(parallel_override)

tests/integration/test_lists/test-db/l0_a30.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ l0_a30:
3939
backend: cpp
4040
tests:
4141
# ------------- CPP tests ---------------
42-
- test_cpp.py::test_unit_tests[80]
42+
- test_cpp.py::test_unit_tests[batch_manager-80]
43+
- test_cpp.py::test_unit_tests[common-80]
44+
- test_cpp.py::test_unit_tests[executor-80]
45+
- test_cpp.py::test_unit_tests[kernels-80]
46+
- test_cpp.py::test_unit_tests[layers-80]
47+
- test_cpp.py::test_unit_tests[runtime-80]
48+
- test_cpp.py::test_unit_tests[thop-80]
49+
- test_cpp.py::test_unit_tests[utils-80]
4350
- test_cpp.py::test_model[gpt-80]
4451
- test_cpp.py::test_model[gpt_executor-80]
4552
- test_cpp.py::test_model[gpt_tests-80]

tests/integration/test_lists/test-db/l0_h100.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ l0_h100:
7272
backend: cpp
7373
tests:
7474
# ------------- CPP tests ---------------
75-
- test_cpp.py::test_unit_tests[90]
75+
- test_cpp.py::test_unit_tests[batch_manager-90]
76+
- test_cpp.py::test_unit_tests[common-90]
77+
- test_cpp.py::test_unit_tests[executor-90]
78+
- test_cpp.py::test_unit_tests[kernels-90]
79+
- test_cpp.py::test_unit_tests[layers-90]
80+
- test_cpp.py::test_unit_tests[runtime-90]
81+
- test_cpp.py::test_unit_tests[thop-90]
82+
- test_cpp.py::test_unit_tests[utils-90]
7683
- test_cpp.py::test_model[fp8-llama-90]
7784
- test_cpp.py::test_model[t5-90]
7885
- test_cpp.py::test_benchmarks[t5-90]

0 commit comments

Comments
 (0)