1
1
1. *correctly* fix the printing of size_t variables. Need to do this through a #define, not just typecast things. Thanks to Jeff/Brian for suggesting a cleaner way to do it (as opposed to just doing the #define at the print location). Note that not ALL of the prints have been "fixed" yet - will continue to identify them.

2. Add int64 and size_t to the pack/unpack unit tests.

3. Fix a bug in the int64 pack/unpack system.

This commit was SVN r5570.
Этот коммит содержится в:
Ralph Castain 2005-05-02 14:48:57 +00:00
родитель 68697d9dab
Коммит 931924397c
6 изменённых файлов: 187 добавлений и 68 удалений

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

@ -251,7 +251,7 @@ int orte_dps_pack_int64(orte_buffer_t *buffer, void *src,
}
dsttmp = (uint32_t*)dst;
for (i = 0; i < num_vals; i += 2) {
for (i = 0; i < 2*num_vals; i += 2) {
tmp = htonl(srctmp[i]);
memcpy(&dsttmp[i], &tmp, sizeof(tmp));
tmp = htonl(srctmp[i+1]);

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

@ -86,9 +86,17 @@ typedef uint8_t orte_data_type_t ;
/* define the starting point for dynamically assigning data types */
#define ORTE_DPS_ID_DYNAMIC 50
/* define a structure to hold generic byte objects */
typedef struct {
size_t size;
uint8_t *bytes;
} orte_byte_object_t;
/* define a print format to handle the variations in size_t */
#if SIZEOF_SIZE_T == SIZEOF_INT
#define ORTE_SIZE_T_PRINTF "%u"
#elif SIZEOF_SIZE_T == SIZE_OF_LONG
#define ORTE_SIZE_T_PRINTF "%lu"
#endif
#endif

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

@ -51,13 +51,15 @@ int orte_gpr_base_dump_notify_msg(orte_buffer_t *buffer,
return ORTE_SUCCESS;
}
asprintf(&tmp_out, "%d Notify data structures in message going to trigger %d",
msg->cnt, msg->idtag);
asprintf(&tmp_out, ORTE_SIZE_T_PRINTF
" Notify data structures in message going to trigger "
ORTE_SIZE_T_PRINTF,
msg->cnt, msg->idtag);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (0 < msg->cnt && NULL != msg->data) {
for (i=0; i < msg->cnt; i++) {
asprintf(&tmp_out, "\nDump of data structure %d", i);
asprintf(&tmp_out, "\nDump of data structure " ORTE_SIZE_T_PRINTF, i);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_data(buffer, msg->data[i]);
}
@ -91,14 +93,15 @@ static void orte_gpr_base_dump_data(orte_buffer_t *buffer,
orte_gpr_value_t **values;
size_t i;
asprintf(&tmp_out, "%d Values from segment %s", data->cnt, data->segment);
asprintf(&tmp_out, ORTE_SIZE_T_PRINTF " Values from segment %s", data->cnt, data->segment);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (0 < data->cnt && NULL != data->values) {
values = data->values;
for (i=0; i < data->cnt; i++) {
asprintf(&tmp_out, "\nData for value %d going to callback num %d",
i, data->cb_num);
asprintf(&tmp_out, "\nData for value " ORTE_SIZE_T_PRINTF
" going to callback num " ORTE_SIZE_T_PRINTF,
i, data->cb_num);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
if (NULL == values[i]) {
asprintf(&tmp_out, "\tError encountered: NULL value pointer");
@ -116,7 +119,7 @@ int orte_gpr_base_dump_value(orte_buffer_t *buffer, orte_gpr_value_t *value)
orte_gpr_addr_mode_t addr;
size_t j;
asprintf(&tmp_out, "\tValue from segment %s with %d keyvals",
asprintf(&tmp_out, "\tValue from segment %s with " ORTE_SIZE_T_PRINTF " keyvals",
value->segment, value->cnt);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
@ -125,10 +128,10 @@ int orte_gpr_base_dump_value(orte_buffer_t *buffer, orte_gpr_value_t *value)
asprintf(&tmp_out, "\tNULL tokens (wildcard)");
orte_gpr_base_dump_load_string(buffer, &tmp_out);
} else {
asprintf(&tmp_out, "\t%d Tokens returned", value->num_tokens);
asprintf(&tmp_out, "\t" ORTE_SIZE_T_PRINTF " Tokens returned", value->num_tokens);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
for (j=0; j < value->num_tokens; j++) {
asprintf(&tmp_out, "\tToken %d: %s", j, value->tokens[j]);
asprintf(&tmp_out, "\tToken " ORTE_SIZE_T_PRINTF ": %s", j, value->tokens[j]);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
}
}
@ -183,7 +186,7 @@ int orte_gpr_base_dump_value(orte_buffer_t *buffer, orte_gpr_value_t *value)
}
for (j=0; j < value->cnt; j++) {
asprintf(&tmp_out, "\t\tData for keyval %d: Key: %s", j,
asprintf(&tmp_out, "\t\tData for keyval " ORTE_SIZE_T_PRINTF ": Key: %s", j,
(value->keyvals[j])->key);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_keyval_value(buffer, value->keyvals[j]);
@ -215,7 +218,7 @@ void orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer, orte_gpr_keyval_t *i
break;
case ORTE_SIZE:
asprintf(&tmp_out, "\t\t\tData type: ORTE_SIZE:\tValue: %d", iptr->value.size);
asprintf(&tmp_out, "\t\t\tData type: ORTE_SIZE:\tValue: " ORTE_SIZE_T_PRINTF, iptr->value.size);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
@ -269,27 +272,35 @@ void orte_gpr_base_dump_keyval_value(orte_buffer_t *buffer, orte_gpr_keyval_t *i
#endif
case ORTE_BYTE_OBJECT:
asprintf(&tmp_out, "\t\t\tData type: ORTE_BYTE_OBJECT\tSize: %d", (int)(iptr->value.byteobject).size);
asprintf(&tmp_out, "\t\t\tData type: ORTE_BYTE_OBJECT\tSize: "
ORTE_SIZE_T_PRINTF, (iptr->value.byteobject).size);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_NAME:
asprintf(&tmp_out, "\t\t\tData type: ORTE_NAME\tValue: [%d,%d,%d]", ORTE_NAME_ARGS(&(iptr->value.proc)));
asprintf(&tmp_out, "\t\t\tData type: ORTE_NAME\tValue: ["
ORTE_SIZE_T_PRINTF ","
ORTE_SIZE_T_PRINTF ","
ORTE_SIZE_T_PRINTF "]",
ORTE_NAME_ARGS(&(iptr->value.proc)));
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_VPID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_VPID\tValue: %d", (int)iptr->value.vpid);
asprintf(&tmp_out, "\t\t\tData type: ORTE_VPID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.vpid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_JOBID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_JOBID\tValue: %d", (int)iptr->value.jobid);
asprintf(&tmp_out, "\t\t\tData type: ORTE_JOBID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.jobid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;
case ORTE_CELLID:
asprintf(&tmp_out, "\t\t\tData type: ORTE_CELLID\tValue: %d", (int)iptr->value.cellid);
asprintf(&tmp_out, "\t\t\tData type: ORTE_CELLID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.cellid);
orte_gpr_base_dump_load_string(buffer, &tmp_out);
break;

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

@ -28,6 +28,7 @@
#include "include/orte_constants.h"
#include "include/orte_types.h"
#include "dps/dps.h"
#include "mca/errmgr/errmgr.h"
#include "util/output.h"
#include "mca/gpr/base/base.h"
@ -36,9 +37,16 @@ int orte_gpr_base_print_dump(orte_buffer_t *buffer, int output_id)
{
char *line;
size_t n;
orte_data_type_t type;
int rc;
n = 1;
while (ORTE_SUCCESS == orte_dps.unpack(buffer, &line, &n, ORTE_STRING)) {
while (ORTE_SUCCESS == orte_dps.peek(buffer, &type, &n)) {
if (ORTE_SUCCESS !=
(rc = orte_dps.unpack(buffer, &line, &n, ORTE_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
ompi_output(output_id, "%s", line);
free(line);
n=1;

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

@ -95,15 +95,17 @@ int orte_gpr_replica_dump_segments_fn(orte_buffer_t *buffer)
num_objects = (seg[i]->containers)->size - (seg[i]->containers)->number_free;
sprintf(tmp_out, "\tNumber of containers: %d\n", (int)num_objects);
sprintf(tmp_out, "\tNumber of containers: " ORTE_SIZE_T_PRINTF "\n", num_objects);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
/* loop through all containers and print their info and contents */
cptr = (orte_gpr_replica_container_t**)(seg[i]->containers)->addr;
for (j=0; j < (seg[i]->containers)->size; j++) {
if (NULL != cptr[j]) {
sprintf(tmp_out, "\n\tInfo for container %lu\tNumber of keyvals: %lu\n\tTokens:\n",
(unsigned long)j, (unsigned long)(cptr[j]->itagvals)->size - (cptr[j]->itagvals)->number_free);
sprintf(tmp_out, "\n\tInfo for container " ORTE_SIZE_T_PRINTF
"\tNumber of keyvals: " ORTE_SIZE_T_PRINTF
"\n\tTokens:\n",
j, (cptr[j]->itagvals)->size - (cptr[j]->itagvals)->number_free);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
/* reverse lookup tokens and print them */
@ -111,11 +113,14 @@ int orte_gpr_replica_dump_segments_fn(orte_buffer_t *buffer)
for (k=0; k < cptr[j]->num_itags; k++) {
if (ORTE_SUCCESS != orte_gpr_replica_dict_reverse_lookup(
&token, seg[i], itaglist[k])) {
sprintf(tmp_out, "\t\titag num %d: No entry found for itag %X",
(uint32_t)k, (uint32_t)itaglist[k]);
sprintf(tmp_out, "\t\titag num " ORTE_SIZE_T_PRINTF
": No entry found for itag "
ORTE_SIZE_T_PRINTF,
k, itaglist[k]);
} else {
sprintf(tmp_out, "\t\titag num %d: itag %d\tToken: %s",
(uint32_t)k, (uint32_t)itaglist[k], token);
sprintf(tmp_out, "\t\titag num " ORTE_SIZE_T_PRINTF
": itag " ORTE_SIZE_T_PRINTF "\tToken: %s",
k, itaglist[k], token);
free(token);
}
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
@ -130,11 +135,14 @@ int orte_gpr_replica_dump_segments_fn(orte_buffer_t *buffer)
if (NULL != iptr[k]) {
if (ORTE_SUCCESS != orte_gpr_replica_dict_reverse_lookup(
&token, seg[i], iptr[k]->itag)) {
sprintf(tmp_out, "\n\t\titag num %d: No entry found for itag %lX",
(int32_t)k, (unsigned long)iptr[k]->itag);
sprintf(tmp_out, "\n\t\titag num " ORTE_SIZE_T_PRINTF
": No entry found for itag "
ORTE_SIZE_T_PRINTF,
k, iptr[k]->itag);
} else {
sprintf(tmp_out, "\n\t\tEntry %d: itag %lX\tKey: %s",
(int32_t)k, (unsigned long)iptr[k]->itag, token);
sprintf(tmp_out, "\n\t\tEntry " ORTE_SIZE_T_PRINTF
": itag " ORTE_SIZE_T_PRINTF "\tKey: %s",
k, iptr[k]->itag, token);
free(token);
}
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
@ -173,7 +181,7 @@ int orte_gpr_replica_dump_callbacks_fn(orte_buffer_t *buffer)
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
} else {
sprintf(tmp_out, "--- %lu callback(s) registered at this time", (unsigned long)k);
sprintf(tmp_out, "--- " ORTE_SIZE_T_PRINTF " callback(s) registered at this time", k);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
}
@ -182,11 +190,11 @@ int orte_gpr_replica_dump_callbacks_fn(orte_buffer_t *buffer)
cb != (orte_gpr_replica_callbacks_t*)ompi_list_get_end(&(orte_gpr_replica.callbacks));
cb = (orte_gpr_replica_callbacks_t*)ompi_list_get_next(cb)) {
if (NULL == cb) {
sprintf(tmp_out, "\n\t--- BAD CALLBACK POINTER %lu ---", (unsigned long)i);
sprintf(tmp_out, "\n\t--- BAD CALLBACK POINTER " ORTE_SIZE_T_PRINTF " ---", i);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
return ORTE_SUCCESS;
}
sprintf(tmp_out, "\nInfo for callback %lu", (unsigned long)i);
sprintf(tmp_out, "\nInfo for callback " ORTE_SIZE_T_PRINTF, i);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
if (NULL == cb->requestor) {
sprintf(tmp_out, "Local requestor");
@ -195,14 +203,16 @@ int orte_gpr_replica_dump_callbacks_fn(orte_buffer_t *buffer)
}
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
j = ompi_list_get_size(&(cb->messages));
sprintf(tmp_out, "Num messages: %lu", (unsigned long)j);
sprintf(tmp_out, "Num messages: " ORTE_SIZE_T_PRINTF, j);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
for (k=0, item = ompi_list_get_first(&(cb->messages));
item != ompi_list_get_end(&(cb->messages));
item = ompi_list_get_next(item), k++) {
msg = (orte_gpr_replica_notify_msg_list_t*)item;
sprintf(tmp_out, "\n\nInfo for message %u sending %lu data objects to notifier id %lu",
(int32_t)k, (unsigned long)(msg->message)->cnt, (unsigned long)(msg->message)->idtag);
sprintf(tmp_out, "\n\nInfo for message " ORTE_SIZE_T_PRINTF
" sending " ORTE_SIZE_T_PRINTF
" data objects to notifier id " ORTE_SIZE_T_PRINTF,
k, (msg->message)->cnt, (msg->message)->idtag);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
orte_gpr_base_dump_notify_msg(buffer, msg->message);
}
@ -232,7 +242,7 @@ int orte_gpr_replica_dump_triggers_fn(orte_buffer_t *buffer)
if (NULL != trig[j]) k++;
}
sprintf(tmp_out, "Number of triggers: %lu\n", (unsigned long)k);
sprintf(tmp_out, "Number of triggers: " ORTE_SIZE_T_PRINTF "\n", k);
orte_gpr_replica_dump_load_string(buffer, &tmp);
/* dump the trigger info for the registry */
@ -260,16 +270,18 @@ static void orte_gpr_replica_dump_trigger(orte_buffer_t *buffer, size_t cnt,
return;
}
sprintf(tmp_out, "\nData for trigger %lu", (unsigned long)cnt);
sprintf(tmp_out, "\nData for trigger " ORTE_SIZE_T_PRINTF, cnt);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
/* output recipient info */
if (NULL == trig->requestor) {
sprintf(tmp_out, "\tIntended recipient: LOCAL @ notifier idtag %lu",
(unsigned long)trig->index);
sprintf(tmp_out, "\tIntended recipient: LOCAL @ notifier idtag "
ORTE_SIZE_T_PRINTF,
trig->index);
} else {
sprintf(tmp_out, "\tIntended recipient: [%d,%d,%d] @ notifier idtag %lu",
ORTE_NAME_ARGS(trig->requestor), (unsigned long)trig->remote_idtag);
sprintf(tmp_out, "\tIntended recipient: [%d,%d,%d] @ notifier idtag "
ORTE_SIZE_T_PRINTF,
ORTE_NAME_ARGS(trig->requestor), trig->remote_idtag);
}
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
@ -336,7 +348,7 @@ static void orte_gpr_replica_dump_trigger(orte_buffer_t *buffer, size_t cnt,
sprintf(tmp_out, "\t\tNULL token (wildcard)");
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
} else {
sprintf(tmp_out, "\t\tNumber of tokens: %lu", (unsigned long)k);
sprintf(tmp_out, "\t\tNumber of tokens: " ORTE_SIZE_T_PRINTF, k);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
for (j=0; j < k; j++) {
@ -378,7 +390,7 @@ static void orte_gpr_replica_dump_trigger(orte_buffer_t *buffer, size_t cnt,
sprintf(tmp_out, "\t\tNULL key (wildcard)");
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
} else {
sprintf(tmp_out, "\t\tNumber of keys: %lu", (unsigned long)k);
sprintf(tmp_out, "\t\tNumber of keys: " ORTE_SIZE_T_PRINTF, k);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
for (j=0; j < k; j++) {
@ -420,9 +432,9 @@ static void orte_gpr_replica_dump_trigger(orte_buffer_t *buffer, size_t cnt,
if (0 < trig->num_counters) {
if (ORTE_GPR_TRIG_AT_LEVEL & trig->action) {
sprintf(tmp_out, "\tTrigger monitoring %lu counters for level", (unsigned long)trig->num_counters);
sprintf(tmp_out, "\tTrigger monitoring " ORTE_SIZE_T_PRINTF " counters for level", trig->num_counters);
} else {
sprintf(tmp_out, "\tTrigger monitoring %lu counters for compare", (unsigned long)trig->num_counters);
sprintf(tmp_out, "\tTrigger monitoring " ORTE_SIZE_T_PRINTF " counters for compare", trig->num_counters);
}
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
cntr = (orte_gpr_replica_counter_t**)((trig->counters)->addr);
@ -430,7 +442,7 @@ static void orte_gpr_replica_dump_trigger(orte_buffer_t *buffer, size_t cnt,
if (NULL != cntr[i] &&
ORTE_SUCCESS == orte_gpr_replica_dict_reverse_lookup(&token, cntr[i]->seg,
(cntr[i]->iptr)->itag)) {
sprintf(tmp_out, "\t\tCounter: %lu\tSegment: %s\tName: %s", (unsigned long)i,
sprintf(tmp_out, "\t\tCounter: " ORTE_SIZE_T_PRINTF "\tSegment: %s\tName: %s", i,
(cntr[i]->seg)->name, token);
free(token);
orte_gpr_replica_dump_load_string(buffer, &tmp_out);
@ -472,7 +484,8 @@ void orte_gpr_replica_dump_itagval_value(orte_buffer_t *buffer,
break;
case ORTE_SIZE:
sprintf(tmp, "\t\tData type: ORTE_SIZE\tValue: %lu", (unsigned long)iptr->value.size);
sprintf(tmp, "\t\tData type: ORTE_SIZE\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.size);
break;
case ORTE_INT:
@ -516,23 +529,31 @@ void orte_gpr_replica_dump_itagval_value(orte_buffer_t *buffer,
#endif
case ORTE_BYTE_OBJECT:
sprintf(tmp, "\t\tData type: ORTE_BYTE_OBJECT\tSize: %d", (int)(iptr->value.byteobject).size);
sprintf(tmp, "\t\tData type: ORTE_BYTE_OBJECT\tSize: " ORTE_SIZE_T_PRINTF,
(iptr->value.byteobject).size);
break;
case ORTE_NAME:
sprintf(tmp, "\t\tData type: ORTE_NAME\tValue: [%d,%d,%d]", ORTE_NAME_ARGS(&(iptr->value.proc)));
sprintf(tmp, "\t\tData type: ORTE_NAME\tValue: ["
ORTE_SIZE_T_PRINTF ","
ORTE_SIZE_T_PRINTF ","
ORTE_SIZE_T_PRINTF "]",
ORTE_NAME_ARGS(&(iptr->value.proc)));
break;
case ORTE_VPID:
sprintf(tmp, "\t\tData type: ORTE_VPID\tValue: %d", (int)iptr->value.vpid);
sprintf(tmp, "\t\tData type: ORTE_VPID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.vpid);
break;
case ORTE_JOBID:
sprintf(tmp, "\t\tData type: ORTE_JOBID\tValue: %d", (int)iptr->value.jobid);
sprintf(tmp, "\t\tData type: ORTE_JOBID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.jobid);
break;
case ORTE_CELLID:
sprintf(tmp, "\t\tData type: ORTE_CELLID\tValue: %d", (int)iptr->value.cellid);
sprintf(tmp, "\t\tData type: ORTE_CELLID\tValue: " ORTE_SIZE_T_PRINTF,
iptr->value.cellid);
break;
case ORTE_NODE_STATE:

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

@ -52,6 +52,7 @@ static bool test1(void); /* verify different buffer inits */
static bool test2(void); /* verify int16 */
static bool test2_1(void); /* verify int */
static bool test3(void); /* verify int32 */
static bool test3_1(void); /* verify int64 */
static bool test4(void); /* verify string */
static bool test5(void); /* verify name */
static bool test6(void); /* verify BOOL */
@ -59,7 +60,7 @@ static bool test7(void); /* verify OBJECT */
static bool test8(void); /* verify composite (multiple types and element counts) */
static bool test9(void); /* verify GPR_KEYVAL */
static bool test10(void); /* verify GPR_VALUE */
static bool test11(void); /* verify APP_INFO (right now ??!!) */
static bool test11(void); /* verify size_t */
static bool test12(void); /* verify APP_CONTEXT */
static bool test13(void); /* verify ORTE_GPR_SUBSCRIPTION */
static bool test14(void); /* verify ORTE_GPR_NOTIFY_DATA */
@ -185,6 +186,14 @@ int main (int argc, char* argv[])
test_failure("orte_dps test3 failed");
}
fprintf(test_out, "executing test3_1\n");
if (test3_1()) {
test_success();
}
else {
test_failure("orte_dps test3_1 failed");
}
fprintf(test_out, "executing test4\n");
if (test4()) {
test_success();
@ -486,6 +495,68 @@ static bool test3(void)
return (true);
}
/*
* ORTE_INT64 pack/unpack
*/
static bool test3_1(void)
{
orte_buffer_t *bufA;
int rc;
size_t i;
int64_t src[NUM_ELEMS];
int64_t dst[NUM_ELEMS];
for(i=0; i<NUM_ELEMS; i++)
src[i] = 1000*i;
bufA = OBJ_NEW(orte_buffer_t);
if (NULL == bufA) {
test_comment("orte_buffer failed init in OBJ_NEW");
fprintf(test_out, "OBJ_NEW failed\n");
return false;
}
for (i=0;i<NUM_ITERS;i++) {
rc = orte_dps.pack(bufA, src, NUM_ELEMS, ORTE_INT64);
if (ORTE_SUCCESS != rc) {
test_comment ("orte_dps.pack failed");
fprintf(test_out, "orte_pack_int64 failed with return code %d\n", rc);
return(false);
}
}
for (i=0; i<NUM_ITERS; i++) {
int j;
size_t count = NUM_ELEMS;
for(j=0; j<NUM_ELEMS; j++)
dst[j] = -1;
rc = orte_dps.unpack(bufA, dst, &count, ORTE_INT64);
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
test_comment ("orte_dps.unpack failed");
fprintf(test_out, "orte_unpack_int64 failed with return code %d\n", rc);
return(false);
}
for(j=0; j<NUM_ELEMS; j++) {
if(src[j] != dst[j]) {
test_comment ("test2: invalid results from unpack int64");
return(false);
}
}
}
OBJ_RELEASE(bufA);
if (NULL != bufA) {
test_comment("OBJ_RELEASE did not NULL the buffer pointer");
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer");
return false;
}
return (true);
}
/*
* OMPI_STRING pack/unpack
*/
@ -1176,17 +1247,17 @@ static bool test10(void)
}
/* ORTE_APP_INFO */
/* size_t */
static bool test11(void)
{
orte_buffer_t *bufA;
int rc;
int32_t i;
bool src[NUM_ELEMS];
bool dst[NUM_ELEMS];
size_t i;
size_t src[NUM_ELEMS];
size_t dst[NUM_ELEMS];
for(i=0; i<NUM_ELEMS; i++)
src[i] = ((i % 2) == 0) ? true : false;
src[i] = 1000*i;
bufA = OBJ_NEW(orte_buffer_t);
if (NULL == bufA) {
@ -1196,29 +1267,29 @@ static bool test11(void)
}
for (i=0;i<NUM_ITERS;i++) {
rc = orte_dps.pack(bufA, src, NUM_ELEMS, ORTE_BOOL);
rc = orte_dps.pack(bufA, src, NUM_ELEMS, ORTE_SIZE);
if (ORTE_SUCCESS != rc) {
test_comment ("orte_dps.pack failed");
fprintf(test_out, "orte_pack_value failed with return code %d\n", rc);
test_comment ("orte_dps.pack size_t failed");
fprintf(test_out, "orte_pack_size_t failed with return code %d\n", rc);
return(false);
}
}
for (i=0; i<NUM_ITERS; i++) {
int j;
size_t count = NUM_ELEMS;
memset(dst,-1,sizeof(dst));
size_t j;
size_t count;
rc = orte_dps.unpack(bufA, dst, &count, ORTE_BOOL);
count = NUM_ELEMS;
rc = orte_dps.unpack(bufA, dst, &count, ORTE_SIZE);
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
test_comment ("orte_dps.unpack failed");
fprintf(test_out, "orte_pack_value failed with return code %d\n", rc);
test_comment ("orte_dps.unpack size_t failed");
fprintf(test_out, "orte_unpack_size_t failed with return code %d\n", rc);
return(false);
}
for(j=0; j<NUM_ELEMS; j++) {
if(src[j] != dst[j]) {
test_comment ("test6: invalid results from unpack");
test_comment ("test2: invalid results from unpack size_t");
return(false);
}
}