Skip to content

[FEA]: Migrate fail test utilities to top-level; reuse between projects #2879

Description

@gevtushenko

Is this a duplicate?

Area

General CCCL

Is your feature request related to a problem? Please describe.

CUB tests are able to have fail tests:

_cub_is_fail_test(is_fail_test "${test_src}")
if (is_fail_test)
set_target_properties(${test_target} PROPERTIES EXCLUDE_FROM_ALL true
EXCLUDE_FROM_DEFAULT_BUILD true)
add_test(NAME ${test_target}
COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}"
--target ${test_target}
--config $<CONFIGURATION>)
string(REGEX MATCH "err_([0-9]+)" MATCH_RESULT "${test_name}")
file(READ ${test_src} test_content)
if(MATCH_RESULT)
string(REGEX MATCH "// expected-error-${CMAKE_MATCH_1}+ {{\"([^\"]+)\"}}" expected_errors_matches ${test_content})
if (expected_errors_matches)
set_tests_properties(${test_target} PROPERTIES PASS_REGULAR_EXPRESSION "${CMAKE_MATCH_1}")
else()
set_tests_properties(${test_target} PROPERTIES WILL_FAIL true)
endif()
else()
string(REGEX MATCH "// expected-error {{\"([^\"]+)\"}}" expected_errors_matches ${test_content})
if (expected_errors_matches)
set_tests_properties(${test_target} PROPERTIES PASS_REGULAR_EXPRESSION "${CMAKE_MATCH_1}")
else()
set_tests_properties(${test_target} PROPERTIES WILL_FAIL true)
endif()
endif()
else()

Describe the solution you'd like

We should consider hoisting this functionality to the CCCL level, and use it for compilation errors testing in cudax and Thrust.

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. moved this from Todo to In Progress in CCCLon Dec 3, 2025
  2. self-assigned this
    on Dec 3, 2025
  3. added
    infra
    devex
    on Jan 13, 2026
  4. moved this from In Progress to Paused in CCCLon Jan 13, 2026
  5. removed
    devex
    on Jan 14, 2026
  6. changed the issue type fromtoon Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infra

Type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions