save works
This commit is contained in:
parent
b748e30d20
commit
f4b1ba4cd7
21 changed files with 373 additions and 324 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include <unity/unity.h>
|
||||
|
||||
#include "jobj.h"
|
||||
#include "kvmgr.h"
|
||||
#include "utils.h"
|
||||
#include "xstring.h"
|
||||
|
||||
|
|
@ -206,6 +207,12 @@ static void test_jobsub_share(void)
|
|||
static void test_job_create(void)
|
||||
{
|
||||
int rc;
|
||||
kvmgr_params_t jobmgr_params = { .key_type = KVMGR_KEY_INT,
|
||||
.dynamic = 1,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var jobmgr;
|
||||
job_startinfo_t s1 = { .exechome = "/homes/rshen",
|
||||
.execcwd = "/tmp",
|
||||
.execuser = "rshen",
|
||||
|
|
@ -226,7 +233,7 @@ static void test_job_create(void)
|
|||
.job_description = "no description",
|
||||
.resreq = "type == any" };
|
||||
xce_job_t job1 = { .submit = &jobsub1 };
|
||||
xce_job_t* j2 = NULL;
|
||||
job_t* j2 = NULL;
|
||||
time_t now = time(NULL);
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
|
|
@ -249,31 +256,36 @@ static void test_job_create(void)
|
|||
job1.pending_ctrl = 0;
|
||||
job1.jobid = 100;
|
||||
|
||||
j2 = makeJob(&job1);
|
||||
jobmgr = makeInstance(&xkvmgr_type, &jobmgr_params);
|
||||
TEST_ASSERT_TRUE(jobmgr != NULL);
|
||||
|
||||
j2 = makeJob(jobmgr, &job1);
|
||||
|
||||
TEST_ASSERT_TRUE(j2 != NULL);
|
||||
|
||||
TEST_ASSERT_TRUE(
|
||||
EQUAL_STRING(s1.exechome, j2->submit->start_info->exechome)
|
||||
&& EQUAL_STRING(s1.execcwd, j2->submit->start_info->execcwd)
|
||||
&& EQUAL_STRING(s1.execuser, j2->submit->start_info->execuser)
|
||||
&& EQUAL_STRING(s1.cmdline, j2->submit->start_info->cmdline)
|
||||
&& EQUAL_STRING(s1.exdata, j2->submit->start_info->exdata)
|
||||
&& EQUAL_STRING(s1.q_pre_exec, j2->submit->start_info->q_pre_exec)
|
||||
&& EQUAL_STRING(s1.q_post_exec, j2->submit->start_info->q_post_exec)
|
||||
&& EQUAL_STRING(s1.job_pre_exec, j2->submit->start_info->job_pre_exec)
|
||||
&& EQUAL_STRING(s1.job_post_exec, j2->submit->start_info->job_post_exec)
|
||||
&& EQUAL_STRING(j2->submit->queue, "xce")
|
||||
&& EQUAL_STRING(j2->submit->user, "rshen")
|
||||
&& EQUAL_STRING(j2->submit->job_name, "J1")
|
||||
&& EQUAL_STRING(j2->submit->project_name, "default")
|
||||
&& EQUAL_STRING(j2->submit->job_description, "no description")
|
||||
&& EQUAL_STRING(j2->submit->resreq, "type == any")
|
||||
&& (j2->submit->mintasks == 1) && (j2->submit->maxtasks == 5)
|
||||
&& (j2->submit->user_group == NULL));
|
||||
EQUAL_STRING(s1.exechome, j2->job.submit->start_info->exechome)
|
||||
&& EQUAL_STRING(s1.execcwd, j2->job.submit->start_info->execcwd)
|
||||
&& EQUAL_STRING(s1.execuser, j2->job.submit->start_info->execuser)
|
||||
&& EQUAL_STRING(s1.cmdline, j2->job.submit->start_info->cmdline)
|
||||
&& EQUAL_STRING(s1.exdata, j2->job.submit->start_info->exdata)
|
||||
&& EQUAL_STRING(s1.q_pre_exec, j2->job.submit->start_info->q_pre_exec)
|
||||
&& EQUAL_STRING(s1.q_post_exec, j2->job.submit->start_info->q_post_exec)
|
||||
&& EQUAL_STRING(s1.job_pre_exec, j2->job.submit->start_info->job_pre_exec)
|
||||
&& EQUAL_STRING(s1.job_post_exec, j2->job.submit->start_info->job_post_exec)
|
||||
&& EQUAL_STRING(j2->job.submit->queue, "xce")
|
||||
&& EQUAL_STRING(j2->job.submit->user, "rshen")
|
||||
&& EQUAL_STRING(j2->job.submit->job_name, "J1")
|
||||
&& EQUAL_STRING(j2->job.submit->project_name, "default")
|
||||
&& EQUAL_STRING(j2->job.submit->job_description, "no description")
|
||||
&& EQUAL_STRING(j2->job.submit->resreq, "type == any")
|
||||
&& (j2->job.submit->mintasks == 1) && (j2->job.submit->maxtasks == 5)
|
||||
&& (j2->job.submit->user_group == NULL));
|
||||
|
||||
dereference(j2);
|
||||
|
||||
destroy(jobmgr);
|
||||
|
||||
job_obj_fini();
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,28 +2,40 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <rtti.h>
|
||||
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "qobj.h"
|
||||
#include "utils.h"
|
||||
#include "xstring.h"
|
||||
#include "kvmgr.h"
|
||||
|
||||
static void test_queue_create(void)
|
||||
{
|
||||
int rc;
|
||||
xce_queue_t q1 = { 0 };
|
||||
xce_queue_t* q = NULL;
|
||||
int rc;
|
||||
kvmgr_params_t params = { .key_type = KVMGR_KEY_STRING,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var qmgr;
|
||||
|
||||
xce_queue_t q1 = { 0 };
|
||||
queue_t* q = NULL;
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
TEST_ASSERT_TRUE(rc >= 0);
|
||||
|
||||
q = makeQueue(&q1);
|
||||
qmgr = makeInstance(&xkvmgr_type, ¶ms);
|
||||
TEST_ASSERT_TRUE(qmgr != NULL);
|
||||
|
||||
q = makeQueue(qmgr, &q1);
|
||||
|
||||
TEST_ASSERT_TRUE(q != NULL);
|
||||
|
||||
destroy(q);
|
||||
|
||||
destroy(qmgr);
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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