use librtti for worker/queue/resource
This commit is contained in:
parent
532c68e6e1
commit
2ee87d4ee6
23 changed files with 1078 additions and 396 deletions
51
src/lib/testsuite/test_wobj.c
Normal file
51
src/lib/testsuite/test_wobj.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <unity/unity.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,
|
||||
};
|
||||
xce_worker_t* w = NULL;
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
TEST_ASSERT_TRUE(rc >= 0);
|
||||
|
||||
w = makeWorker(&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));
|
||||
|
||||
dereference(w);
|
||||
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
||||
void test_wobj(void)
|
||||
{
|
||||
printf("\n>> worker obj test\n\n");
|
||||
|
||||
RUN_TEST(test_worker_create);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue