Gromacs
2025-dev-20241008-cf8b9ef
|
#include <testutils/include/testutils/test_hardware_environment.h>
Inherits Environment.
This class performs one-time test initialization, enumerating the hardware.
Note that this class follows the approach of GoogleTest's Environment managers but we don't actually add it with AddGlobalTestEnvironment. That's because it would not work for the cases when we need information about the hardware present at run time to register tests dynamically. So instead we arrange for gmx::test::initTestUtils() and gmx::test::finalizeTestUtils() to call setupTestHardwareEnvironment() and tearDownTestHardwareEnvironment() manually.
Public Member Functions | |
const std::vector < std::unique_ptr< TestDevice > > & | getTestDeviceList () const |
Get available hardware contexts. | |
bool | hasCompatibleDevices () const |
Whether the available hardware has any compatible devices. | |
const gmx_hw_info_t * | hwinfo () const |
Get available hardware information. | |
Static Public Member Functions | |
static void | gmxSetUp () |
Set up the test hardware environment. More... | |
static void | gmxTearDown () |
Tear down the test hardware environment. | |
|
static |
Set up the test hardware environment.
We'd like to use GoogleTest's environment setup for this, but when registering test dynamically we need the information before GoogleTest would make it available. So instead we always handle it ourselves, for simplicity.
Should only be called once per test binary.