2006-12-02 01:30:39 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal_config.h"
|
|
|
|
#include "opal/constants.h"
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
2009-05-01 19:09:10 +04:00
|
|
|
#include <string.h>
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
#include "opal/runtime/opal.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/dss/dss.h"
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
#define NUM_ITERS 100
|
|
|
|
#define NUM_ELEMS 1024
|
|
|
|
|
|
|
|
static bool test1(void); /* verify different buffer inits */
|
|
|
|
static bool test2(void); /* verify int16 */
|
|
|
|
static bool test3(void); /* verify int */
|
|
|
|
static bool test4(void); /* verify int32 */
|
|
|
|
static bool test5(void); /* verify int64 */
|
|
|
|
static bool test6(void); /* verify string */
|
|
|
|
static bool test7(void); /* verify BOOL */
|
|
|
|
static bool test8(void); /* verify OBJECT */
|
|
|
|
static bool test9(void); /* verify composite (multiple types and element counts) */
|
|
|
|
static bool test10(void); /* verify KEYVAL */
|
2008-02-28 04:57:57 +03:00
|
|
|
static bool test11(void); /* verify int32_t */
|
2006-12-02 01:30:39 +03:00
|
|
|
static bool test12(void); /* verify pid_t */
|
|
|
|
|
|
|
|
FILE *test_out;
|
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char* argv[])
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_init();
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
test_out = stderr;
|
|
|
|
|
|
|
|
/* run the tests */
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test1\n");
|
|
|
|
if (test1()) {
|
|
|
|
fprintf(test_out, "Test1 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test1 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test2\n");
|
|
|
|
if (test2()) {
|
|
|
|
fprintf(test_out, "Test2 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test2 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test3\n");
|
|
|
|
if (test3()) {
|
|
|
|
fprintf(test_out, "Test3 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test3 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test4\n");
|
|
|
|
if (test4()) {
|
|
|
|
fprintf(test_out, "Test4 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test4 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test5\n");
|
|
|
|
if (test5()) {
|
|
|
|
fprintf(test_out, "Test5 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test5 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test6\n");
|
|
|
|
if (test6()) {
|
|
|
|
fprintf(test_out, "Test6 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test6 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test7\n");
|
|
|
|
if (test7()) {
|
|
|
|
fprintf(test_out, "Test7 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test7 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test8\n");
|
|
|
|
if (test8()) {
|
|
|
|
fprintf(test_out, "Test8 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(test_out, "Test8 failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test9\n");
|
|
|
|
if (test9()) {
|
|
|
|
fprintf(test_out, "Test9 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "opal_dss test9 failed\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test10\n");
|
|
|
|
if (test10()) {
|
|
|
|
fprintf(test_out, "Test10 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "opal_dss test10 failed\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test11\n");
|
|
|
|
if (test11()) {
|
|
|
|
fprintf(test_out, "Test11 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "opal_dss test11 failed\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(test_out, "executing test12\n");
|
|
|
|
if (test12()) {
|
|
|
|
fprintf(test_out, "Test12 succeeded\n");
|
|
|
|
}
|
|
|
|
else {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "opal_dss test12 failed\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose(test_out);
|
|
|
|
|
|
|
|
opal_finalize();
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool test1(void) /* verify different buffer inits */
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OMPI_INT16 pack/unpack
|
|
|
|
*/
|
|
|
|
static bool test2(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
int16_t src[NUM_ELEMS];
|
|
|
|
int16_t dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_dss.set_buffer_type(bufA, OPAL_DSS_BUFFER_NON_DESC);
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT16);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
|
|
dst[j] = -1;
|
|
|
|
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_INT16);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test2: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OMPI_INT pack/unpack
|
|
|
|
*/
|
|
|
|
static bool test3(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
int src[NUM_ELEMS];
|
|
|
|
int dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
|
|
dst[j] = -1;
|
|
|
|
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_INT);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test2: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OMPI_INT32 pack/unpack
|
|
|
|
*/
|
|
|
|
static bool test4(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
int32_t src[NUM_ELEMS];
|
|
|
|
int32_t dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
|
|
dst[j] = -1;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test2: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-02-28 04:57:57 +03:00
|
|
|
* OPAL_INT64 pack/unpack
|
2006-12-02 01:30:39 +03:00
|
|
|
*/
|
|
|
|
static bool test5(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t i;
|
2006-12-02 01:30:39 +03:00
|
|
|
int64_t src[NUM_ELEMS];
|
|
|
|
int64_t dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = 1000*i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT64);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack int64 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
|
|
dst[j] = -1;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_INT64);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack int64 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test2: invalid results from unpack int64\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OMPI_STRING pack/unpack
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool test6(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
char* src[NUM_ELEMS];
|
|
|
|
char* dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++) {
|
|
|
|
asprintf(&src[i], "%d", i);
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_STRING);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
|
|
dst[j] = NULL;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_STRING);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(strcmp(src[j],dst[j]) != 0) {
|
|
|
|
fprintf(test_out, "test4: invalid results from unpack\n");
|
|
|
|
fprintf(test_out, "item %d src=[%s] len=%d dst=[%s] len=%d\n", j, src[j], (int)strlen(src[j]), dst[j], (int)strlen(dst[j]));
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OMPI_BOOL pack/unpack
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool test7(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
bool src[NUM_ELEMS];
|
|
|
|
bool dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = ((i % 2) == 0) ? true : false;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_BOOL);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
memset(dst,-1,sizeof(dst));
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_BOOL);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test6: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OMPI_BYTE_OBJECT pack/unpack
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool test8(void)
|
|
|
|
{
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_byte_object_t *src[NUM_ELEMS];
|
|
|
|
opal_byte_object_t *dst[NUM_ELEMS];
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
src[i] = (opal_byte_object_t*)malloc(sizeof(opal_byte_object_t));
|
2006-12-02 01:30:39 +03:00
|
|
|
asprintf((char**)&(src[i]->bytes), "%d", i);
|
|
|
|
src[i]->size = strlen((char*)(src[i]->bytes)) + 1;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_BYTE_OBJECT);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_BYTE_OBJECT);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j]->size != dst[j]->size ||
|
|
|
|
memcmp(src[j]->bytes,dst[j]->bytes,src[j]->size) != 0) {
|
|
|
|
fprintf(test_out, "test7: invalid results from unpack\n");
|
|
|
|
fprintf(test_out, "test7: object element %d has incorrect unpacked value\n", j);
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ompi everything composite multipack/unpack
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool test9(void)
|
|
|
|
{
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
/* pack and unpack in this order */
|
|
|
|
/* each block now has an offset to make debugging easier.. first block=100, 200,... */
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_byte_object_t *srco[NUM_ELEMS];
|
|
|
|
opal_byte_object_t *dsto[NUM_ELEMS];
|
2006-12-02 01:30:39 +03:00
|
|
|
char* srcs[NUM_ELEMS];
|
|
|
|
char* dsts[NUM_ELEMS];
|
|
|
|
bool srcb[NUM_ELEMS];
|
|
|
|
bool dstb[NUM_ELEMS];
|
|
|
|
int32_t src32[NUM_ELEMS];
|
|
|
|
int32_t dst32[NUM_ELEMS];
|
|
|
|
int16_t src16[NUM_ELEMS];
|
|
|
|
int16_t dst16[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++) {
|
|
|
|
/* object offset 100 */
|
2008-02-28 04:57:57 +03:00
|
|
|
srco[i] = (opal_byte_object_t*)malloc(sizeof(opal_byte_object_t));
|
2006-12-02 01:30:39 +03:00
|
|
|
asprintf((char**)&(srco[i]->bytes), "%d", i+100);
|
|
|
|
srco[i]->size = strlen((char*)(srco[i]->bytes)) + 1;
|
|
|
|
|
|
|
|
/* strings +200 */
|
|
|
|
asprintf(&srcs[i], "%d", i+200);
|
|
|
|
|
|
|
|
/* bool */
|
|
|
|
srcb[i] = ((i % 2) == 0) ? true : false;
|
|
|
|
|
|
|
|
/* INT32 +300 */
|
|
|
|
src32[i] = i+300;
|
|
|
|
|
|
|
|
/* INT16 +400 */
|
|
|
|
src16[i] = i+400;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
|
|
|
/* object first */
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, srco, NUM_ELEMS, OPAL_BYTE_OBJECT);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack on object failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
/* STRING */
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, srcs, NUM_ELEMS, OPAL_STRING);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack on string failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
/* BOOL */
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, srcb, NUM_ELEMS, OPAL_BOOL);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack on bool failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
/* INT32 */
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src32, NUM_ELEMS, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack on INT32 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
/* INT16 */
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src16, NUM_ELEMS, OPAL_INT16);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack on INT16 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fprintf(test_out,"test8:packed buffer info for STRING with %d iterations %d elements each\n", NUM_ITERS, NUM_ELEMS); */
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
/* string */
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) dsts[j] = NULL;
|
|
|
|
/* bool */
|
|
|
|
memset(dstb,-1,sizeof(dstb));
|
|
|
|
/* int32 */
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) dst32[j] = -1;
|
|
|
|
/* int16 */
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) dst16[j] = -1;
|
|
|
|
|
|
|
|
|
|
|
|
/* object */
|
|
|
|
count=NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dsto, &count, OPAL_BYTE_OBJECT);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack on object failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(srco[j]->size != dsto[j]->size ||
|
|
|
|
memcmp(srco[j]->bytes,dsto[j]->bytes,srco[j]->size) != 0) {
|
|
|
|
fprintf(test_out, "test8: object element %d has incorrect unpacked value\n", j);
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* string */
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dsts, &count, OPAL_STRING);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack on string failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(strcmp(srcs[j],dsts[j]) != 0) {
|
|
|
|
fprintf(test_out, "test8: invalid results from unpack\n");
|
|
|
|
fprintf(test_out, "item %d src=[%s] len=%d dst=[%s] len=%d\n", j, srcs[j], (int)strlen(srcs[j]), dsts[j], (int)strlen(dsts[j]));
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bool */
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dstb, &count, OPAL_BOOL);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack on bool failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(srcb[j] != dstb[j]) {
|
|
|
|
fprintf(test_out, "test8: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* int32 */
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst32, &count, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack on int32 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src32[j] != dst32[j]) {
|
|
|
|
fprintf(test_out, "test8: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* int16 */
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst16, &count, OPAL_INT16);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack on int16 failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src16[j] != dst16[j]) {
|
|
|
|
fprintf(test_out, "test8: invalid results from unpack\n");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* per iteration */
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* OPAL_DATA_VALUE */
|
2006-12-02 01:30:39 +03:00
|
|
|
static bool test10(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
int16_t i16[NUM_ELEMS];
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_dss_value_t *src[NUM_ELEMS];
|
|
|
|
opal_dss_value_t *dst[NUM_ELEMS];
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
/* setup source array of data values */
|
|
|
|
for(i=0; i<NUM_ELEMS; i++) {
|
|
|
|
i16[i] = (int16_t)i;
|
2008-02-28 04:57:57 +03:00
|
|
|
src[i] = OBJ_NEW(opal_dss_value_t);
|
|
|
|
src[i]->type = ((i % 2) == 0) ? OPAL_INT16 : OPAL_STRING;
|
|
|
|
if (OPAL_INT16 == src[i]->type)
|
2006-12-02 01:30:39 +03:00
|
|
|
src[i]->data = &i16[i];
|
|
|
|
else
|
|
|
|
src[i]->data = strdup("truly-a-dumb-test");
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_DATA_VALUE);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed with error code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
|
|
int j;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t count = NUM_ELEMS;
|
2006-12-02 01:30:39 +03:00
|
|
|
memset(dst,-1,sizeof(dst));
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_DATA_VALUE);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
2006-12-02 01:30:39 +03:00
|
|
|
fprintf(test_out,
|
2008-02-28 04:57:57 +03:00
|
|
|
"opal_dss.unpack (DATA_VALUE) failed on iteration %d with error code %d\n",
|
2006-12-02 01:30:39 +03:00
|
|
|
i, rc);
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if (src[j]->type != dst[j]->type) {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "opal_dss.unpack (DATA_VALUE) invalid results type mismatch from unpack\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
if (0 != opal_dss.compare(src[j], dst[j], src[j]->type)) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack (DATA_VALUE) invalid results value mismatch from unpack");
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* int32_t */
|
2006-12-02 01:30:39 +03:00
|
|
|
static bool test11(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t i;
|
|
|
|
int32_t src[NUM_ELEMS];
|
|
|
|
int32_t dst[NUM_ELEMS];
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = 1000*i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
2006-12-02 01:30:39 +03:00
|
|
|
fprintf(test_out, "OBJ_NEW failed\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack int32_t failed");
|
|
|
|
fprintf(test_out, "orte_pack_int32_t failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t j;
|
|
|
|
int32_t count;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_INT32);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack int32_t failed");
|
|
|
|
fprintf(test_out, "orte_unpack_int32_t failed with return code %d\n", rc);
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
2008-02-28 04:57:57 +03:00
|
|
|
fprintf(test_out, "test11: invalid results from unpack int32_t");
|
2006-12-02 01:30:39 +03:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer");
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* pid_t pack/unpack
|
|
|
|
*/
|
|
|
|
static bool test12(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *bufA;
|
2006-12-02 01:30:39 +03:00
|
|
|
int rc;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t i;
|
2006-12-02 01:30:39 +03:00
|
|
|
pid_t src[NUM_ELEMS];
|
|
|
|
pid_t dst[NUM_ELEMS];
|
|
|
|
|
|
|
|
for(i=0; i<NUM_ELEMS; i++)
|
|
|
|
src[i] = (pid_t)i;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
bufA = OBJ_NEW(opal_buffer_t);
|
2006-12-02 01:30:39 +03:00
|
|
|
if (NULL == bufA) {
|
|
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW");
|
|
|
|
fprintf(test_out, "OBJ_NEW failed\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_PID);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
fprintf(test_out, "opal_dss.pack failed");
|
2006-12-02 01:30:39 +03:00
|
|
|
fprintf(test_out, "orte_pack pid_t failed with return code %d\n", rc);
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t j;
|
|
|
|
int32_t count;
|
2006-12-02 01:30:39 +03:00
|
|
|
|
|
|
|
count = NUM_ELEMS;
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = opal_dss.unpack(bufA, dst, &count, OPAL_PID);
|
|
|
|
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
|
|
|
fprintf(test_out, "opal_dss.unpack failed");
|
2006-12-02 01:30:39 +03:00
|
|
|
fprintf(test_out, "orte_pack pid_t failed with return code %d\n", rc);
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
|
|
if(src[j] != dst[j]) {
|
|
|
|
fprintf(test_out, "test2: invalid results from unpack");
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(bufA);
|
|
|
|
if (NULL != bufA) {
|
|
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (true);
|
|
|
|
}
|