| 40 | } |
| 41 | |
| 42 | static int |
| 43 | test_device_setup(struct ml_test *test, struct ml_options *opt) |
| 44 | { |
| 45 | struct test_device *t; |
| 46 | void *test_device; |
| 47 | int ret = 0; |
| 48 | |
| 49 | /* allocate for test structure */ |
| 50 | test_device = rte_zmalloc_socket(test->name, sizeof(struct test_device), |
| 51 | RTE_CACHE_LINE_SIZE, opt->socket_id); |
| 52 | if (test_device == NULL) { |
| 53 | ml_err("failed to allocate memory for test_model"); |
| 54 | ret = -ENOMEM; |
| 55 | goto error; |
| 56 | } |
| 57 | test->test_priv = test_device; |
| 58 | t = ml_test_priv(test); |
| 59 | |
| 60 | t->cmn.result = ML_TEST_FAILED; |
| 61 | t->cmn.opt = opt; |
| 62 | |
| 63 | /* get device info */ |
| 64 | ret = rte_ml_dev_info_get(opt->dev_id, &t->cmn.dev_info); |
| 65 | if (ret < 0) { |
| 66 | ml_err("failed to get device info"); |
| 67 | goto error; |
| 68 | } |
| 69 | |
| 70 | return 0; |
| 71 | |
| 72 | error: |
| 73 | rte_free(test_device); |
| 74 | |
| 75 | return ret; |
| 76 | } |
| 77 | |
| 78 | static void |
| 79 | test_device_destroy(struct ml_test *test, struct ml_options *opt) |
nothing calls this directly
no test coverage detected