/** * xe_kunit_helper_alloc_xe_device - Allocate a &xe_device for a KUnit test. * @test: the &kunit where this &xe_device will be used * @dev: The parent device object * * This function allocates xe_device using drm_kunit_helper_alloc_device(). * The xe_device allocation is managed by the test. * * @dev should be allocated using drm_kunit_helper_alloc_device(). * * This function uses KUNIT_ASSERT to detect any allocation failures. * * Return: A pointer to the new &xe_device.
*/ struct xe_device *xe_kunit_helper_alloc_xe_device(struct kunit *test, struct device *dev)
{ struct xe_device *xe;
/** * xe_kunit_helper_xe_device_test_init - Prepare a &xe_device for a KUnit test. * @test: the &kunit where this fake &xe_device will be used * * This function allocates and initializes a fake &xe_device and stores its * pointer as &kunit.priv to allow the test code to access it. * * This function can be directly used as custom implementation of * &kunit_suite.init. * * It is possible to prepare specific variant of the fake &xe_device by passing * in &kunit.priv pointer to the struct xe_pci_fake_data supplemented with * desired parameters prior to calling this function. * * This function uses KUNIT_ASSERT to detect any failures. * * Return: Always 0.
*/ int xe_kunit_helper_xe_device_test_init(struct kunit *test)
{ struct xe_device *xe; struct device *dev; int err;
dev = drm_kunit_helper_alloc_device(test);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
/** * xe_kunit_helper_xe_device_live_test_init - Prepare a &xe_device for * use in a live KUnit test. * @test: the &kunit where live &xe_device will be used * * This function expects pointer to the &xe_device in the &test.param_value, * like it is prepared by the &xe_pci_live_device_gen_param and stores that * pointer as &kunit.priv to allow the test code to access it. * * This function makes sure that device is not wedged and then resumes it * to avoid waking up the device inside the test. It uses deferred cleanup * action to release a runtime_pm reference. * * This function can be used as custom implementation of &kunit_suite.init. * * This function uses KUNIT_ASSERT to detect any failures. * * Return: Always 0.
*/ int xe_kunit_helper_xe_device_live_test_init(struct kunit *test)
{ struct xe_device *xe = xe_device_const_cast(test->param_value);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe);
kunit_info(test, "running on %s device\n", xe->info.platform_name);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.