Skip to content

test: add error-path coverage for cuda_utils and related regression check#1776

Open
rluo8 wants to merge 1 commit intoNVIDIA:mainfrom
rluo8:main
Open

test: add error-path coverage for cuda_utils and related regression check#1776
rluo8 wants to merge 1 commit intoNVIDIA:mainfrom
rluo8:main

Conversation

@rluo8
Copy link
Contributor

@rluo8 rluo8 commented Mar 17, 2026

This is to add error path coverage to increate the coverage for cuda_core.
The tests are mainly used to cover the error handling path.

The coverage data is running locally on Linux and Windows A10 system.
cuda/core/_utils/cuda_utils.pyx from 69.91% to 92.04%
cuda/core/clear_error_support.py from 75% to 100%
cuda/core/_kernel_arg_handler.pyx from 76.1% to 79.51%

@rluo8
Copy link
Contributor Author

rluo8 commented Mar 17, 2026

Hi @mdboom , could you please help review it ?
Thanks!

@github-actions
Copy link

@mdboom
Copy link
Contributor

mdboom commented Mar 17, 2026

/ok to test

Copy link
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

One small suggested change. Other than that, LGTM, assuming the tests pass.

def test_check_nvrtc_error_with_handle(init_cuda):
from cuda.bindings import nvrtc

_, prog = nvrtc.nvrtcCreateProgram(b"invalid code!@#$", b"test.cu", 0, [], [])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_, prog = nvrtc.nvrtcCreateProgram(b"invalid code!@#$", b"test.cu", 0, [], [])
err, prog = nvrtc.nvrtcCreateProgram(b"invalid code!@#$", b"test.cu", 0, [], [])
assert err == nvrtc.nvrtcResult.NVRTC_SUCCESS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the codes. The tests could pass in local run.
../../../../cuda_core/tests/test_cuda_utils.py::test_check_nvrtc_error_with_handle PASSED
......\cuda_core\tests\test_cuda_utils.py::test_check_nvrtc_error_with_handle PASSED

@mdboom
Copy link
Contributor

mdboom commented Mar 17, 2026

/ok to test

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Mar 18, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@rluo8 rluo8 reopened this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants