Skip to content

Commit adfc8a5

Browse files
committed
Add cuda exception smoke test
1 parent 6d34370 commit adfc8a5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/smoke_test/smoke_test.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ def check_nightly_binaries_date(package: str) -> None:
5656
)
5757

5858
def cuda_runtime_error():
59+
cuda_exception_missed=True
5960
try:
60-
torch._assert_async(torch.tensor(0, device='cuda'))
61-
torch._assert_async(torch.tensor(0 + 0j, device='cuda'))
62-
raise RuntimeError( f"Expected CUDA RuntimeError but have not received anything")
61+
torch._assert_async(torch.tensor(0, device="cuda"))
62+
torch._assert_async(torch.tensor(0 + 0j, device="cuda"))
6363
except RuntimeError as e:
64-
if re.search("CUDA", f'{e}'):
64+
if re.search("CUDA", f"{e}"):
6565
print(f"Caught CUDA exception with success: {e}")
66+
cuda_exception_missed = False
6667
else:
6768
raise(e)
68-
except Exception as e:
69-
raise(e)
69+
if(cuda_exception_missed):
70+
raise RuntimeError( f"Expected CUDA RuntimeError but have not received!")
7071

7172
def smoke_test_cuda(package: str) -> None:
7273
if not torch.cuda.is_available() and is_cuda_system:

0 commit comments

Comments
 (0)