lib/idxd: add unit test for spdk_idxd_set_config()

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I8d38491ad7f97310568ec1172df9a9358cfd2a6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1783
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
paul luse 2020-04-09 12:40:15 -04:00 committed by Ben Walker
parent f603c27276
commit 8e496c5155

View File

@ -33,6 +33,7 @@
#include "spdk_cunit.h"
#include "spdk_internal/mock.h"
#include "spdk_internal/idxd.h"
#include "common/lib/test_env.c"
#include "idxd/idxd.c"
@ -80,6 +81,18 @@ mock_movdir64b(void *dst, const void *src)
return;
}
static int
test_spdk_idxd_set_config(void)
{
g_dev_cfg = NULL;
spdk_idxd_set_config(0);
SPDK_CU_ASSERT_FATAL(g_dev_cfg != NULL);
CU_ASSERT(memcmp(&g_dev_cfg0, g_dev_cfg, sizeof(struct device_config)) == 0);
return 0;
}
static int
test_spdk_idxd_reconfigure_chan(void)
{
@ -103,7 +116,6 @@ test_spdk_idxd_reconfigure_chan(void)
return 0;
}
int main(int argc, char **argv)
{
CU_pSuite suite = NULL;
@ -115,6 +127,7 @@ int main(int argc, char **argv)
suite = CU_add_suite("idxd", NULL, NULL);
CU_ADD_TEST(suite, test_spdk_idxd_reconfigure_chan);
CU_ADD_TEST(suite, test_spdk_idxd_set_config);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();