diff --git a/include/alpaka/test/Check.hpp b/include/alpaka/test/Check.hpp index 6aa453fc83ef..1eb3ff4860ce 100644 --- a/include/alpaka/test/Check.hpp +++ b/include/alpaka/test/Check.hpp @@ -14,23 +14,26 @@ // TODO: SYCL doesn't have a way to detect if we're looking at device or host code. This needs a workaround so that // SYCL and other back-ends are compatible. #ifdef ALPAKA_ACC_SYCL_ENABLED -# define ALPAKA_CHECK(success, expression) \ +# define ALPAKA_CHECK_DO(success, expression, file, line) \ do \ { \ if(!(expression)) \ { \ - acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")'\n"; \ + acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \ + << "\n"; \ success = false; \ } \ } while(0) #else -# define ALPAKA_CHECK(success, expression) \ +# define ALPAKA_CHECK_DO(success, expression, file, line) \ do \ { \ if(!(expression)) \ { \ - printf("ALPAKA_CHECK failed because '!(%s)'\n", #expression); \ + printf("ALPAKA_CHECK failed because '!(%s)' in %s:%d\n", #expression, file, line); \ success = false; \ } \ } while(0) #endif + +#define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO(success, expression, __FILE__, __LINE__)