ut/vhost: fix vhost_dev_register() tests
All vhost_dev_register() tests are negative - they all expect error. They all were failing on a single check: *ERROR*: no cpu is selected among reactor mask(=1) *ERROR*: cpumask 0x1 is invalid (app mask is 0x1) That's because we mock cpumask parsing. Even when "parsed", the real cpumask would always be == 0. Our unit tests were treating this as a valid behavior. To really test what they should, we have to properly implement cpumask parsing. That's what this patch does. We should also assert against a specific error code, not just != 0. But that's a matter for a separate commit. Change-Id: Iae93b31292a0d9aee4e773ef568b2052a1de714d Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/399442 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e1accdca3a
commit
88beac7045
@ -57,7 +57,23 @@ struct spdk_cpuset *spdk_app_get_core_mask(void)
|
||||
return g_app_core_mask;
|
||||
}
|
||||
|
||||
DEFINE_STUB(spdk_app_parse_core_mask, int, (const char *mask, struct spdk_cpuset *cpumask), 0);
|
||||
int
|
||||
spdk_app_parse_core_mask(const char *mask, struct spdk_cpuset *cpumask)
|
||||
{
|
||||
int ret;
|
||||
struct spdk_cpuset *validmask;
|
||||
|
||||
ret = spdk_cpuset_parse(cpumask, mask);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
validmask = spdk_app_get_core_mask();
|
||||
spdk_cpuset_and(cpumask, validmask);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_STUB(spdk_env_get_first_core, uint32_t, (void), 0);
|
||||
DEFINE_STUB(spdk_env_get_next_core, uint32_t, (uint32_t prev_core), 0);
|
||||
DEFINE_STUB(spdk_env_get_last_core, uint32_t, (void), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user