Skip to content
Snippets Groups Projects
Commit 479336bd authored by Jakob Olsson's avatar Jakob Olsson
Browse files

cmocka: slight cleanup of unit test file

parent 7e8e9fcc
Branches
No related tags found
No related merge requests found
...@@ -37,37 +37,26 @@ struct test_ctx { ...@@ -37,37 +37,26 @@ struct test_ctx {
static int group_setup(void **state) static int group_setup(void **state)
{ {
struct test_ctx *ctx;// = malloc(sizeof(struct test_ctx)); struct test_ctx *ctx;
ctx = calloc(1, sizeof(*ctx)); ctx = calloc(1, sizeof(*ctx));
printf("%s %d\n", __func__, __LINE__);
start_test_logging(); start_test_logging();
if (!ctx)
return -1;
remove(CNTLR_FILE);
remove(AGENT_FILE);
memset(&ctx->bb, 0, sizeof(struct blob_buf));
// if (!ctx) *state = ctx;
// return -1;
//
// printf("%s %d\n", __func__, __LINE__);
//
// remove(CNTLR_FILE);
// remove(AGENT_FILE);
//
// printf("%s %d\n", __func__, __LINE__);
//
// memset(&ctx->bb, 0, sizeof(struct blob_buf));
//
// printf("%s %d\n", __func__, __LINE__);
//
// *state = ctx;
return 0; return 0;
} }
static int setup(void **state) static int setup(void **state)
{ {
printf("%s %d\n", __func__, __LINE__);
return 0; return 0;
} }
...@@ -75,7 +64,6 @@ static int teardown(void **state) ...@@ -75,7 +64,6 @@ static int teardown(void **state)
{ {
stop_test_logging(); stop_test_logging();
printf("%s %d\n", __func__, __LINE__);
return 0; return 0;
} }
...@@ -90,34 +78,27 @@ static int group_teardown(void **state) ...@@ -90,34 +78,27 @@ static int group_teardown(void **state)
{ {
// struct test_ctx *ctx = (struct test_ctx *) *state; // struct test_ctx *ctx = (struct test_ctx *) *state;
printf("%s %d\n", __func__, __LINE__); blob_buf_free(&ctx->bb);
// blob_buf_free(&ctx->bb);
// free(ctx); // free(ctx);
// remove(CNTLR_FILE); remove(CNTLR_FILE);
// remove(AGENT_FILE); remove(AGENT_FILE);
return 0; return 0;
} }
static void test_cmdu_comm(void **state) static void test_cmdu_comm(void **state)
{ {
//struct test_ctx *ctx = (struct test_ctx *) *state;
//struct blob_buf *bb = &ctx->bb;
//struct json_object *jobj, *tmp;
int rv; int rv;
struct blob_buf bb = {0}; struct blob_buf bb = {0};
struct controller c; struct controller c;
// TODO: place in group setup
c.ubus_ctx = ubus_connect(NULL); c.ubus_ctx = ubus_connect(NULL);
blob_buf_init(&bb, 0); blob_buf_init(&bb, 0);
printf("%s %d\n", __func__, __LINE__);
rv = cntlr_ap_caps(NULL, &c.obj, NULL, NULL, bb.head); rv = cntlr_ap_caps(NULL, &c.obj, NULL, NULL, bb.head);
dbg("test\n");
printf("%s %d\n", __func__, __LINE__);
assert_int_equal(rv, 0); assert_int_equal(rv, 0);
printf("%s %d\n", __func__, __LINE__);
assert_true(!compare_files(CNTLR_FILE, AGENT_FILE)); assert_true(!compare_files(CNTLR_FILE, AGENT_FILE));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment