Skip to content

Commit ab6db22

Browse files
committed
test_all_CUresult_codes(): max_code = int(max(cuda.CUresult)) as suggested by at-leofang
1 parent 6d45bda commit ab6db22

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cuda_bindings/tests/test_cuda.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,12 @@ def test_CUmemDecompressParams_st():
950950
assert int(desc.dstActBytes) == 0
951951

952952

953-
def test_all_CUresult_codes(max_code=1000):
953+
def test_all_CUresult_codes():
954+
max_code = int(max(cuda.CUresult))
955+
# Smoke test. CUDA_ERROR_UNKNOWN = 999, but intentionally using literal value.
956+
assert max_code >= 999
954957
num_good = 0
955-
for code in range(max_code + 1):
958+
for code in range(max_code + 2): # One past max_code
956959
try:
957960
error = cuda.CUresult(code)
958961
except ValueError:
@@ -973,7 +976,7 @@ def test_all_CUresult_codes(max_code=1000):
973976
err_desc, desc = cuda.cuGetErrorString(error)
974977
assert err_desc == cuda.CUresult.CUDA_ERROR_INVALID_VALUE
975978
assert desc is None
976-
# Super-simple smoke check: Do we have at least some "good" codes?
979+
# Smoke test: Do we have at least some "good" codes?
977980
# The number will increase over time as new enums are added and support for
978981
# old CTKs is dropped, but it is not critical that this number is updated.
979982
assert num_good >= 76 # CTK 11.0.3_450.51.06

0 commit comments

Comments
 (0)