File: catch2_test_debug.cu

package info (click to toggle)
cccl 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,248 kB
  • sloc: cpp: 264,457; python: 6,421; sh: 2,762; perl: 460; makefile: 114; xml: 13
file content (38 lines) | stat: -rw-r--r-- 1,038 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cub/util_debug.cuh>
#include <cub/util_device.cuh>

#include "catch2_test_helper.h"

TEST_CASE("CubDebug returns input error", "[debug][utils]")
{
  REQUIRE(CubDebug(cudaSuccess) == cudaSuccess);
  REQUIRE(CubDebug(cudaErrorInvalidConfiguration) == cudaErrorInvalidConfiguration);
}

TEST_CASE("CubDebug returns new errors", "[debug][utils]")
{
  cub::EmptyKernel<int><<<0, 0>>>();
  cudaError error = cudaPeekAtLastError();

  REQUIRE(error != cudaSuccess);
  REQUIRE(CubDebug(cudaSuccess) != cudaSuccess);
}

TEST_CASE("CubDebug prefers input errors", "[debug][utils]")
{
  cub::EmptyKernel<int><<<0, 0>>>();
  cudaError error = cudaPeekAtLastError();

  REQUIRE(error != cudaSuccess);
  REQUIRE(CubDebug(cudaErrorMemoryAllocation) != cudaSuccess);
}

TEST_CASE("CubDebug resets last error", "[debug][utils]")
{
  cub::EmptyKernel<int><<<0, 0>>>();
  cudaError error = cudaPeekAtLastError();

  REQUIRE(error != cudaSuccess);
  REQUIRE(CubDebug(cudaSuccess) != cudaSuccess);
  REQUIRE(CubDebug(cudaSuccess) == cudaSuccess);
}