本文整理汇总了C++中TEST_CHK_FEOK函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_CHK_FEOK函数的具体用法?C++ TEST_CHK_FEOK怎么用?C++ TEST_CHK_FEOK使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEST_CHK_FEOK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
bool client = false;
int ferr;
int inx;
int loop = 10;
int msgid;
int oid;
RT results;
TPT_DECL (phandle);
int send_len;
TAD zargs[] = {
{ "-loop", TA_Int, TA_NOMAX, &loop },
{ "", TA_End, TA_NOMAX, NULL }
};
msfs_util_init_role(true, &argc, &argv, msg_debug_hook);
arg_proc_args(zargs, false, argc, argv);
client = true;
util_test_start(client);
ferr = msg_mon_process_startup(!client); // system messages
TEST_CHK_FEOK(ferr);
ferr = msg_mon_open_process((char *) "$srv", // name
TPT_REF(phandle),
&oid);
TEST_CHK_FEOK(ferr);
util_gethostname(my_name, sizeof(my_name));
for (inx = 0; inx < loop; inx++) {
sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx);
send_len = (int) strlen(send_buffer) + 1;
ferr = XMSG_LINK_(TPT_REF(phandle), // phandle
&msgid, // msgid
send_buffer2, // reqctrl
(ushort) ((inx & 1) + 1), // reqctrlsize
recv_buffer3, // replyctrl
2, // replyctrlmax
send_buffer, // reqdata
(ushort) send_len, // reqdatasize
recv_buffer, // replydata
BUFSIZ, // replydatamax
0, // linkertag
0, // pri
0, // xmitclass
0); // linkopts
util_check("XMSG_LINK_", ferr);
ferr = XMSG_BREAK_(msgid, results.u.s, TPT_REF(phandle));
util_check("XMSG_BREAK_", ferr);
assert(results.u.t.ctrl_size == (uint) ((inx & 1) + 1));
assert(results.u.t.data_size > (strlen(send_buffer) + 14));
assert(results.u.t.errm == RT_DATA_RCVD); // data
printf("%s\n", recv_buffer);
}
ferr = msg_mon_close_process(TPT_REF(phandle));
printf("close ferr=%d\n", ferr);
printf("client shutting down\n");
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
util_test_finish(client);
return 0;
}
示例2: main
int main(int argc, char *argv[]) {
bool client = false;
int disable;
int ferr;
int oid;
TPT_DECL (phandle);
TAD zargs[] = {
{ "-client", TA_Bool, TA_NOMAX, &client },
{ "-server", TA_Ign, TA_NOMAX, NULL },
{ "", TA_End, TA_NOMAX, NULL }
};
msfs_util_init(&argc, &argv, msg_debug_hook);
arg_proc_args(zargs, false, argc, argv);
util_test_start(client);
ferr = msg_mon_process_startup(true); // system messages?
TEST_CHK_FEOK(ferr);
if (client) {
disable = msg_test_assert_disable();
ferr = msg_mon_open_process((char *) "$srv", // name
TPT_REF(phandle),
&oid);
TEST_CHK_FEIGNORE(ferr);
msg_test_assert_enable(disable);
}
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
util_test_finish(client);
return 0;
}
示例3: do_set_linux
void do_set_linux(int fd, short set_file, int rr, int wr, int exc, int count) {
short ferr;
short info_count;
short list_inx;
add_list[0].z_fnum_fd = fd;
if (set_file)
add_list[0].u_z_options.z_options.z_set_file = 1;
else
add_list[0].u_z_options.z_options.z_set_file = 0;
add_list[0].u_z_options.z_options.z_filetype = 1;
if (rr)
add_list[0].u_z_options.z_options.z_read_ready = 1;
else
add_list[0].u_z_options.z_options.z_read_ready = 0;
if (wr)
add_list[0].u_z_options.z_options.z_write_ready = 1;
else
add_list[0].u_z_options.z_options.z_write_ready = 0;
if (exc)
add_list[0].u_z_options.z_options.z_exception = 1;
else
add_list[0].u_z_options.z_options.z_exception = 0;
ferr = BFILE_COMPLETE_SET_((short *) add_list,
1,
&list_inx);
TEST_CHK_FEOK(ferr);
ferr = BFILE_COMPLETE_GETINFO_((short *) info_list,
MAX_INFO_LIST,
&info_count);
TEST_CHK_FEOK(ferr);
assert(info_count == count);
}
示例4: start_backup
void start_backup(int nid) {
int ferr;
nid = nid; // no-warn
ferr = msg_mon_get_process_info(NULL, &nid, &gpeer_pid);
TEST_CHK_FEOK(ferr);
gpeer_nid = 1 - nid;
gpeer_pid = -1;
myprintf("starting backup process with open.\n");
ferr = msg_mon_start_process(gprog, // prog
gname, // name
NULL, // ret name
gargc,
gargp,
TPT_REF(gpeer_phandle),
0, // open
&gpeer_oid,
MS_ProcessType_Generic, // type
0, // priority
0, // debug
1, // backup
&gpeer_nid, // nid
&gpeer_pid, // pid
NULL, // infile
NULL); // outfile
TEST_CHK_FEOK(ferr);
ferr = msg_mon_open_process_backup(gname,
TPT_REF(gpeer_phandle),
&gpeer_oid);
TEST_CHK_FEOK(ferr);
myprintf("after start_backup - peer p-id=%d/%d\n",
gpeer_nid, gpeer_pid);
mypairinfo(true);
}
示例5: main
int main(int argc, char *argv[]) {
bool attach = false;
int ferr;
int level = MS_Mon_ShutdownLevel_Normal;
TAD zargs[] = {
{ "-attach", TA_Bool, TA_NOMAX, &attach },
{ "-level", TA_Int, TA_NOMAX, &level },
{ "-server", TA_Ign, TA_NOMAX, NULL },
{ "", TA_End, TA_NOMAX, NULL }
};
arg_proc_args(zargs, false, argc, argv);
if (attach)
msfs_util_init_attach(&argc,
&argv,
msg_debug_hook,
false,
(char *) "$cli"); // cast
else
msfs_util_init(&argc, &argv, msg_debug_hook);
util_test_start(true);
ferr = msg_mon_process_startup(false); // system messages
TEST_CHK_FEOK(ferr);
printf("using shutdown level=%d\n", level);
ferr = msg_mon_shutdown(level);
TEST_CHK_FEOK(ferr);
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
util_test_finish(true);
return 0;
}
示例6: file_enable_open_cleanup
void *thread_cli(void *arg) {
_xcc_status cc;
int count_read;
int ferr;
short filenum;
short filenum2;
int inx;
arg = arg; // touch
ferr = file_enable_open_cleanup();
TEST_CHK_FEOK(ferr);
ferr = BFILE_OPEN_((char *) sname, 4, &filenum,
0, 0, 0, 0, 0, 0, 0, NULL);
TEST_CHK_FEOK(ferr);
ferr = BFILE_OPEN_((char *) sname, 4, &filenum2,
0, 0, 0, 0, 0, 0, 0, NULL);
TEST_CHK_FEOK(ferr);
for (inx = 0; inx < loop; inx++) {
sprintf(send_buffer, "hello, greetings from %s, inx=%d",
my_name, inx);
cc = BWRITEREADX(filenum,
send_buffer,
(int) (strlen(send_buffer) + 1), // cast
BUFSIZ,
&count_read,
0);
TEST_CHK_CCEQ(cc);
printf("%s\n", send_buffer);
}
ferr = BFILE_CLOSE_(filenum2);
TEST_CHK_FEOK(ferr);
return NULL;
}
示例7: BFILE_OPEN_
void *thread_test_fun(void *arg) {
void *buf;
_bcc_status cc;
int count_read;
int count_xferred;
int ferr;
int inx;
SB_Tag_Type tag1;
short tfilenum;
int timeout = -1;
arg = arg; // touch
ferr = BFILE_OPEN_((char *) sname, 4, &filenum,
0, 0, 1, // nowait
0,
0x4400, // nowait-open/tsc
0, 0, NULL);
TEST_CHK_FEOK(ferr);
tfilenum = get_fn(filenum);
cc = BAWAITIOXTS(&tfilenum,
&buf,
&count_xferred,
&tag1,
timeout,
NULL);
TEST_CHK_CCEQ(cc);
assert(tag1 == -30);
for (inx = 0; inx < loop; inx++) {
sprintf(send_buffer, "hello, greetings from %s, inx=%d",
my_name, inx);
cc = BWRITEREADX(filenum,
send_buffer,
(int) (strlen(send_buffer) + 1), // cast
BUFSIZ,
&count_read,
0);
TEST_CHK_CCEQ(cc);
tfilenum = get_fn(filenum);
cc = BAWAITIOXTS(&tfilenum,
&buf,
&count_xferred,
&tag1,
timeout,
NULL);
TEST_CHK_CCEQ(cc);
printf("%s\n", send_buffer);
}
// let thread-exit close
if (!thread) {
ferr = BFILE_CLOSE_(filenum, 0);
TEST_CHK_FEOK(ferr);
}
return NULL;
}
示例8: main
int main(int argc, char *argv[]) {
bool done = false;
int ferr;
int recvbuf[3];
sprintf(gprog, "%s/%s", getenv("PWD"), argv[0]);
ferr = msfs_util_init_role(false, &argc, &argv, msg_debug_hook);
assert(ferr == XZFIL_ERR_OK);
ferr = msg_mon_process_startup(true); // system messages
assert(ferr == XZFIL_ERR_OK);
ferr = msg_mon_get_my_process_name(gname, sizeof(gname));
assert(ferr == XZFIL_ERR_OK);
msg_mon_enable_mon_messages(true); // get mon messages
gargc = argc; // after msg_init - it removes args
gargp = argv;
if (is_backup()) {
strcpy(gdisplay_name, gname);
strcat(gdisplay_name, "-B");
myprintf("We are the backup process.\n");
gim_backup = true;
while (!gtakeover) {
int len = sizeof(recvbuf);
ferr = checkpoint(recvbuf, &len);
if (ferr == XZFIL_ERR_OK)
process_request(recvbuf);
}
myprintf("The backup is now the primary process.\n");
strcpy(gdisplay_name, gname);
strcat(gdisplay_name, "-P");
} else {
strcpy(gdisplay_name, gname);
strcat(gdisplay_name, "-P");
myprintf("We are the primary process.\n");
}
start_backup(-1);
while (!done) {
int len = sizeof(recvbuf);
if (!recv(recvbuf, &len)) {
done = process_request(recvbuf);
checkpoint(recvbuf, &len);
}
}
ferr = msg_mon_process_close();
TEST_CHK_FEOK(ferr);
if (gpeer_nid >= 0) {
myprintf("stopping backup.\n");
ferr = msg_mon_stop_process((char*)"", gpeer_nid, gpeer_pid);
TEST_CHK_FEOK(ferr);
}
myprintf("sending exit process message.\n");
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
}
示例9: main
int main(int argc, char *argv[]) {
int ferr;
int inx;
int len;
int lerr;
int loop = 10;
char my_name[BUFSIZ];
char recv_buffer[BUFSIZ];
short recv_buffer2[BUFSIZ];
MS_SRE sre;
TAD zargs[] = {
{ "-loop", TA_Int, TA_NOMAX, &loop },
{ "-server", TA_Ign, TA_NOMAX, NULL },
{ "", TA_End, TA_NOMAX, NULL }
};
msfs_util_init_role(false, &argc, &argv, msg_debug_hook);
arg_proc_args(zargs, false, argc, argv);
ferr = msg_mon_process_startup(true); // system messages
TEST_CHK_FEOK(ferr);
util_gethostname(my_name, sizeof(my_name));
for (inx = 0; inx < loop/2; inx++) {
do {
lerr = XWAIT(LREQ, -1);
TEST_CHK_WAITIGNORE(lerr);
lerr = XMSG_LISTEN_((short *) &sre, // sre
0, // listenopts
0); // listenertag
} while (lerr == XSRETYPE_NOWORK);
ferr = XMSG_READCTRL_(sre.sre_msgId, // msgid
recv_buffer2, // reqctrl
1); // bytecount
util_check("XMSG_READCTRL_", ferr);
ferr = XMSG_READDATA_(sre.sre_msgId, // msgid
recv_buffer, // reqdata
BUFSIZ); // bytecount
util_check("XMSG_READDATA_", ferr);
strcat(recv_buffer, "- reply from ");
strcat(recv_buffer, my_name);
len = (int) strlen(recv_buffer) + 1;
XMSG_REPLY_(sre.sre_msgId, // msgid
recv_buffer2, // replyctrl
sre.sre_reqCtrlSize, // replyctrlsize
recv_buffer, // replydata
(ushort) len, // replydatasize
0, // errorclass
NULL); // newphandle
}
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
return 0;
}
示例10: pp_start_backup
void pp_start_backup(int nid) {
int ferr;
if (gshutdown) {
if (gverbosepp)
pp_printf("NOT starting backup process - shutdown.\n");
return;
}
nid = nid; // no-warn
ferr = msg_mon_get_process_info(NULL, &nid, &gpeer_pid);
TEST_CHK_FEOK(ferr);
for (;;) {
gpeer_nid = -1;
if (gnid == 1)
gpeer_nid = 2;
else
gpeer_nid = 1;
gpeer_pid = -1;
if (gverbosepp)
pp_printf("starting backup process with open, nid=%d.\n", gpeer_nid);
ferr = msg_mon_start_process(gprog, // prog
gname, // name
NULL, // ret name
gargc,
gargp,
TPT_REF(gpeer_phandle),
0, // open
&gpeer_oid,
MS_ProcessType_TSE, // type
0, // priority
0, // debug
1, // backup
&gpeer_nid, // nid
&gpeer_pid, // pid
NULL, // infile
NULL); // outfile
if (ferr == XZFIL_ERR_OK)
break;
printf("backup did not start error=%d\n", ferr);
sleep(1);
}
TEST_CHK_FEOK(ferr);
ferr = msg_mon_open_process_backup(gname,
TPT_REF(gpeer_phandle),
&gpeer_oid);
TEST_CHK_FEOK(ferr);
if (gverbosepp)
pp_printf("after start_backup - peer p-id=%d/%d\n",
gpeer_nid, gpeer_pid);
pp_pairinfo(true);
}
示例11: main
int main(int argc, char *argv[]) {
bool client = false;
int ferr;
char my_name[BUFSIZ];
int oid;
TPT_DECL (phandle);
TAD zargs[] = {
{ "-client", TA_Bool, TA_NOMAX, &client },
{ "-server", TA_Ign, TA_NOMAX, NULL },
{ "", TA_End, TA_NOMAX, NULL }
};
msg_mon_enable_mon_messages(true);
msfs_util_init(&argc, &argv, msg_debug_hook);
arg_proc_args(zargs, false, argc, argv);
util_test_start(client);
ferr = msg_mon_process_startup(true); // system messages
TEST_CHK_FEOK(ferr);
// process-wait for client/server/shell
ferr = msfs_util_wait_process_count(MS_ProcessType_Generic, 3, NULL, false);
TEST_CHK_FEOK(ferr);
if (client) {
ferr = msg_mon_open_process((char *) "$srv", // name
TPT_REF(phandle),
&oid);
TEST_CHK_FEOK(ferr);
do_readmsg(); // open message
} else {
do_readmsg(); // open message
ferr = msg_mon_open_process((char *) "$cli", // name
TPT_REF(phandle),
&oid);
TEST_CHK_FEOK(ferr);
}
util_gethostname(my_name, sizeof(my_name));
if (client) {
ferr = msg_mon_close_process(TPT_REF(phandle));
TEST_CHK_FEOK(ferr);
ferr = msg_mon_process_close();
TEST_CHK_FEOK(ferr);
printf("if there were no asserts, all is well\n");
} else {
ferr = msg_mon_process_close();
TEST_CHK_FEOK(ferr);
ferr = msg_mon_close_process(TPT_REF(phandle));
TEST_CHK_FEOK(ferr);
}
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
util_test_finish(client);
return 0;
}
示例12: main
int main(int argc, char *argv[]) {
int exit = false;
int err;
int ferr;
int len;
char recv_buffer[BUFSIZ];
BMS_SRE sre;
ferr = msg_init(&argc, &argv);
TEST_CHK_FEOK(ferr);
ferr = msg_mon_process_startup(true); // system messages?
TEST_CHK_FEOK(ferr);
msg_mon_enable_mon_messages(true);
for (;;) {
do {
err = XWAIT(LREQ, -1);
TEST_CHK_WAITIGNORE(err);
err = BMSG_LISTEN_((short *) &sre, // sre
0, // listenopts
0); // listenertag
} while (err == BSRETYPE_NOWORK);
ferr = BMSG_READDATA_(sre.sre_msgId, // msgid
recv_buffer, // reqdata
BUFSIZ); // bytecount
TEST_CHK_FEOK(ferr);
if ((sre.sre_flags & BSRE_MON)) {
MS_Mon_Msg *msg = (MS_Mon_Msg *) recv_buffer;
if (msg->type == MS_MsgType_Close)
exit = true;
}
strcat(recv_buffer, "- reply from server");
len = (int) strlen(recv_buffer) + 1;
BMSG_REPLY_(sre.sre_msgId, // msgid
NULL, // replyctrl
0, // replyctrlsize
recv_buffer, // replydata
len, // replydatasize
0, // errorclass
NULL); // newphandle
if (exit)
break;
}
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
return 0;
}
示例13: main
int main(int argc, char *argv[]) {
int exit;
int ferr;
int lerr;
char name[BUFSIZ];
char recv_buffer[BUFSIZ];
MS_SRE sre;
msfs_util_init_role(false, &argc, &argv, msg_debug_hook);
ferr = msg_mon_process_startup(true); // system messages
TEST_CHK_FEOK(ferr);
msg_mon_enable_mon_messages(true);
ferr = msg_mon_get_my_process_name(name, sizeof(name));
TEST_CHK_FEOK(ferr);
exit = 0;
while (!exit) {
do {
lerr = XWAIT(LREQ, -1);
TEST_CHK_WAITIGNORE(lerr);
lerr = XMSG_LISTEN_((short *) &sre, // sre
0, // listenopts
0); // listenertag
} while (lerr == XSRETYPE_NOWORK);
ferr = XMSG_READDATA_(sre.sre_msgId, // msgid
recv_buffer, // reqdata
BUFSIZ); // bytecount
util_check("XMSG_READDATA_", ferr);
if (sre.sre_flags & XSRE_MON) {
MS_Mon_Msg *msg = (MS_Mon_Msg *) recv_buffer;
printf("srv %s: mon message, type=%d\n", name, msg->type);
if (msg->type == MS_MsgType_Close)
exit = 1;
} else {
printf("srv %s: NON-mon message\n", name);
}
XMSG_REPLY_(sre.sre_msgId, // msgid
NULL, // replyctrl
0, // replyctrlsize
NULL, // replydata
0, // replydatasize
0, // errorclass
NULL); // newphandle
}
printf("server %s shutting down\n", name);
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
return 0;
}
示例14: pp_shutdown
void pp_shutdown() {
int ferr;
ferr = msg_mon_process_shutdown();
TEST_CHK_FEOK(ferr);
exit(0);
}
示例15: pp_checkpoint
int pp_checkpoint(void *buf, int *size) {
int ferr;
if (gim_backup) {
if (gverbosepp)
pp_printf("waiting for checkpoint.\n");
ferr = pp_recv(buf, size);
} else {
int msgid;
MS_Result_Type results;
if (gverbosepp)
pp_printf("sending checkpoint.\n");
ferr = XMSG_LINK_(TPT_REF(gpeer_phandle), // phandle
&msgid, // msgid
NULL, // reqctrl
0, // reqctrlsize
NULL, // replyctrl
0, // replyctrlmax
(char *) buf, // reqdata
(ushort) *size, // reqdatasize
NULL, // replydata
0, // replydatamax
0, // linkertag
0, // pri
0, // xmitclass
0); // linkopts
TEST_CHK_FEOK(ferr);
// ignore checkpoint error
ferr = XMSG_BREAK_(msgid, (short *) &results, TPT_REF(gpeer_phandle));
TEST_CHK_FEIGNORE(ferr);
}
return ferr;
}