GVM User Suite
User tools for the GVM open source project.
Device Creation Test

This code is designed to serve as a test bed for determining if the device creation code is working as intended by all components. The following tests are implemented:

  1. Device Check Test - Determines if the system has a particular file.
  2. Device Major Number Identifier Null - Determines the major number for a known device.
  3. Device Major Number Identifier Ok - Determines the major number for a known device.
  4. Nvidia Specific Tests - Tests specifically designed for determine Nvidia GPUs.
    1. DeviceFileMode Nvidia Check - Gets the parameter for DeviceFileMode
    2. Open /dev/nvidiactl File - Open the nvidiactl file.
    3. Open /dev/nvidia File - Open a nvidia%d file.

Device Check Test

This test simply checks that the tty device is properly created and attached to the system. The pseudo-code that is executed to determine if this test is a success is:

device_exists("/dev/tty") && device_exists("tty")
uint8_t device_exists(const char *device_name)
Does a device file exist?
Definition: device.c:30

Device Major Number Identifier Null

This test determines if we can correctly select -1 for an invalid number for special device files. The pseudo-code that is executed to determine if this test is a success is:

get_major("invalid-gvm") == -1
int32_t get_major(const char *device)
Gets the device major id from /proc/devices.
Definition: device.c:42

Device Major Number Identifier Ok

This test determines if we can correctly select the major number for special device files. The pseudo-code that is executed to determine if this test is a success is:

get_major("mem") == 1

Nvidia Specific Tests

These tests are specifically designed to test the Nvidia device creations.

DeviceFileMode Nvidia Check

This test determines if the device file mode we get for the nvidia device is structured correctly. The pseudo-code that is executed to determine if this test is a success is:

get_param("/proc/driver/nvidia/params", "DeviceFileMode") == 438
int32_t get_param(const char *filename, const char *parameter)
Gets a parameter from a driver param file.
Definition: device.c:71

Open /dev/nvidiactl File

This code determines if we can open the nvidiactl file.

NOTE: Creates the file if the file does not exist.

Open /dev/nvidia File

This code determines if we can open the nvidia%d file.

NOTE: Creates the file if the file does not exist.