1.3.72
 
Loading...
Searching...
No Matches
test_helpers.h File Reference
#include <memory>
#include <cstdlib>
#include <iostream>
#include <stdexcept>

Go to the source code of this file.

Data Structures

class  helios::TestVulkanDeviceManager
 Shared Vulkan device singleton for test process. More...
 

Macros

#define GPU_TEST_CASE_IMPL(name, unique_inner)
 
#define GPU_TEST_CASE(name)    GPU_TEST_CASE_IMPL(name, DOCTEST_ANONYMOUS(DOCTEST_ANON_GPU_FUNC_))
 

Detailed Description

Test-only utilities for radiation test suite.

Copyright (C) 2016-2026 Brian Bailey

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file test_helpers.h.

Macro Definition Documentation

◆ GPU_TEST_CASE

#define GPU_TEST_CASE (   name)     GPU_TEST_CASE_IMPL(name, DOCTEST_ANONYMOUS(DOCTEST_ANON_GPU_FUNC_))

Definition at line 190 of file test_helpers.h.

◆ GPU_TEST_CASE_IMPL

#define GPU_TEST_CASE_IMPL (   name,
  unique_inner 
)
Value:
static void unique_inner(); \
DOCTEST_TEST_CASE(name) { \
if (!RadiationModelTestHelper::isGPUAvailable()) { \
DOCTEST_MESSAGE("SKIPPED: No GPU/Vulkan device available"); \
return; \
} \
try { \
unique_inner(); \
} catch (const std::exception &_gpu_ex) { \
std::string _gpu_msg(_gpu_ex.what()); \
if (_gpu_msg.find("DEVICE_LOST") != std::string::npos || \
_gpu_msg.find("VkResult: -4") != std::string::npos || \
_gpu_msg.find("VkResult: -9") != std::string::npos) { \
TestVulkanDeviceManager::markGPURuntimeFailed(); \
std::cout << "[Vulkan Test] GPU device lost: " << _gpu_msg << std::endl; \
std::cout << "[Vulkan Test] Remaining GPU tests will be skipped." << std::endl; \
DOCTEST_MESSAGE("SKIPPED: GPU device lost during execution"); \
return; \
} \
throw; \
} \
} \
static void unique_inner()

Definition at line 163 of file test_helpers.h.