Gromacs  2025-dev-20241008-cf8b9ef
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions
gmx::test::TestHardwareEnvironment Class Reference

#include <testutils/include/testutils/test_hardware_environment.h>

Inherits Environment.

Description

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.
 

Member Function Documentation

void gmx::test::TestHardwareEnvironment::gmxSetUp ( )
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.


The documentation for this class was generated from the following files: