save works
This commit is contained in:
parent
b748e30d20
commit
f4b1ba4cd7
21 changed files with 373 additions and 324 deletions
|
|
@ -5,41 +5,52 @@
|
|||
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "kvmgr.h"
|
||||
#include "utils.h"
|
||||
#include "wobj.h"
|
||||
#include "xstring.h"
|
||||
|
||||
static void test_worker_create(void)
|
||||
{
|
||||
int rc;
|
||||
hostattrs_t attrs1 = { .hosttype = "LINUX64",
|
||||
.hostmodel = "linux-gnu-x86_64",
|
||||
.cpufactor = 100.0,
|
||||
.maxcpus = 5,
|
||||
.maxmem = 65536.0,
|
||||
.maxswap = 65536.0,
|
||||
.maxtmp = 0.0,
|
||||
.ndisks = 2 };
|
||||
xce_worker_t w1 = {
|
||||
.name = "worker1",
|
||||
.attrs = &attrs1,
|
||||
int rc;
|
||||
kvmgr_params_t params = { .key_type = KVMGR_KEY_STRING,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var workermgr;
|
||||
hostattrs_t attrs1 = { .hosttype = "LINUX64",
|
||||
.hostmodel = "linux-gnu-x86_64",
|
||||
.cpufactor = 100.0,
|
||||
.maxcpus = 5,
|
||||
.maxmem = 65536.0,
|
||||
.maxswap = 65536.0,
|
||||
.maxtmp = 0.0,
|
||||
.ndisks = 2 };
|
||||
xce_worker_t w1 = {
|
||||
.name = "worker1",
|
||||
.attrs = &attrs1,
|
||||
};
|
||||
xce_worker_t* w = NULL;
|
||||
worker_t* w = NULL;
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
TEST_ASSERT_TRUE(rc >= 0);
|
||||
|
||||
w = makeWorker(&w1);
|
||||
workermgr = makeInstance(&xkvmgr_type, ¶ms);
|
||||
TEST_ASSERT_TRUE(workermgr != NULL);
|
||||
|
||||
w = makeWorker(workermgr, &w1);
|
||||
|
||||
TEST_ASSERT_TRUE(w != NULL);
|
||||
TEST_ASSERT_TRUE(EQUAL_STRING(w->name, w1.name)
|
||||
&& EQUAL_STRING(w->attrs->hosttype, attrs1.hosttype)
|
||||
&& EQUAL_STRING(w->attrs->hostmodel, attrs1.hostmodel)
|
||||
&& (w->attrs->cpufactor == attrs1.cpufactor)
|
||||
&& (w->attrs->maxcpus == attrs1.maxcpus));
|
||||
TEST_ASSERT_TRUE(EQUAL_STRING(w->host.name, w1.name)
|
||||
&& EQUAL_STRING(w->host.attrs->hosttype, attrs1.hosttype)
|
||||
&& EQUAL_STRING(w->host.attrs->hostmodel, attrs1.hostmodel)
|
||||
&& (w->host.attrs->cpufactor == attrs1.cpufactor)
|
||||
&& (w->host.attrs->maxcpus == attrs1.maxcpus));
|
||||
|
||||
dereference(w);
|
||||
|
||||
destroy(workermgr);
|
||||
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue