| 453 | } |
| 454 | |
| 455 | static int |
| 456 | test_bbdev_op_pool(void) |
| 457 | { |
| 458 | struct rte_mempool *mp; |
| 459 | |
| 460 | unsigned int dec_size = sizeof(struct rte_bbdev_dec_op); |
| 461 | unsigned int enc_size = sizeof(struct rte_bbdev_enc_op); |
| 462 | |
| 463 | const char *pool_dec = "Test_DEC"; |
| 464 | const char *pool_enc = "Test_ENC"; |
| 465 | |
| 466 | /* Valid pool configuration */ |
| 467 | uint32_t size = 256; |
| 468 | uint32_t cache_size = 128; |
| 469 | |
| 470 | TEST_ASSERT(rte_bbdev_op_pool_create(NULL, |
| 471 | RTE_BBDEV_OP_TURBO_DEC, size, cache_size, 0) == NULL, |
| 472 | "Failed test for rte_bbdev_op_pool_create: " |
| 473 | "NULL name parameter"); |
| 474 | |
| 475 | TEST_ASSERT((mp = rte_bbdev_op_pool_create(pool_dec, |
| 476 | RTE_BBDEV_OP_TURBO_DEC, size, cache_size, 0)) != NULL, |
| 477 | "Failed test for rte_bbdev_op_pool_create: " |
| 478 | "returned value is empty"); |
| 479 | |
| 480 | TEST_ASSERT(mp->size == size, |
| 481 | "Failed test for rte_bbdev_op_pool_create: " |
| 482 | "invalid size of the mempool, mp->size: %u", mp->size); |
| 483 | |
| 484 | TEST_ASSERT(mp->cache_size == cache_size, |
| 485 | "Failed test for rte_bbdev_op_pool_create: " |
| 486 | "invalid size of the mempool, mp->size: %u", |
| 487 | mp->cache_size); |
| 488 | |
| 489 | TEST_ASSERT_SUCCESS(strcmp(mp->name, pool_dec), |
| 490 | "Failed test for rte_bbdev_op_pool_create: " |
| 491 | "invalid name of mempool, mp->name: %s", mp->name); |
| 492 | |
| 493 | TEST_ASSERT(mp->elt_size == dec_size, |
| 494 | "Failed test for rte_bbdev_op_pool_create: " |
| 495 | "invalid element size for RTE_BBDEV_OP_TURBO_DEC, " |
| 496 | "mp->elt_size: %u", mp->elt_size); |
| 497 | |
| 498 | rte_mempool_free(mp); |
| 499 | |
| 500 | TEST_ASSERT((mp = rte_bbdev_op_pool_create(pool_enc, |
| 501 | RTE_BBDEV_OP_TURBO_ENC, size, cache_size, 0)) != NULL, |
| 502 | "Failed test for rte_bbdev_op_pool_create: " |
| 503 | "returned value is empty"); |
| 504 | |
| 505 | TEST_ASSERT(mp->elt_size == enc_size, |
| 506 | "Failed test for rte_bbdev_op_pool_create: " |
| 507 | "invalid element size for RTE_BBDEV_OP_TURBO_ENC, " |
| 508 | "mp->elt_size: %u", mp->elt_size); |
| 509 | |
| 510 | rte_mempool_free(mp); |
| 511 | |
| 512 | TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_NONE", |
nothing calls this directly
no test coverage detected