test/accel: add UT for spdk_accel_get_capabilities()

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I6e18929dc8753301cf8735c2a33f53258a098768
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6356
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
paul luse 2021-02-09 18:51:58 -05:00 committed by Tomasz Zawadzki
parent 480d8ac71d
commit 598eda5d78

View File

@ -173,6 +173,29 @@ test_spdk_accel_task_complete(void)
CU_ASSERT(expected_batch == &batch);
}
static void
test_spdk_accel_get_capabilities(void)
{
struct spdk_io_channel *ch;
struct accel_io_channel *accel_ch;
struct spdk_accel_engine engine;
uint64_t cap, expected_cap;
ch = calloc(1, sizeof(struct spdk_io_channel) + sizeof(struct accel_io_channel));
SPDK_CU_ASSERT_FATAL(ch != NULL);
/* Setup a few capabilites and make sure they are reported as expected. */
accel_ch = (struct accel_io_channel *)((char *)ch + sizeof(struct spdk_io_channel));
accel_ch->engine = &engine;
expected_cap = ACCEL_COPY | ACCEL_DUALCAST | ACCEL_CRC32C;
accel_ch->engine->capabilities = expected_cap;
cap = spdk_accel_get_capabilities(ch);
CU_ASSERT(cap == expected_cap);
free(ch);
}
int main(int argc, char **argv)
{
CU_pSuite suite = NULL;
@ -188,6 +211,7 @@ int main(int argc, char **argv)
CU_ADD_TEST(suite, test_accel_sw_unregister);
CU_ADD_TEST(suite, test_is_supported);
CU_ADD_TEST(suite, test_spdk_accel_task_complete);
CU_ADD_TEST(suite, test_spdk_accel_get_capabilities);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();