Skip to content

Commit

Permalink
Switch death test to use explicit trap. (NVIDIA#11326)
Browse files Browse the repository at this point in the history
This change should make the test fail reliably, whereas the current approach is flaky and leads to not infrequent test failures.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Jake Hemstad (https://github.com/jrhemstad)
  - Nghia Truong (https://github.com/ttnghia)
  - Bradley Dice (https://github.com/bdice)

URL: rapidsai/cudf#11326
  • Loading branch information
vyasr authored Jul 21, 2022
1 parent 7580153 commit 719f4c8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cpp/tests/error/error_handling_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,13 @@ TEST(StreamCheck, CatchFailedKernel)
"invalid configuration argument");
}

__global__ void kernel(int* p) { *p = 42; }
__global__ void kernel() { asm("trap;"); }

TEST(DeathTest, CudaFatalError)
{
testing::FLAGS_gtest_death_test_style = "threadsafe";
auto call_kernel = []() {
int* p;
cudaMalloc(&p, 2 * sizeof(int));
int* misaligned = (int*)(reinterpret_cast<char*>(p) + 1);
kernel<<<1, 1>>>(misaligned);
kernel<<<1, 1>>>();
try {
CUDF_CUDA_TRY(cudaDeviceSynchronize());
} catch (const cudf::fatal_cuda_error& fe) {
Expand Down

0 comments on commit 719f4c8

Please sign in to comment.