1
1

Update unit test for name server replica

This commit was SVN r1848.
Этот коммит содержится в:
Ralph Castain 2004-08-03 15:58:08 +00:00
родитель fc814cb1b7
Коммит 772452105b

Просмотреть файл

@ -24,25 +24,14 @@
int main(int argc, char **argv)
{
ompi_process_name_t *test_name;
ompi_process_id_t test, job, tmpi, tmpj, tmpk;
mca_ns_base_cellid_t cell;
mca_ns_base_jobid_t job;
mca_ns_base_vpid_t vpid;
bool multi, hidden;
int i, j;
char *tmp;
/* get system info */
ompi_sys_info();
/* set us to be seed */
ompi_process_info.seed = true;
ompi_proc_info();
/* check that proc info made seed name */
if (NULL == ompi_process_info.name) {
fprintf(stderr, "seed name not made\n");
exit(1);
} else {
fprintf(stderr, "seed name made: %x %x %x\n", ompi_process_info.name->cellid,
ompi_process_info.name->jobid, ompi_process_info.name->vpid);
}
/* startup the MCA */
if (OMPI_SUCCESS == mca_base_open()) {
@ -74,16 +63,27 @@ int main(int argc, char **argv)
fprintf(stderr, "create process name failed\n");
exit(1);
} else {
fprintf(stderr, "got process name: %x %x %x\n", test_name->cellid, test_name->jobid, test_name->vpid);
fprintf(stderr, "got process name: %0X %0X %0X\n", test_name->cellid, test_name->jobid, test_name->vpid);
}
/* convert a string to a name */
tmp = strdup("1234.5678.9AEF");
test_name = ompi_name_server.convert_string_to_process_name(tmp);
if (NULL == test_name) { /* got error */
fprintf(stderr, "convert string to process name failed\n");
exit(1);
} else {
fprintf(stderr, "got process name: %0X(%ld) %0X(%ld) %0X(%ld)\n", test_name->cellid, test_name->cellid,
test_name->jobid, test_name->jobid, test_name->vpid, test_name->vpid);
}
/* create a cellid */
test = ompi_name_server.create_cellid();
if (0 == test) { /* got error */
fprintf(stderr, "create cellid: error %d\n", test);
cell = ompi_name_server.create_cellid();
if (0 == cell) { /* got error */
fprintf(stderr, "create cellid: error\n");
exit(1);
} else {
fprintf(stderr, "cellid created: %d\n", test);
fprintf(stderr, "cellid created: %d\n", cell);
}
for (i=0; i<10; i++) { /* loop through */
@ -98,16 +98,16 @@ int main(int argc, char **argv)
for (j=0; j<5; j++) { /* loop through several vpid ranges */
/* get range of vpids */
test = ompi_name_server.reserve_range(job, 250);
if (0 == test) { /* got error */
vpid = ompi_name_server.reserve_range(job, 250);
if (0 == vpid) { /* got error */
fprintf(stderr, "get range: error\n");
exit(1);
} else {
fprintf(stderr, "range reserved: %d\n", test);
fprintf(stderr, "range reserved: %d\n", vpid);
}
/* create a name */
test_name = ompi_name_server.create_process_name((ompi_process_id_t)i, job, test);
test_name = ompi_name_server.create_process_name((mca_ns_base_cellid_t)i, job, vpid);
/* get and print its string values */
tmp = ompi_name_server.get_proc_name_string(test_name);
@ -119,10 +119,12 @@ int main(int argc, char **argv)
tmp = ompi_name_server.get_cellid_string(test_name);
fprintf(stderr, "\tcellid: %s\n", tmp);
tmpi = ompi_name_server.get_vpid(test_name);
tmpj = ompi_name_server.get_jobid(test_name);
tmpk = ompi_name_server.get_cellid(test_name);
fprintf(stderr, "(%d) ints cell %x job %x vpid %x\n\n", i, tmpk, tmpj, tmpi);
/* get and print its numeric values */
vpid = ompi_name_server.get_vpid(test_name);
job = ompi_name_server.get_jobid(test_name);
cell = ompi_name_server.get_cellid(test_name);
fprintf(stderr, "(%d) ints cell %0X(%ld) job %0X(%ld) vpid %0x(%ld)\n\n", i,
cell, cell, job, job, vpid, vpid);
}
}