umockdev

umockdev — Build a test bed for testing software that handles Linux hardware devices.

Types and Values

Object Hierarchy

    GObject
    ╰── UMockdevTestbed

Description

Please see README.md about an overview of the parts of umockdev, and how they fit together.

Functions

Types and Values

struct UMockdevTestbed

struct UMockdevTestbed;

The UMockdevTestbed class builds a temporary sandbox for mock devices. You can add a number of devices including arbitrary sysfs attributes and udev properties, and then run your software in that test bed that is independent of the actual hardware it is running on. With this you can simulate particular hardware in virtual environments up to some degree, without needing any particular privileges or disturbing the whole system.

You can either add devices by specifying individual device paths, properties, and attributes, or use the umockdev-record tool to create a human readable/editable record of a real device (and all its parents) and load that into the testbed with umockdev_testbed_add_from_string().

Instantiating a UMockdevTestbed object creates a temporary directory with an empty sysfs tree and sets the $UMOCKDEV_DIR environment variable so that programs subsequently started under umockdev-wrapper will use the test bed instead of the system's real sysfs.