test/dss: update tests to make them usable again, and run them
Этот коммит содержится в:
родитель
7c99115a94
Коммит
1e26f9cda4
@ -20,7 +20,7 @@
|
||||
# Copyright (c) 2013 Mellanox Technologies, Inc.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
# Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
@ -1372,6 +1372,7 @@ AC_CONFIG_FILES([
|
||||
test/event/Makefile
|
||||
test/asm/Makefile
|
||||
test/datatype/Makefile
|
||||
test/dss/Makefile
|
||||
test/class/Makefile
|
||||
test/support/Makefile
|
||||
test/threads/Makefile
|
||||
|
@ -11,7 +11,7 @@
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2015 Research Organization for Information Science
|
||||
# Copyright (c) 2015-2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
# support needs to be first for dependencies
|
||||
SUBDIRS = support asm class threads datatype util
|
||||
SUBDIRS = support asm class threads datatype util dss
|
||||
if PROJECT_OMPI
|
||||
SUBDIRS += monitoring
|
||||
endif
|
||||
|
@ -1,9 +0,0 @@
|
||||
PROGS = dss_buffer dss_payload dss_cmp dss_copy dss_print dss_release dss_set_get dss_size
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
CC = mpicc
|
||||
CFLAGS = -g -I../../ -I../../opal/include
|
||||
|
||||
clean:
|
||||
rm -f $(PROGS) *~ .gdb*
|
15
test/dss/Makefile.am
Обычный файл
15
test/dss/Makefile.am
Обычный файл
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
TESTS = dss_buffer dss_cmp dss_payload dss_print
|
||||
|
||||
check_PROGRAMS = $(TESTS) $(MPI_CHECKS)
|
||||
|
||||
LDFLAGS = $(OPAL_PKG_CONFIG_LDFLAGS)
|
||||
LDADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -47,11 +49,13 @@ static bool test10(void); /* verify KEYVAL */
|
||||
static bool test11(void); /* verify int32_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
test_out = stderr;
|
||||
@ -61,104 +65,104 @@ int main (int argc, char* argv[])
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test1 failed\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test2\n");
|
||||
if (test2()) {
|
||||
fprintf(test_out, "Test2 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test2 failed\n");
|
||||
ret = 2;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test3\n");
|
||||
if (test3()) {
|
||||
fprintf(test_out, "Test3 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test3 failed\n");
|
||||
ret = 3;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test4\n");
|
||||
if (test4()) {
|
||||
fprintf(test_out, "Test4 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test4 failed\n");
|
||||
ret = 4;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test5\n");
|
||||
if (test5()) {
|
||||
fprintf(test_out, "Test5 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test5 failed\n");
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test6\n");
|
||||
if (test6()) {
|
||||
fprintf(test_out, "Test6 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test6 failed\n");
|
||||
ret = 6;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test7\n");
|
||||
if (test7()) {
|
||||
fprintf(test_out, "Test7 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test7 failed\n");
|
||||
ret = 7;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test8\n");
|
||||
if (test8()) {
|
||||
fprintf(test_out, "Test8 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test8 failed\n");
|
||||
ret = 8;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test9\n");
|
||||
if (test9()) {
|
||||
fprintf(test_out, "Test9 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
ret = 9;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test10\n");
|
||||
if (test10()) {
|
||||
fprintf(test_out, "Test10 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test10 failed\n");
|
||||
ret = 10;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
ret = 11;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
ret = 12;
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test1(void) /* verify different buffer inits */
|
||||
@ -199,7 +203,7 @@ static bool test2(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
opal_dss.set_buffer_type(bufA, OPAL_DSS_BUFFER_NON_DESC);
|
||||
bufA->type = OPAL_DSS_BUFFER_NON_DESC;
|
||||
|
||||
for (i=0;i<NUM_ITERS;i++) {
|
||||
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_INT16);
|
||||
@ -791,18 +795,18 @@ static bool test10(void)
|
||||
int rc;
|
||||
int i;
|
||||
int16_t i16[NUM_ELEMS];
|
||||
opal_dss_value_t *src[NUM_ELEMS];
|
||||
opal_dss_value_t *dst[NUM_ELEMS];
|
||||
opal_value_t *src[NUM_ELEMS];
|
||||
opal_value_t *dst[NUM_ELEMS];
|
||||
|
||||
/* setup source array of data values */
|
||||
for(i=0; i<NUM_ELEMS; i++) {
|
||||
i16[i] = (int16_t)i;
|
||||
src[i] = OBJ_NEW(opal_dss_value_t);
|
||||
src[i] = OBJ_NEW(opal_value_t);
|
||||
src[i]->type = ((i % 2) == 0) ? OPAL_INT16 : OPAL_STRING;
|
||||
if (OPAL_INT16 == src[i]->type)
|
||||
src[i]->data = &i16[i];
|
||||
src[i]->data.uint16 = i16[i];
|
||||
else
|
||||
src[i]->data = strdup("truly-a-dumb-test");
|
||||
src[i]->data.string = strdup("truly-a-dumb-test");
|
||||
}
|
||||
|
||||
bufA = OBJ_NEW(opal_buffer_t);
|
||||
@ -812,7 +816,7 @@ static bool test10(void)
|
||||
}
|
||||
|
||||
for (i=0;i<NUM_ITERS;i++) {
|
||||
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_DATA_VALUE);
|
||||
rc = opal_dss.pack(bufA, src, NUM_ELEMS, OPAL_VALUE);
|
||||
if (OPAL_SUCCESS != rc) {
|
||||
fprintf(test_out, "opal_dss.pack failed with error code %d\n", rc);
|
||||
return(false);
|
||||
@ -824,7 +828,7 @@ static bool test10(void)
|
||||
int32_t count = NUM_ELEMS;
|
||||
memset(dst,-1,sizeof(dst));
|
||||
|
||||
rc = opal_dss.unpack(bufA, dst, &count, OPAL_DATA_VALUE);
|
||||
rc = opal_dss.unpack(bufA, dst, &count, OPAL_VALUE);
|
||||
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
||||
fprintf(test_out,
|
||||
"opal_dss.unpack (DATA_VALUE) failed on iteration %d with error code %d\n",
|
||||
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -49,11 +51,13 @@ static bool test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
static bool test13(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
test_out = stderr;
|
||||
@ -63,104 +67,104 @@ int main (int argc, char* argv[])
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test1 failed\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test2\n");
|
||||
if (test2()) {
|
||||
fprintf(test_out, "Test2 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test2 failed\n");
|
||||
ret = 2;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test3\n");
|
||||
if (test3()) {
|
||||
fprintf(test_out, "Test3 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test3 failed\n");
|
||||
ret = 3;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test4\n");
|
||||
if (test4()) {
|
||||
fprintf(test_out, "Test4 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test4 failed\n");
|
||||
ret = 4;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test5\n");
|
||||
if (test5()) {
|
||||
fprintf(test_out, "Test5 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test5 failed\n");
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test6\n");
|
||||
if (test6()) {
|
||||
fprintf(test_out, "Test6 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test6 failed\n");
|
||||
ret = 6;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test7\n");
|
||||
if (test7()) {
|
||||
fprintf(test_out, "Test7 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test7 failed\n");
|
||||
ret = 7;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test8\n");
|
||||
if (test8()) {
|
||||
fprintf(test_out, "Test8 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test8 failed\n");
|
||||
ret = 8;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test9\n");
|
||||
if (test9()) {
|
||||
fprintf(test_out, "Test9 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
ret = 9;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
ret = 11;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
ret = 12;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test13\n");
|
||||
if (test13()) {
|
||||
fprintf(test_out, "Test13 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test13 failed\n");
|
||||
ret = 13;
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -553,7 +557,7 @@ static bool test11(void)
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
opal_byte_object_t v1, v2;
|
||||
opal_data_type_t type=OPAL_BYTE_OBJECT;
|
||||
|
||||
@ -585,19 +589,17 @@ static bool test12(void)
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/* OPAL_DATA_VALUE */
|
||||
static bool test13(void)
|
||||
{
|
||||
int dat1=100, dat2=200;
|
||||
opal_dss_value_t v1, v2;
|
||||
opal_data_type_t type=OPAL_DATA_VALUE;
|
||||
opal_value_t v1, v2;
|
||||
opal_data_type_t type=OPAL_VALUE;
|
||||
|
||||
v1.type = OPAL_INT;
|
||||
v1.data = &dat1;
|
||||
v1.data.integer = dat1;
|
||||
|
||||
v2.type = OPAL_INT;
|
||||
v2.data = &dat2;
|
||||
v2.data.integer = dat2;
|
||||
|
||||
if (OPAL_EQUAL != opal_dss.compare(&v1, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.compare failed for equality\n");
|
||||
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -43,11 +45,13 @@ static bool test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
static bool test13(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
test_out = stderr;
|
||||
@ -57,104 +61,104 @@ int main (int argc, char* argv[])
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test1 failed\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test2\n");
|
||||
if (test2()) {
|
||||
fprintf(test_out, "Test2 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test2 failed\n");
|
||||
ret = 2;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test3\n");
|
||||
if (test3()) {
|
||||
fprintf(test_out, "Test3 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test3 failed\n");
|
||||
ret = 3;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test4\n");
|
||||
if (test4()) {
|
||||
fprintf(test_out, "Test4 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test4 failed\n");
|
||||
ret = 4;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test5\n");
|
||||
if (test5()) {
|
||||
fprintf(test_out, "Test5 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test5 failed\n");
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test6\n");
|
||||
if (test6()) {
|
||||
fprintf(test_out, "Test6 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test6 failed\n");
|
||||
ret = 6;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test7\n");
|
||||
if (test7()) {
|
||||
fprintf(test_out, "Test7 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test7 failed\n");
|
||||
ret = 7;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test8\n");
|
||||
if (test8()) {
|
||||
fprintf(test_out, "Test8 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test8 failed\n");
|
||||
ret = 8;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test9\n");
|
||||
if (test9()) {
|
||||
fprintf(test_out, "Test9 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
ret = 9;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
ret = 11;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
ret = 12;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test13\n");
|
||||
if (test13()) {
|
||||
fprintf(test_out, "Test13 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test13 failed\n");
|
||||
ret = 13;
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -30,13 +32,14 @@
|
||||
#define NUM_ELEMS 1024
|
||||
|
||||
static bool test1(void); /* verify dss_copy_payload */
|
||||
static bool test2(void); /* verify dss_xfer_payload */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
test_out = stderr;
|
||||
@ -46,22 +49,14 @@ int main (int argc, char* argv[])
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} 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");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test1(void) /* verify dss_copy_payload */
|
||||
@ -87,7 +82,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
return false;
|
||||
}
|
||||
|
||||
opal_dss.set_buffer_type(bufA, OPAL_DSS_BUFFER_NON_DESC);
|
||||
bufA->type = OPAL_DSS_BUFFER_NON_DESC;
|
||||
|
||||
/* pack something in A */
|
||||
for (i=0;i<NUM_ITERS;i++) {
|
||||
@ -105,7 +100,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
return false;
|
||||
}
|
||||
|
||||
opal_dss.set_buffer_type(bufB, OPAL_DSS_BUFFER_NON_DESC);
|
||||
bufB->type = OPAL_DSS_BUFFER_NON_DESC;
|
||||
|
||||
/* pack something in B */
|
||||
for (i=0;i<NUM_ITERS;i++) {
|
||||
@ -148,7 +143,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
|
||||
for(j=0; j<NUM_ELEMS; j++) {
|
||||
if(src32[j] != dst32[j]) {
|
||||
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
||||
fprintf(test_out, "test1: invalid results from unpack of dest buffer\n");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
@ -170,7 +165,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
|
||||
for(j=0; j<NUM_ELEMS; j++) {
|
||||
if(src[j] != dst[j]) {
|
||||
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
||||
fprintf(test_out, "test1: invalid results from unpack of dest buffer\n");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
@ -192,7 +187,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
|
||||
for(j=0; j<NUM_ELEMS; j++) {
|
||||
if(src32[j] != dst32[j]) {
|
||||
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
||||
fprintf(test_out, "test1: invalid results from unpack of dest buffer\n");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
@ -215,7 +210,7 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
|
||||
for(j=0; j<NUM_ELEMS; j++) {
|
||||
if(src[j] != dst[j]) {
|
||||
fprintf(test_out, "test2: invalid results from unpack of src buffer\n");
|
||||
fprintf(test_out, "test1: invalid results from unpack of src buffer\n");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
@ -232,74 +227,3 @@ static bool test1(void) /* verify dss_copy_payload */
|
||||
}
|
||||
|
||||
|
||||
static bool test2(void) /* verify dss_xfer_payload */
|
||||
{
|
||||
opal_buffer_t *bufA, *bufB;
|
||||
int rc;
|
||||
int32_t i;
|
||||
int16_t src[NUM_ELEMS];
|
||||
int16_t dst[NUM_ELEMS];
|
||||
|
||||
bufA = OBJ_NEW(opal_buffer_t);
|
||||
if (NULL == bufA) {
|
||||
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
opal_dss.set_buffer_type(bufA, OPAL_DSS_BUFFER_NON_DESC);
|
||||
|
||||
for (i=0;i<NUM_ITERS;i++) {
|
||||
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);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
/* setup bufB */
|
||||
bufB = OBJ_NEW(opal_buffer_t);
|
||||
if (NULL == bufB) {
|
||||
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
opal_dss.set_buffer_type(bufB, OPAL_DSS_BUFFER_NON_DESC);
|
||||
|
||||
/* xfer payload to bufB */
|
||||
if (OPAL_SUCCESS != (rc = opal_dss.xfer_payload(bufB, bufA))) {
|
||||
fprintf(test_out, "opal_dss.xfer_payload failed with return code %d\n", rc);
|
||||
return(false);
|
||||
}
|
||||
|
||||
/* validate the results */
|
||||
for (i=0; i<NUM_ITERS; i++) {
|
||||
int j;
|
||||
int32_t count;
|
||||
|
||||
for(j=0; j<NUM_ELEMS; j++)
|
||||
dst[j] = -1;
|
||||
|
||||
count = NUM_ELEMS;
|
||||
rc = opal_dss.unpack(bufB, dst, &count, OPAL_INT16);
|
||||
if (OPAL_SUCCESS != rc || count != NUM_ELEMS) {
|
||||
fprintf(test_out, "opal_dss.unpack of dest buffer 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 of dest buffer\n");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OBJ_RELEASE(bufA);
|
||||
OBJ_RELEASE(bufB);
|
||||
if (NULL != bufA || NULL != bufB) {
|
||||
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -43,11 +45,13 @@ static bool test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
static bool test13(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
test_out = stderr;
|
||||
@ -57,104 +61,104 @@ int main (int argc, char* argv[])
|
||||
fprintf(test_out, "executing test1\n");
|
||||
if (test1()) {
|
||||
fprintf(test_out, "Test1 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test1 failed\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test2\n");
|
||||
if (test2()) {
|
||||
fprintf(test_out, "Test2 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test2 failed\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test3\n");
|
||||
if (test3()) {
|
||||
fprintf(test_out, "Test3 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test3 failed\n");
|
||||
ret = 3;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test4\n");
|
||||
if (test4()) {
|
||||
fprintf(test_out, "Test4 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test4 failed\n");
|
||||
ret = 4;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test5\n");
|
||||
if (test5()) {
|
||||
fprintf(test_out, "Test5 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test5 failed\n");
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test6\n");
|
||||
if (test6()) {
|
||||
fprintf(test_out, "Test6 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test6 failed\n");
|
||||
ret = 6;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test7\n");
|
||||
if (test7()) {
|
||||
fprintf(test_out, "Test7 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test7 failed\n");
|
||||
ret = 7;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test8\n");
|
||||
if (test8()) {
|
||||
fprintf(test_out, "Test8 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "Test8 failed\n");
|
||||
ret = 8;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test9\n");
|
||||
if (test9()) {
|
||||
fprintf(test_out, "Test9 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
ret = 9;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
ret = 11;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
ret = 12;
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test13\n");
|
||||
if (test13()) {
|
||||
fprintf(test_out, "Test13 succeeded\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(test_out, "opal_dss test13 failed\n");
|
||||
ret = 13;
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -452,7 +456,7 @@ static bool test11(void)
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
opal_byte_object_t v2;
|
||||
opal_data_type_t type=OPAL_BYTE_OBJECT;
|
||||
char *output;
|
||||
@ -480,12 +484,13 @@ static bool test12(void)
|
||||
static bool test13(void)
|
||||
{
|
||||
int dat2=200;
|
||||
opal_dss_value_t v2;
|
||||
opal_data_type_t type=OPAL_DATA_VALUE;
|
||||
opal_value_t v2;
|
||||
opal_data_type_t type=OPAL_VALUE;
|
||||
char *output;
|
||||
|
||||
v2.type = OPAL_INT;
|
||||
v2.data = &dat2;
|
||||
v2.data.integer = dat2;
|
||||
v2.key = "key";
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.print(&output, NULL, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.print returned error\n");
|
||||
|
@ -1,513 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#define NUM_ITERS 3
|
||||
#define NUM_ELEMS 10
|
||||
|
||||
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 test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
static bool test13(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
|
||||
opal_dss_value_t dval = { {OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF,NULL};
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
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 {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test13\n");
|
||||
if (test13()) {
|
||||
fprintf(test_out, "Test13 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test13 failed\n");
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT8
|
||||
*/
|
||||
static bool test1(void)
|
||||
{
|
||||
int8_t *v1, v2=100;
|
||||
uint8_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT8, utype=OPAL_UINT8;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_INT8;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&u1, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_UINT8;
|
||||
dval.data = u1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT16
|
||||
*/
|
||||
static bool test2(void)
|
||||
{
|
||||
int16_t *v1, v2=100;
|
||||
uint16_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT16, utype=OPAL_UINT16;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_INT16;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&u1, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_UINT16;
|
||||
dval.data = u1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT32
|
||||
*/
|
||||
static bool test3(void)
|
||||
{
|
||||
int32_t *v1, v2=100;
|
||||
uint32_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT32, utype=OPAL_UINT32;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_INT32;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&u1, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_UINT32;
|
||||
dval.data = u1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT64
|
||||
*/
|
||||
static bool test4(void)
|
||||
{
|
||||
int64_t *v1, v2=100;
|
||||
uint64_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT64, utype=OPAL_UINT64;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&u1, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_UINT64;
|
||||
dval.data = u1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT
|
||||
*/
|
||||
static bool test5(void)
|
||||
{
|
||||
int *v1, v2=100;
|
||||
uint *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT, utype=OPAL_UINT;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&u1, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = utype;
|
||||
dval.data = u1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
static bool test6(void)
|
||||
{
|
||||
char *string1="This is a short string";
|
||||
char *string2;
|
||||
|
||||
if (OPAL_EQUAL != opal_dss.copy((void**)&string2, string1, OPAL_STRING)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error code\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
dval.type = OPAL_STRING;
|
||||
dval.data = string2;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for string value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* BOOL
|
||||
*/
|
||||
static bool test7(void)
|
||||
{
|
||||
bool *v1, v2=true;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, OPAL_BOOL)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = OPAL_BOOL;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for bool value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SIZE
|
||||
*/
|
||||
static bool test8(void)
|
||||
{
|
||||
size_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_SIZE;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for size value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PID
|
||||
*/
|
||||
static bool test9(void)
|
||||
{
|
||||
pid_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_PID;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for pid value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* DATA TYPE
|
||||
*/
|
||||
static bool test11(void)
|
||||
{
|
||||
opal_data_type_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_DATA_TYPE;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for data_type value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/**
|
||||
* OPAL_BYTE_OBJECT
|
||||
*/
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i;
|
||||
opal_byte_object_t *v1, v2;
|
||||
opal_data_type_t type=OPAL_BYTE_OBJECT;
|
||||
|
||||
v2.size = 20;
|
||||
v2.bytes = (uint8_t*)malloc(v2.size);
|
||||
for (i=0; i<v2.size; i++) v2.bytes[i]= i;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for byte_object value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/* OPAL_DATA_VALUE */
|
||||
static bool test13(void)
|
||||
{
|
||||
int dat2=200;
|
||||
opal_dss_value_t *v1, v2;
|
||||
opal_data_type_t type=OPAL_DATA_VALUE;
|
||||
|
||||
v2.type = OPAL_INT;
|
||||
v2.data = &dat2;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.copy((void**)&v1, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.copy returned error\n");
|
||||
return(false);
|
||||
}
|
||||
dval.type = type;
|
||||
dval.data = v1;
|
||||
opal_dss.release(&dval);
|
||||
if (NULL != dval.data) {
|
||||
fprintf(test_out, "opal_dss.release failed for data_value value\n");
|
||||
return(false);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
@ -1,503 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#define NUM_ITERS 3
|
||||
#define NUM_ELEMS 10
|
||||
|
||||
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 test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
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 {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT8
|
||||
*/
|
||||
static bool test1(void)
|
||||
{
|
||||
int8_t *v1, v2=100;
|
||||
uint8_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT8, utype=OPAL_UINT8;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
opal_dss_value_t udv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&udv, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&u1, &udv, utype)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT16
|
||||
*/
|
||||
static bool test2(void)
|
||||
{
|
||||
int16_t *v1, v2=100;
|
||||
uint16_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT16, utype=OPAL_UINT16;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
opal_dss_value_t udv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&udv, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&u1, &udv, utype)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT32
|
||||
*/
|
||||
static bool test3(void)
|
||||
{
|
||||
int32_t *v1, v2=100;
|
||||
uint32_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT32, utype=OPAL_UINT32;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
opal_dss_value_t udv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&udv, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&u1, &udv, utype)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT64
|
||||
*/
|
||||
static bool test4(void)
|
||||
{
|
||||
int64_t *v1, v2=100;
|
||||
uint64_t *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT64, utype=OPAL_UINT64;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
opal_dss_value_t udv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&udv, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&u1, &udv, utype)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT
|
||||
*/
|
||||
static bool test5(void)
|
||||
{
|
||||
int *v1, v2=100;
|
||||
uint *u1, u2=150;
|
||||
opal_data_type_t type=OPAL_INT, utype=OPAL_UINT;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
opal_dss_value_t udv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&udv, &u2, utype)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&u1, &udv, utype)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
static bool test6(void)
|
||||
{
|
||||
char *string1="This is a short string", *string2;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, string1, OPAL_STRING)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&string2, &dv, OPAL_STRING)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (0 != strcmp(string1, string2)) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for string value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* BOOL
|
||||
*/
|
||||
static bool test7(void)
|
||||
{
|
||||
bool *v1, v2=true;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, OPAL_BOOL)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, OPAL_BOOL)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for bool value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SIZE
|
||||
*/
|
||||
static bool test8(void)
|
||||
{
|
||||
size_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_SIZE;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for size value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PID
|
||||
*/
|
||||
static bool test9(void)
|
||||
{
|
||||
pid_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_PID;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for pid value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* DATA TYPE
|
||||
*/
|
||||
static bool test11(void)
|
||||
{
|
||||
opal_data_type_t *v1, v2=100;
|
||||
opal_data_type_t type=OPAL_DATA_TYPE;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, type)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (v2 != *v1) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for data type value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/**
|
||||
* OPAL_BYTE_OBJECT
|
||||
*/
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i;
|
||||
opal_byte_object_t v2, *v1;
|
||||
opal_dss_value_t dv = {{OBJ_CLASS(opal_dss_value_t),0},OPAL_UNDEF, NULL};
|
||||
|
||||
v2.size = 20;
|
||||
v2.bytes = (uint8_t*)malloc(v2.size);
|
||||
for (i=0; i<v2.size; i++) v2.bytes[i] = i;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.set(&dv, &v2, OPAL_BYTE_OBJECT)) {
|
||||
fprintf(test_out, "opal_dss.set returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (OPAL_SUCCESS != opal_dss.get((void**)&v1, &dv, OPAL_BYTE_OBJECT)) {
|
||||
fprintf(test_out, "opal_dss.get returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (0 != opal_dss.compare(v1, &v2, OPAL_BYTE_OBJECT)) {
|
||||
fprintf(test_out, "opal_dss.get/set failed for byte object value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
@ -1,626 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#define NUM_ITERS 3
|
||||
#define NUM_ELEMS 10
|
||||
|
||||
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 test11(void); /* verify size_t */
|
||||
static bool test12(void); /* verify pid_t */
|
||||
static bool test13(void); /* verify pid_t */
|
||||
|
||||
FILE *test_out;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
opal_init(&argc, &argv);
|
||||
|
||||
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 {
|
||||
fprintf(test_out, "opal_dss test9 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test11\n");
|
||||
if (test11()) {
|
||||
fprintf(test_out, "Test11 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test11 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test12\n");
|
||||
if (test12()) {
|
||||
fprintf(test_out, "Test12 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test12 failed\n");
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test13\n");
|
||||
if (test13()) {
|
||||
fprintf(test_out, "Test13 succeeded\n");
|
||||
}
|
||||
else {
|
||||
fprintf(test_out, "opal_dss test13 failed\n");
|
||||
}
|
||||
|
||||
fclose(test_out);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT8
|
||||
*/
|
||||
static bool test1(void)
|
||||
{
|
||||
int8_t v1;
|
||||
uint8_t u1;
|
||||
size_t s;
|
||||
opal_data_type_t type=OPAL_INT8, utype=OPAL_UINT8;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &u1, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(u1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT16
|
||||
*/
|
||||
static bool test2(void)
|
||||
{
|
||||
int16_t v1;
|
||||
uint16_t u1;
|
||||
opal_data_type_t type=OPAL_INT16, utype=OPAL_UINT16;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &u1, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(u1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT32
|
||||
*/
|
||||
static bool test3(void)
|
||||
{
|
||||
int32_t v1;
|
||||
uint32_t u1;
|
||||
opal_data_type_t type=OPAL_INT32, utype=OPAL_UINT32;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &u1, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(u1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT64
|
||||
*/
|
||||
static bool test4(void)
|
||||
{
|
||||
int64_t v1;
|
||||
uint64_t u1;
|
||||
opal_data_type_t type=OPAL_INT64, utype=OPAL_UINT64;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &u1, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(u1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* INT
|
||||
*/
|
||||
static bool test5(void)
|
||||
{
|
||||
int v1;
|
||||
uint u1;
|
||||
opal_data_type_t type=OPAL_INT, utype=OPAL_UINT;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for signed value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &u1, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(u1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, utype)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for unsigned value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* STRING
|
||||
*/
|
||||
static bool test6(void)
|
||||
{
|
||||
char *string1="This is a short string";
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, string1, OPAL_STRING)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != strlen(string1)+1) {
|
||||
fprintf(test_out, "opal_dss.size failed for string\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, OPAL_STRING)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(string1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for string with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* BOOL
|
||||
*/
|
||||
static bool test7(void)
|
||||
{
|
||||
bool v1;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, OPAL_BOOL)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for bool");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, OPAL_BOOL)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for bool with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SIZE
|
||||
*/
|
||||
static bool test8(void)
|
||||
{
|
||||
size_t v1;
|
||||
opal_data_type_t type=OPAL_SIZE;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for size\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for size with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PID
|
||||
*/
|
||||
static bool test9(void)
|
||||
{
|
||||
pid_t v1;
|
||||
opal_data_type_t type=OPAL_PID;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for pid\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for pid with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
* DATA TYPE
|
||||
*/
|
||||
static bool test11(void)
|
||||
{
|
||||
opal_data_type_t v1;
|
||||
opal_data_type_t type=OPAL_DATA_TYPE;
|
||||
size_t s;
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v1, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for data type\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v1)) {
|
||||
fprintf(test_out, "opal_dss.size failed for data type with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/**
|
||||
* OPAL_BYTE_OBJECT
|
||||
*/
|
||||
|
||||
static bool test12(void)
|
||||
{
|
||||
size_t i, ts;
|
||||
opal_byte_object_t v2;
|
||||
opal_data_type_t type=OPAL_BYTE_OBJECT;
|
||||
size_t s;
|
||||
|
||||
v2.size = 20;
|
||||
v2.bytes = (uint8_t*)malloc(v2.size);
|
||||
for (i=0; i<v2.size; i++) v2.bytes[i] = i;
|
||||
|
||||
ts = sizeof(v2) + 20*sizeof(uint8_t);
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != ts) {
|
||||
fprintf(test_out, "opal_dss.size failed for byte object\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v2)) {
|
||||
fprintf(test_out, "opal_dss.size failed for byte object with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
/* OPAL_DATA_VALUE */
|
||||
static bool test13(void)
|
||||
{
|
||||
int dat2=200;
|
||||
opal_dss_value_t v2;
|
||||
opal_data_type_t type=OPAL_DATA_VALUE;
|
||||
size_t s, ts;
|
||||
|
||||
v2.type = OPAL_INT;
|
||||
v2.data = &dat2;
|
||||
|
||||
ts = sizeof(v2) + sizeof(int);
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, &v2, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != ts) {
|
||||
fprintf(test_out, "opal_dss.size failed for data value\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != opal_dss.size(&s, NULL, type)) {
|
||||
fprintf(test_out, "opal_dss.size returned error\n");
|
||||
return(false);
|
||||
}
|
||||
if (s != sizeof(v2)) {
|
||||
fprintf(test_out, "opal_dss.size failed for data value with NULL\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user