15 struct MockIO *mio_p = arg;
35 struct MockIO *mio_p = arg;
46 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x31}},
48 {
R,
S, 1, {
sizeof(mstru)}},
52 {
R,
S, 2, {
sizeof(mstru.
m1),
sizeof(mstru.
m2)}},
54 mockIOInit(mio_p, ops,
sizeof(ops) /
sizeof(ops[0]));
70 mockIOInit(mio_p, ops,
sizeof(ops) /
sizeof(ops[0]));
92 assert(1 ==
sizeof(mstru.
m1));
93 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
94 hipcGet(&sess,
"MOCK1S1.m1", &val);
104 assert(1 ==
sizeof(mstru.
m1));
105 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
107 hipcPut(&sess,
"MOCK1S1.m1", &val);
137 assert(NULL != cimg);
142 (*sum_p) += (stru_p->
m1);
151 assert(NULL == cimg);
154 fprintf(stderr,
"msg[4]: %d\n", msg[4]);
167 assert(1 ==
sizeof(m2s1.
m1));
168 assert(0 == offsetof(
struct MOCK2S1,
m1));
172 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x32}},
174 {
R,
S, 2, {
sizeof(
struct MOCK2S1), sizeof(struct MOCK2S2)}},
177 {
R,
S, 1, {offsetof(
struct MOCK2S1,m1)}},
179 {
R,
S, 1, {
sizeof(m2s1.
m1)}},
182 {
R,
S, 2, {offsetof(
struct MOCK2S2,m1),offsetof(
struct MOCK2S2,m2)}},
184 {
R,
S, 2, {
sizeof(m2s2.
m1),
sizeof(m2s2.
m2)}},
186 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
196 {
R,
S,
sizeof(m2s1), {19}},
200 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
202 hipcGet(&sess,
"MOCK2S2.m1", &val);
213 {
R,
S,
sizeof(m2s1), {19}},
217 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
219 hipcGet(&sess,
"MOCK2S2.m1", &val);
229 {
R,
S,
sizeof(m2s1), {1}},
231 {
R,
S,
sizeof(m2s1), {2}},
233 {
R,
S,
sizeof(m2s1), {3}},
236 assert(1 ==
sizeof(m2s2.
m1));
237 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
240 hipcPut(&sess,
"MOCK2S2.m1", &val);
254 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
255 hipcGet(&sess,
"MOCK2S2.m1", &val);
265 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
280 assert(1 ==
sizeof(m1s1.
m1));
281 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
305 0x43, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x43, 0x4b, 0x31}},
307 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
318 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x31}},
321 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
332 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x31}},
335 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
346 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x31}},
348 {
R,
S, 1, {
sizeof(mstru)}},
351 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
362 0x43,0x49,0x44,0x5f,0x4d,0x4f,0x43,0x4b,0x31}},
364 {
R,
S, 1, {
sizeof(mstru)}},
368 {
R,
S, 2, {
sizeof(mstru.
m1),
sizeof(mstru.
m2)+1}},
370 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
391 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
402 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
419 hipcGet(&sess,
"MOCK1S1.m1", &val));
430 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
431 assert(HIPC_ERR_IO_WRITE ==
hipcGet(&sess,
"MOCK1S1.m1", &val));
442 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
443 assert(HIPC_ERR_IO_READ ==
hipcGet(&sess,
"MOCK1S1.m1", &val));
461 hipcPut(&sess,
"MOCK1S1.m1", &val));
472 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
473 assert(HIPC_ERR_IO_WRITE ==
hipcPut(&sess,
"MOCK1S1.m1", &val));
484 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
532 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
543 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
554 {
R,
S,
sizeof(m1s1), },
556 mockIOInit(&mio, ops,
sizeof(ops) /
sizeof(ops[0]));
567 int main(
int argc,
char *argv[])
570 fprintf(stderr,
"Usage: %s test_id\n", argv[0]);
574 switch (argv[1][0]) {
600 fprintf(stderr,
"Invalid test_id: %s \n", argv[1]);
unsigned char hipc_msg[HIPC_MSG_ALLOCSIZE]
static void test_hipcSession_cast(void)
enum HIPC_errno hipcGet(hipc_session *const sess_p, char const *const str, void *const cimg)
Gets data specified by str from a HIPC server.
size_t hipcMsgTotalSize(const hipc_msg msg)
Returns total size of a HIPC message, which is the header size plus the body size.
static void test_hipcClose_err(void)
enum HIPC_errno hipcPut(hipc_session *const sess_p, char const *const str, void *const cimg)
Puts data specified by str from a HIPC server.
enum HIPC_errno hipcOpen(hipc_session *const sess_p, struct HIPC_client const *const clbase_p, enum HIPC_errno(*rfnc_p)(void *, hipc_msg), void *rarg, enum HIPC_errno(*wfnc_p)(void *, const hipc_msg), void *warg)
Open a session to a HIPC server.
const char * hipcClientGetErrDtlStr(const struct HIPC_client *const cl_p)
Gets a string describing details of an error that has been set to a HIPC client.
static void closeDefaultSession(hipc_session *const sess_p, struct MockIO *mio_p)
static enum HIPC_errno mockReadMsg(void *arg, hipc_msg msg)
static enum HIPC_errno handler_err(struct HIPC_client *cl_p, const hipc_msg msg, void *cimg, void *arg)
int mockIOCheckCompletion(struct MockIO *mio_p)
const struct HIPC_client HIPCUD_cfgmock1_CCFG
enum HIPC_errno hipcClientSetError(struct HIPC_client *const cl_p, enum HIPC_errno hipc_errno, char const *const str)
Sets an error to a client with error detail.
unsigned char hipcMsgBdySize(const hipc_msg msg)
Returns body size of a HIPC message.
void mockIOInit(struct MockIO *mio_p, const struct MockIOOp *ops, const unsigned int nops)
enum HIPC_session_state state
enum HIPC_errno hipcWaitReturn(hipc_session *const sess_p, hipc_msg msgR)
Waits a return message from a HIPC server.
enum HIPC_errno mockIOWrite(struct MockIO *mio_p, const void *buf, const size_t size)
enum HIPC_errno hipcClose(hipc_session *const sess_p)
Closes a session.
enum HIPC_errno hipcSetHandler(hipc_session *const sess_p, char const *const str, void *const cimg, enum HIPC_errno(*hndlr_p)(struct HIPC_client *, const hipc_msg, void *, void *), void *const arg)
Set a handler to a structure type.
static void openDefaultSession(hipc_session *const sess_p, struct MockIO *mio_p)
enum HIPC_errno mockIORead(struct MockIO *mio_p, void *buf, const size_t size)
static enum HIPC_errno mockWriteMsg(void *arg, const hipc_msg msg)
static void test_hipcOpen_err(void)
const struct HIPC_client HIPCUD_cfgmock2_CCFG
static enum HIPC_errno handler_msg(struct HIPC_client *cl_p, const hipc_msg msg, void *cimg, void *arg)
#define HIPC_ERRCHECK(sess_p)
Checks whether an error has occurred.
static void test_hipcSession(void)
static void test_hipcWaitReturn_err(void)
static void test_hipcGet_err(void)
static void test_hipcPut_err(void)
static enum HIPC_errno handler_MOCK2S1(struct HIPC_client *cl_p, const hipc_msg msg, void *cimg, void *arg)
int main(int argc, char *argv[])
static void test_hipcSetHandler_err(void)