Skip to content

Add CTest labels for selective C++ test execution#1102

Open
rgsl888prabhu wants to merge 6 commits intoNVIDIA:mainfrom
rgsl888prabhu:feat/ctest-labels
Open

Add CTest labels for selective C++ test execution#1102
rgsl888prabhu wants to merge 6 commits intoNVIDIA:mainfrom
rgsl888prabhu:feat/ctest-labels

Conversation

@rgsl888prabhu
Copy link
Copy Markdown
Collaborator

@rgsl888prabhu rgsl888prabhu commented Apr 14, 2026

Summary

  • Add two CTest labels — routing and numopt — to all C++ test executables
  • Extend ConfigureTest() CMake macro with optional LABELS keyword (backward compatible)
Label Scope
routing VRP, TSP, distance engine (9 tests)
numopt LP, MIP, QP, dual simplex, MPS parser, gRPC, CLI (22 tests)

Usage

ctest -L routing    # only routing tests
ctest -L numopt     # only numerical optimization tests
ctest               # all (unchanged default)

Test plan

  • cmake --build succeeds
  • ctest -L routing runs only routing tests
  • ctest -L numopt runs only numopt tests
  • Full CI passes unchanged

…+ test execution

Add domain and tier labels to all 31 C++ test executables so that CI and
developers can run only the tests relevant to their changes.

Labels:
  - Domain: routing, solver (LP+MIP+QP umbrella), lp, mip, qp, grpc, parser, cli
  - Tier: tier1 (fast unit tests), tier2 (slow integration/benchmarks)

Changes:
  - Extend ConfigureTest() CMake macro with optional LABELS keyword argument
  - Add register_test_labels() helper and CUOPT_TEST_LABEL_ENTRIES global
    property to generate an installed test_labels.txt manifest
  - Add labels to every ConfigureTest call and manual add_test call
  - Update ci/run_ctests.sh to support CUOPT_TEST_LABELS env var for
    filtering (e.g. CUOPT_TEST_LABELS=routing runs only routing tests)
  - Fully backward compatible: no labels set means all tests run
- Remove tier1/tier2 labels — keep only domain labels for simplicity
- Add solver label to MPS_PARSER_TEST so CUOPT_TEST_LABELS=solver
  includes it alongside LP/MIP/QP tests
- Update run_ctests.sh docs to reflect final label set
@rgsl888prabhu rgsl888prabhu requested review from a team as code owners April 14, 2026 20:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 17ad69a9-4b25-4f81-8f0c-9736a8bc21f3

📥 Commits

Reviewing files that changed from the base of the PR and between a0d4711 and ace3bb0.

📒 Files selected for processing (8)
  • cpp/libmps_parser/tests/CMakeLists.txt
  • cpp/tests/CMakeLists.txt
  • cpp/tests/dual_simplex/CMakeLists.txt
  • cpp/tests/linear_programming/CMakeLists.txt
  • cpp/tests/linear_programming/grpc/CMakeLists.txt
  • cpp/tests/mip/CMakeLists.txt
  • cpp/tests/qp/CMakeLists.txt
  • cpp/tests/utilities/CMakeLists.txt
✅ Files skipped from review due to trivial changes (1)
  • cpp/libmps_parser/tests/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (6)
  • cpp/tests/qp/CMakeLists.txt
  • cpp/tests/utilities/CMakeLists.txt
  • cpp/tests/linear_programming/grpc/CMakeLists.txt
  • cpp/tests/dual_simplex/CMakeLists.txt
  • cpp/tests/CMakeLists.txt
  • cpp/tests/mip/CMakeLists.txt

📝 Walkthrough

Walkthrough

ConfigureTest CMake function gained optional LABELS parsing; many test registrations were updated to set CTest LABELS (mostly "numopt" or "routing"). No build/link/install behavior or source code logic was changed.

Changes

Cohort / File(s) Summary
CMake test infrastructure
cpp/tests/CMakeLists.txt
ConfigureTest() updated to parse optional LABELS keyword and use non-LABELS args as executable sources; when provided, sets CTest LABELS on the created test.
Parser tests
cpp/libmps_parser/tests/CMakeLists.txt
Added set_tests_properties(MPS_PARSER_TEST PROPERTIES LABELS "numopt").
Dual simplex
cpp/tests/dual_simplex/CMakeLists.txt
ConfigureTest(DUAL_SIMPLEX_TEST ...) updated to include LABELS numopt; SPDX year range updated.
Linear programming
cpp/tests/linear_programming/CMakeLists.txt, cpp/tests/linear_programming/grpc/CMakeLists.txt
Multiple tests updated to include LABELS numopt; gRPC tests (GRPC_CLIENT_TEST, GRPC_PIPE_SERIALIZATION_TEST, GRPC_INTEGRATION_TEST) now have set_tests_properties(... PROPERTIES LABELS "numopt").
MIP tests
cpp/tests/mip/CMakeLists.txt
All ConfigureTest(...) invocations were adjusted to add LABELS numopt.
QP tests
cpp/tests/qp/CMakeLists.txt
ConfigureTest(QP_UNIT_TEST ...) modified to include LABELS numopt.
Routing & distance
cpp/tests/routing/CMakeLists.txt, cpp/tests/distance_engine/CMakeLists.txt
Routing-related ConfigureTest(...) calls updated to include LABELS routing.
Utilities tests
cpp/tests/utilities/CMakeLists.txt
ConfigureTest(CLI_TEST test_cli.cpp) updated to include LABELS numopt.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding CTest labels to enable selective C++ test execution.
Description check ✅ Passed The description clearly explains the purpose, scope, labels, usage examples, and test plan, all directly related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ci/run_ctests.sh`:
- Around line 70-75: Token strings produced from CUOPT_TEST_LABELS and
test_labels (read into arrays requested/actual and iterated as req and act) may
contain leading/trailing whitespace, so trim both req and act before comparing
them to avoid false negatives; update the comparison in run_ctests.sh to
normalize (trim) whitespace from req and act (e.g., with bash parameter
expansion or a lightweight trim function) and then perform the equality check,
ensuring both sides are trimmed every loop.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92d3fd29-a6cb-48f4-85d3-b5fb562102dd

📥 Commits

Reviewing files that changed from the base of the PR and between 9fe95f2 and 867c4c6.

📒 Files selected for processing (11)
  • ci/run_ctests.sh
  • cpp/libmps_parser/tests/CMakeLists.txt
  • cpp/tests/CMakeLists.txt
  • cpp/tests/distance_engine/CMakeLists.txt
  • cpp/tests/dual_simplex/CMakeLists.txt
  • cpp/tests/linear_programming/CMakeLists.txt
  • cpp/tests/linear_programming/grpc/CMakeLists.txt
  • cpp/tests/mip/CMakeLists.txt
  • cpp/tests/qp/CMakeLists.txt
  • cpp/tests/routing/CMakeLists.txt
  • cpp/tests/utilities/CMakeLists.txt

Comment thread ci/run_ctests.sh Outdated
solver was ambiguous since routing is also a solver. mathopt
(mathematical optimization) clearly scopes the LP/MIP/QP/dual-simplex/parser
family.
@rgsl888prabhu rgsl888prabhu changed the title feat(tests): add CTest labels for selective C++ test execution Add CTest labels for selective C++ test execution Apr 14, 2026
@rgsl888prabhu rgsl888prabhu self-assigned this Apr 14, 2026
@rgsl888prabhu rgsl888prabhu added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Apr 14, 2026
@rgsl888prabhu rgsl888prabhu requested a review from mlubin April 14, 2026 21:09
@mlubin
Copy link
Copy Markdown
Contributor

mlubin commented Apr 15, 2026

The label choices seem good to me. They will probably evolve a bit over time.

I'm not sure I understand the need for the extra code to generate a test_labels.txt manifest. ctest --show-only=json-v1 prints a json file with all the information we need to map tests to labels.

@rgsl888prabhu
Copy link
Copy Markdown
Collaborator Author

The label choices seem good to me. They will probably evolve a bit over time.

I'm not sure I understand the need for the extra code to generate a test_labels.txt manifest. ctest --show-only=json-v1 prints a json file with all the information we need to map tests to labels.

I was thinking to use this for testing so if we are missing any label from testing so it can be raised, but this would be helpful as well. Will remove it for now.

Collapse all sub-domain labels into just routing and numopt.
Remove register_test_labels, global property, and test_labels.txt
manifest generation — keep only CTest labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants