225 bool ret = ptr != NULL;
241 bool ret = ptr == NULL;
251 int ctlfd = STDOUT_FILENO;
255 bool ret = ptr == NULL;
269 bool ret = ptr == NULL;
349 const uint32_t NUM_TESTS = 11;
351 const std::string test_names[] = {
352 "RM Version Check Ok",
353 "RM Version Check Incorrect",
354 "RM Version Check Ignore",
356 "RM Alloc Root Fail (Invalid FD)",
357 "RM Alloc Root Fail (Bad FD)",
358 "RM Alloc Root Fail (Bad Argument)",
360 "RM Free Root Fail (Invalid FD)",
361 "RM Free Root Fail (Double Deallocate)",
364 const std::string test_details[] = {
365 "Ensure your version check is correctly: " RM_VERSION,
366 "Invalid version is reported correctly, please check your driver version.",
367 "Ignored version is reported incorrectly, please check your driver version.",
368 "RM Alloc Root failed, check driver version.",
369 "RM Alloc Root succeeded, SHOULD NOT BE POSSIBLE.",
370 "RM Alloc Root succeeded, SHOULD NOT BE POSSIBLE.",
371 "RM Alloc Root succeeded, SHOULD NOT BE POSSIBLE.",
372 "RM Free Root failed, check driver version.",
373 "RM Free Root succeded, SHOULD NOT BE POSSIBLE.",
374 "RM Free Root succeded, SHOULD NOT BE POSSIBLE.",
375 "No GPU Ids were found."
378 bool (*tests[])(void) = {
392 uint32_t failures = 0;
394 for (uint32_t i = 0; i < NUM_TESTS; ++i) {
395 bool test_result = tests[i]() == 1;
403 <<
": " << test_details[i]
uint8_t rm_version_check(int ctl_fd, uint8_t ignore_version, const char *version)
Version check for the RM API.
#define RM_CTRL(fd, res, cmd, data)
Controls a RM Resource.
struct NvResource * rm_alloc_res(int fd, struct NvResource *parent, uint32_t object, uint32_t rm_class, void *data)
Allocates a Node for a resource.
uint8_t rm_free_res(int fd, struct NvResource *object)
Frees a Node for a Resource.
#define RED_COLOR
Red color.
#define GREEN_COLOR
Green color.
#define RESET_COLOR
Reset color.
int nv_open_dev(uint16_t minor)
Opens a traditional NVIDIA device.
#define NV0000_GET_PROBED_IDS
Command for rm control res to get a list of all probed ids.
bool free_root_invalid_fd()
bool alloc_root_bad_arg()
bool alloc_root_invalid_fd()
bool version_check_ignore()
bool free_root_double_deallocate()
Gets a list of all probed Ids.
uint32_t gpu_ids[32]
GPU IDs available.
Resource for managing NVIDIA kernel module objects.