|
5 | 5 | # this software. Any use, reproduction, disclosure, or distribution of |
6 | 6 | # this software and related documentation outside the terms of the EULA |
7 | 7 | # is strictly prohibited. |
8 | | -import os |
9 | 8 | import platform |
10 | 9 | import shutil |
11 | 10 | import textwrap |
12 | 11 |
|
13 | 12 | import numpy as np |
14 | 13 | import pytest |
| 14 | +from conftest import skipif_compute_sanitizer_is_running |
15 | 15 |
|
16 | 16 | import cuda.cuda as cuda |
17 | 17 | import cuda.cudart as cudart |
@@ -84,10 +84,7 @@ def test_cuda_memcpy(): |
84 | 84 | assert err == cuda.CUresult.CUDA_SUCCESS |
85 | 85 |
|
86 | 86 |
|
87 | | -@pytest.mark.skipif( |
88 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
89 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
90 | | -) |
| 87 | +@skipif_compute_sanitizer_is_running |
91 | 88 | def test_cuda_array(): |
92 | 89 | (err,) = cuda.cuInit(0) |
93 | 90 | assert err == cuda.CUresult.CUDA_SUCCESS |
@@ -241,10 +238,7 @@ def test_cuda_uuid_list_access(): |
241 | 238 | assert err == cuda.CUresult.CUDA_SUCCESS |
242 | 239 |
|
243 | 240 |
|
244 | | -@pytest.mark.skipif( |
245 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
246 | | - reason="FIXME: This test causes an API error.", |
247 | | -) |
| 241 | +@skipif_compute_sanitizer_is_running |
248 | 242 | def test_cuda_cuModuleLoadDataEx(): |
249 | 243 | (err,) = cuda.cuInit(0) |
250 | 244 | assert err == cuda.CUresult.CUDA_SUCCESS |
@@ -632,10 +626,7 @@ def test_cuda_coredump_attr(): |
632 | 626 | assert err == cuda.CUresult.CUDA_SUCCESS |
633 | 627 |
|
634 | 628 |
|
635 | | -@pytest.mark.skipif( |
636 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
637 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
638 | | -) |
| 629 | +@skipif_compute_sanitizer_is_running |
639 | 630 | def test_get_error_name_and_string(): |
640 | 631 | (err,) = cuda.cuInit(0) |
641 | 632 | assert err == cuda.CUresult.CUDA_SUCCESS |
@@ -964,10 +955,7 @@ def test_CUmemDecompressParams_st(): |
964 | 955 | assert int(desc.dstActBytes) == 0 |
965 | 956 |
|
966 | 957 |
|
967 | | -@pytest.mark.skipif( |
968 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
969 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
970 | | -) |
| 958 | +@skipif_compute_sanitizer_is_running |
971 | 959 | def test_all_CUresult_codes(): |
972 | 960 | max_code = int(max(cuda.CUresult)) |
973 | 961 | # Smoke test. CUDA_ERROR_UNKNOWN = 999, but intentionally using literal value. |
@@ -1000,30 +988,21 @@ def test_all_CUresult_codes(): |
1000 | 988 | assert num_good >= 76 # CTK 11.0.3_450.51.06 |
1001 | 989 |
|
1002 | 990 |
|
1003 | | -@pytest.mark.skipif( |
1004 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
1005 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
1006 | | -) |
| 991 | +@skipif_compute_sanitizer_is_running |
1007 | 992 | def test_cuKernelGetName_failure(): |
1008 | 993 | err, name = cuda.cuKernelGetName(0) |
1009 | 994 | assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE |
1010 | 995 | assert name is None |
1011 | 996 |
|
1012 | 997 |
|
1013 | | -@pytest.mark.skipif( |
1014 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
1015 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
1016 | | -) |
| 998 | +@skipif_compute_sanitizer_is_running |
1017 | 999 | def test_cuFuncGetName_failure(): |
1018 | 1000 | err, name = cuda.cuFuncGetName(0) |
1019 | 1001 | assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE |
1020 | 1002 | assert name is None |
1021 | 1003 |
|
1022 | 1004 |
|
1023 | | -@pytest.mark.skipif( |
1024 | | - os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1", |
1025 | | - reason="The compute-sanitizer is running, and this test intentionally causes an API error.", |
1026 | | -) |
| 1005 | +@skipif_compute_sanitizer_is_running |
1027 | 1006 | @pytest.mark.skipif( |
1028 | 1007 | driverVersionLessThan(12080) or not supportsCudaAPI("cuCheckpointProcessGetState"), |
1029 | 1008 | reason="When API was introduced", |
|
0 commit comments