[mpich2-commits] r7521 - in mpich2/trunk/test/mpi: . cxx cxx/attr cxx/datatype cxx/errhan cxx/init cxx/rma
gropp at mcs.anl.gov
gropp at mcs.anl.gov
Mon Nov 29 13:22:10 CST 2010
Author: gropp
Date: 2010-11-29 13:22:10 -0600 (Mon, 29 Nov 2010)
New Revision: 7521
Added:
mpich2/trunk/test/mpi/cxx/attr/attricx.cxx
mpich2/trunk/test/mpi/cxx/datatype/packsizex.cxx
mpich2/trunk/test/mpi/cxx/errhan/
mpich2/trunk/test/mpi/cxx/errhan/Makefile.sm
mpich2/trunk/test/mpi/cxx/errhan/commcallx.cxx
mpich2/trunk/test/mpi/cxx/errhan/testlist
mpich2/trunk/test/mpi/cxx/init/initstat2x.cxx
mpich2/trunk/test/mpi/cxx/rma/wincallx.cxx
Modified:
mpich2/trunk/test/mpi/configure.in
mpich2/trunk/test/mpi/cxx/Makefile.sm
mpich2/trunk/test/mpi/cxx/attr/Makefile.sm
mpich2/trunk/test/mpi/cxx/attr/testlist
mpich2/trunk/test/mpi/cxx/datatype/Makefile.sm
mpich2/trunk/test/mpi/cxx/datatype/testlist
mpich2/trunk/test/mpi/cxx/init/Makefile.sm
mpich2/trunk/test/mpi/cxx/init/testlist
mpich2/trunk/test/mpi/cxx/rma/Makefile.sm
mpich2/trunk/test/mpi/cxx/rma/testlist
mpich2/trunk/test/mpi/cxx/testlist.in
Log:
Added some C++ tests to provide better test coverage (and discovered a bug in call_errhandler)
Modified: mpich2/trunk/test/mpi/configure.in
===================================================================
--- mpich2/trunk/test/mpi/configure.in 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/configure.in 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1078,6 +1078,7 @@
cxx/pt2pt/Makefile \
cxx/comm/Makefile \
cxx/coll/Makefile \
+ cxx/errhan/Makefile \
cxx/info/Makefile \
cxx/datatype/Makefile \
cxx/io/Makefile \
Modified: mpich2/trunk/test/mpi/cxx/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/Makefile.sm 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,4 +1,4 @@
-SUBDIRS = util attr pt2pt init info comm coll datatype io rma spawn
+SUBDIRS = util attr pt2pt init info comm coll datatype errhan io rma spawn
# A special testing target to simplify testing just the C++ code
testing:
Modified: mpich2/trunk/test/mpi/cxx/attr/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/attr/Makefile.sm 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/attr/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -4,7 +4,7 @@
smvar_do_sharedlibs = 0
attrtx_SOURCES = attrtx.cxx
-#attricx_SOURCES = attricx.cxx
+attricx_SOURCES = attricx.cxx
#attrerrx_SOURCES = attrerrx.cxx
#attrerrcommx_SOURCES = attrerrcommx.cxx
#attrerrtypex_SOURCES = attrerrtypex.cxx
@@ -20,3 +20,9 @@
../util/mtest.o:
(cd ../util && $(MAKE) mtest.o)
+testing:
+ ../../runtests -srcdir=$(srcdir) -tests=testlist \
+ -mpiexec=@MPIEXEC@ \
+ -xmlfile=summary.xml
+clean-local:
+ -rm -f summary.xml
Added: mpich2/trunk/test/mpi/cxx/attr/attricx.cxx
===================================================================
--- mpich2/trunk/test/mpi/cxx/attr/attricx.cxx (rev 0)
+++ mpich2/trunk/test/mpi/cxx/attr/attricx.cxx 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,186 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *
+ * (C) 2001 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+/*
+
+ Exercise communicator routines for intercommunicators
+
+ This C++ version derived from the C version, attric
+ */
+#include "mpi.h"
+#include "mpitestconf.h"
+#ifdef HAVE_IOSTREAM
+// Not all C++ compilers have iostream instead of iostream.h
+#include <iostream>
+#ifdef HAVE_NAMESPACE_STD
+// Those that do often need the std namespace; otherwise, a bare "cout"
+// is likely to fail to compile
+using namespace std;
+#endif
+#else
+#include <iostream.h>
+#endif
+#include <stdio.h>
+#include "mpitestcxx.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* #define DEBUG */
+static int verbose = 0;
+int test_communicators ( void );
+int copy_fn ( const MPI::Comm &, int, void *, void *, void *, bool & );
+int delete_fn ( MPI::Comm &, int, void *, void * );
+
+#ifdef DEBUG
+#define FFLUSH fflush(stdout);
+#else
+#define FFLUSH
+#endif
+
+int main( int argc, char **argv )
+{
+ int errs = 0;
+ MTest_Init();
+
+ errs = test_communicators();
+
+ MTest_Finalize( errs );
+ MPI::Finalize();
+ return 0;
+}
+
+int copy_fn( const MPI::Comm &oldcomm, int keyval, void *extra_state,
+ void *attribute_val_in, void *attribute_val_out, bool &flag)
+{
+ /* Note that if (sizeof(int) < sizeof(void *), just setting the int
+ part of attribute_val_out may leave some dirty bits
+ */
+ *(MPI::Aint *)attribute_val_out = (MPI::Aint)attribute_val_in;
+ flag = 1;
+ return MPI_SUCCESS;
+}
+
+int delete_fn( MPI::Comm &comm, int keyval, void *attribute_val,
+ void *extra_state)
+{
+ int world_rank;
+ world_rank = MPI::COMM_WORLD.Get_rank();
+ if ((MPI::Aint)attribute_val != (MPI::Aint)world_rank) {
+ cout << "incorrect attribute value %d\n" << *(int*)attribute_val << "\n";
+ MPI::COMM_WORLD.Abort( 1005 );
+ }
+ return MPI_SUCCESS;
+}
+
+int test_communicators( void )
+{
+ MPI::Intercomm dup_comm, comm;
+ void *vvalue;
+ int flag, world_rank, world_size, key_1, key_3;
+ int errs = 0;
+ MPI::Aint value;
+ int isLeft;
+
+ world_rank = MPI::COMM_WORLD.Get_rank();
+ world_size = MPI::COMM_WORLD.Get_size();
+#ifdef DEBUG
+ if (world_rank == 0) {
+ cout << "*** Communicators ***\n";
+ }
+#endif
+
+ while (MTestGetIntercomm( comm, isLeft, 2 )) {
+ if (verbose) {
+ cout << "start while loop, isLeft=" << isLeft << "\n";
+ }
+
+ if (comm == MPI::COMM_NULL) {
+ if (verbose) {
+ cout << "got COMM_NULL, skipping\n";
+ }
+ continue;
+ }
+
+ /*
+ Check Comm_dup by adding attributes to comm & duplicating
+ */
+
+ value = 9;
+ key_1 = MPI::Comm::Create_keyval(copy_fn, delete_fn, &value );
+ if (verbose) {
+ cout << "Keyval_create key=" << key_1 << " value=" << value << "\n";
+ }
+ value = 7;
+ key_3 = MPI::Comm::Create_keyval(MPI::Comm::NULL_COPY_FN,
+ MPI::Comm::NULL_DELETE_FN,
+ &value );
+ if (verbose) {
+ cout << "Keyval_create key=" << key_3 << " value=" << value << "\n";
+ }
+
+ /* This may generate a compilation warning; it is, however, an
+ easy way to cache a value instead of a pointer */
+ /* printf( "key1 = %x key3 = %x\n", key_1, key_3 ); */
+ comm.Set_attr( key_1, (void *) (MPI::Aint) world_rank );
+ comm.Set_attr( key_3, (void *)0 );
+
+ if (verbose) {
+ cout << "Comm_dup\n";
+ }
+ dup_comm = comm.Dup();
+
+ /* Note that if sizeof(int) < sizeof(void *), we can't use
+ (void **)&value to get the value we passed into Attr_put. To avoid
+ problems (e.g., alignment errors), we recover the value into
+ a (void *) and cast to int. Note that this may generate warning
+ messages from the compiler. */
+ flag = dup_comm.Get_attr( key_1, (void **)&vvalue );
+ value = (MPI::Aint)vvalue;
+
+ if (! flag) {
+ errs++;
+ cout << "dup_comm key_1 not found on " << world_rank << "\n";
+ MPI::COMM_WORLD.Abort( 3004 );
+ }
+
+ if (value != world_rank) {
+ errs++;
+ cout << "dup_comm key_1 value incorrect: " << (long)value << "\n";
+ MPI::COMM_WORLD.Abort( 3005 );
+ }
+
+ flag = dup_comm.Get_attr( key_3, (void **)&vvalue );
+ value = (MPI::Aint)vvalue;
+ if (flag) {
+ errs++;
+ cout << "dup_comm key_3 found!\n";
+ MPI::COMM_WORLD.Abort( 3008 );
+ }
+ if (verbose) {
+ cout << "Keyval_free key=" << key_1 << "\n";
+ }
+ MPI::Comm::Free_keyval( key_1 );
+ if (verbose) {
+ cout << "Keyval_free key=" << key_3 << "\n";
+ }
+ MPI::Comm::Free_keyval( key_3 );
+ /*
+ Free all communicators created
+ */
+ if (verbose) {
+ cout << "Comm_free comm\n";
+ }
+ comm.Free();
+ if (verbose) {
+ cout << "Comm_free dup_comm\n";
+ }
+ dup_comm.Free();
+ }
+
+ return errs;
+}
+
Modified: mpich2/trunk/test/mpi/cxx/attr/testlist
===================================================================
--- mpich2/trunk/test/mpi/cxx/attr/testlist 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/attr/testlist 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,5 +1,5 @@
attrtx 2
-#attricx 4
+attricx 4
#attrerrx 1
#attrerrcommx 1
#attrerrtypex 1
Modified: mpich2/trunk/test/mpi/cxx/datatype/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/datatype/Makefile.sm 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/datatype/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -3,6 +3,7 @@
LDADD = ../util/mtest.o
DEPADD = @MPILIBLOC@ ../util/mtest.o
+packsizex_SOURCES = packsizex.cxx
typecntsx_SOURCES = typecntsx.cxx
typenamex_SOURCES = typenamex.cxx
typemiscx_SOURCES = typemiscx.cxx
Added: mpich2/trunk/test/mpi/cxx/datatype/packsizex.cxx
===================================================================
--- mpich2/trunk/test/mpi/cxx/datatype/packsizex.cxx (rev 0)
+++ mpich2/trunk/test/mpi/cxx/datatype/packsizex.cxx 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; c-basic-offset:4 ; -*- */
+/*
+ *
+ * (C) 2010 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include "mpitestconf.h"
+#ifdef HAVE_IOSTREAM
+// Not all C++ compilers have iostream instead of iostream.h
+#include <iostream>
+#ifdef HAVE_NAMESPACE_STD
+// Those that do often need the std namespace; otherwise, a bare "cout"
+// is likely to fail to compile
+using namespace std;
+#endif
+#else
+#include <iostream.h>
+#endif
+#include "mpitestcxx.h"
+
+int main( int argc, char *argv[] )
+{
+ int errs = 0;
+ MPI::Datatype type;
+ MPI::Intracomm comm;
+ MTestDatatype mstype, mrtype;
+ char dtypename[MPI_MAX_OBJECT_NAME];
+ int size1, size2, tnlen;
+
+ MTest_Init();
+
+ comm = MPI::COMM_WORLD;
+ while (MTestGetDatatypes( &mstype, &mrtype, 1 )) {
+ type = mstype.datatype;
+
+ // Testing the pack size is tricky, since this is the
+ // size that is stored when packed with type.Pack, and
+ // is not easily defined. We look for consistency
+ size1 = type.Pack_size( 1, comm );
+ size2 = type.Pack_size( 2, comm );
+ if (size1 <= 0 || size2 <= 0) {
+ errs++;
+ type.Get_name( dtypename, tnlen );
+ cout << "Pack size of datatype " << dtypename <<
+ " is not positive\n";
+ }
+ if (size1 >= size2) {
+ errs++;
+ type.Get_name( dtypename, tnlen );
+ cout << "Pack size of 2 of " << dtypename <<
+ " is smaller or the same as the pack size of 1 instance\n";
+ }
+
+ if (mrtype.datatype != mstype.datatype) {
+ type = mrtype.datatype;
+
+ // Testing the pack size is tricky, since this is the
+ // size that is stored when packed with type.Pack, and
+ // is not easily defined. We look for consistency
+ size1 = type.Pack_size( 1, comm );
+ size2 = type.Pack_size( 2, comm );
+ if (size1 <= 0 || size2 <= 0) {
+ errs++;
+ type.Get_name( dtypename, tnlen );
+ cout << "Pack size of datatype " << dtypename <<
+ " is not positive\n";
+ }
+ if (size1 >= size2) {
+ errs++;
+ type.Get_name( dtypename, tnlen );
+ cout << "Pack size of 2 of " << dtypename <<
+ " is smaller or the same as the pack size of 1 instance\n";
+ }
+ }
+
+ MTestFreeDatatype(&mrtype);
+ MTestFreeDatatype(&mstype);
+ }
+
+ MTest_Finalize( errs );
+
+ MPI::Finalize();
+
+ return 0;
+}
+
Modified: mpich2/trunk/test/mpi/cxx/datatype/testlist
===================================================================
--- mpich2/trunk/test/mpi/cxx/datatype/testlist 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/datatype/testlist 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,3 +1,4 @@
+packsizex 1
typecntsx 1
typenamex 1
typemiscx 1
Property changes on: mpich2/trunk/test/mpi/cxx/errhan
___________________________________________________________________
Added: svn:ignore
+ Makefile.in
Makefile
Added: mpich2/trunk/test/mpi/cxx/errhan/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/errhan/Makefile.sm (rev 0)
+++ mpich2/trunk/test/mpi/cxx/errhan/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,21 @@
+INCLUDES = -I../../include -I${top_srcdir}/include
+LDADD = ../util/mtest.o
+DEPADD = @MPILIBLOC@ ../util/mtest.o
+smvar_do_sharedlibs = 0
+
+#adderr_SOURCES = adderr.c
+#errstring_SOURCES = errstring.c
+#errcode_SOURCES = errcode.c errmsg.c
+#errring_SOURCES = errring.c
+commcallx_SOURCES = commcallx.cxx
+#errfatal_SOURCES = errfatal.c
+
+EXTRA_PROGRAMS = errcode errring errstring
+
+../util/mtest.o:
+ (cd ../util && make mtest.o)
+
+testing:
+ ../../runtests -srcdir=$(srcdir) -tests=testlist \
+ -mpiexec=@MPIEXEC@ \
+ -xmlfile=summary.xml
Added: mpich2/trunk/test/mpi/cxx/errhan/commcallx.cxx
===================================================================
--- mpich2/trunk/test/mpi/cxx/errhan/commcallx.cxx (rev 0)
+++ mpich2/trunk/test/mpi/cxx/errhan/commcallx.cxx 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,113 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *
+ * (C) 2003 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include "mpitestconf.h"
+#ifdef HAVE_IOSTREAM
+// Not all C++ compilers have iostream instead of iostream.h
+#include <iostream>
+#ifdef HAVE_NAMESPACE_STD
+// Those that do often need the std namespace; otherwise, a bare "cout"
+// is likely to fail to compile
+using namespace std;
+#endif
+#else
+#include <iostream.h>
+#endif
+#include <stdio.h>
+#include "mpitestcxx.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+static char MTEST_Descrip[] = "Test comm_call_errhandler";
+
+static int calls = 0;
+static int errs = 0;
+static MPI::Intracomm mycomm;
+void eh( MPI::Comm &comm, int *err, ... )
+{
+ if (*err != MPI_ERR_OTHER) {
+ errs++;
+ cout << "Unexpected error code\n";
+ }
+ if (comm != mycomm) {
+ char cname[MPI_MAX_OBJECT_NAME];
+ int len;
+ errs++;
+ cout << "Unexpected communicator\n";
+ comm.Get_name( cname, len );
+ cout << "Comm is " << cname << "\n";
+ mycomm.Get_name( cname, len );
+ cout << "mycomm is " << cname << "\n";
+ }
+ calls++;
+ return;
+}
+int main( int argc, char *argv[] )
+{
+ MPI::Intracomm comm;
+ MPI::Errhandler newerr;
+ int i;
+ int reset_handler;
+
+ MTest_Init( );
+
+ comm = MPI::COMM_WORLD;
+ mycomm = comm;
+ mycomm.Set_name( "dup of comm_world" );
+
+ newerr = MPI::Comm::Create_errhandler( eh );
+
+ comm.Set_errhandler( newerr );
+ comm.Call_errhandler( MPI_ERR_OTHER );
+ newerr.Free();
+ if (calls != 1) {
+ errs++;
+ cout << "Error handler not called\n";
+ }
+
+ // Here we apply the test to many copies of a communicator
+ for (reset_handler = 0; reset_handler <= 1; ++reset_handler) {
+ for (i=0; i<1000; i++) {
+ MPI::Intracomm comm2;
+ calls = 0;
+ comm = MPI::COMM_WORLD.Dup();
+ mycomm = comm;
+ mycomm.Set_name( "dup of comm_world" );
+ newerr = MPI::Comm::Create_errhandler( eh );
+
+ comm.Set_errhandler( newerr );
+ comm.Call_errhandler( MPI_ERR_OTHER );
+ if (calls != 1) {
+ errs++;
+ cout << "Error handler not called\n";
+ }
+ comm2 = comm.Dup();
+ calls = 0;
+ mycomm = comm2;
+ mycomm.Set_name( "dup of dup of comm_world" );
+ // comm2 must inherit the error handler from comm
+ comm2.Call_errhandler( MPI_ERR_OTHER );
+ if (calls != 1) {
+ errs++;
+ cout << "Error handler not called\n";
+ }
+
+ if (reset_handler) {
+ // extra checking of the reference count handling
+ comm.Set_errhandler( MPI::ERRORS_THROW_EXCEPTIONS );
+ }
+ newerr.Free();
+ comm.Free();
+ comm2.Free();
+ }
+ }
+
+ MTest_Finalize( errs );
+ MPI::Finalize();
+ return 0;
+}
Added: mpich2/trunk/test/mpi/cxx/errhan/testlist
===================================================================
--- mpich2/trunk/test/mpi/cxx/errhan/testlist (rev 0)
+++ mpich2/trunk/test/mpi/cxx/errhan/testlist 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,3 @@
+#adderr 1
+commcallx 2
+#errfatal 1 resultTest=TestErrFatal
Modified: mpich2/trunk/test/mpi/cxx/init/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/init/Makefile.sm 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/init/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -5,6 +5,7 @@
baseenv_SOURCES = baseenv.cxx
initstatx_SOURCES = initstatx.cxx
+initstat2x_SOURCES = initstat2x.cxx
../util/mtest.o:
(cd ../util && $(MAKE) mtest.o)
Added: mpich2/trunk/test/mpi/cxx/init/initstat2x.cxx
===================================================================
--- mpich2/trunk/test/mpi/cxx/init/initstat2x.cxx (rev 0)
+++ mpich2/trunk/test/mpi/cxx/init/initstat2x.cxx 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; c-basic-offset:4 ; -*- */
+/*
+ *
+ * (C) 2010 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include "mpitestconf.h"
+#ifdef HAVE_IOSTREAM
+// Not all C++ compilers have iostream instead of iostream.h
+#include <iostream>
+#ifdef HAVE_NAMESPACE_STD
+// Those that do often need the std namespace; otherwise, a bare "cout"
+// is likely to fail to compile
+using namespace std;
+#endif
+#else
+#include <iostream.h>
+#endif
+#include "mpitestcxx.h"
+
+int main( int argc, char *argv[] )
+{
+ int errs = 0;
+ bool flag;
+ int provided, claimed;
+
+ // This test must be invoked with two arguments: myarg1 myarg2
+ provided = MPI::Init_thread( argc, argv, MPI::THREAD_MULTIPLE );
+
+ if (argc != 3) {
+ errs++;
+ cout << "Expected argc=3 but saw argc=" << argc << "\n";
+ }
+ else {
+ if (strcmp( argv[1], "myarg1" ) != 0) {
+ errs++;
+ cout << "Expected myarg1 for 1st argument but saw " << argv[1]
+ << "\n";
+ }
+ if (strcmp( argv[2], "myarg2" ) != 0) {
+ errs++;
+ cout << "Expected myarg2 for 1st argument but saw " << argv[2]
+ << "\n";
+ }
+ }
+
+ // Confirm that MPI is properly initialized
+ flag = MPI::Is_thread_main();
+ if (!flag) {
+ errs++;
+ cout << "This thread call init_thread but Is_thread_main gave false\n";
+ }
+ claimed = MPI::Query_thread();
+ if (claimed != provided) {
+ errs++;
+ cout << "Query thread gave thread level " << claimed <<
+ " but Init_thread gave " << provided << "\n";
+ }
+
+ MTest_Finalize( errs );
+ MPI::Finalize();
+ return 0;
+}
Modified: mpich2/trunk/test/mpi/cxx/init/testlist
===================================================================
--- mpich2/trunk/test/mpi/cxx/init/testlist 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/init/testlist 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,2 +1,3 @@
baseenv 1
initstatx 1
+initstat2x 1 arg=myarg1 arg=myarg2
Modified: mpich2/trunk/test/mpi/cxx/rma/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/cxx/rma/Makefile.sm 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/rma/Makefile.sm 2010-11-29 19:22:10 UTC (rev 7521)
@@ -8,7 +8,15 @@
winfencex_SOURCES = winfencex.cxx
winscale1x_SOURCES = winscale1x.cxx
winscale2x_SOURCES = winscale2x.cxx
+wincallx_SOURCES = wincallx.cxx
fkeyvalwinx_SOURCES = fkeyvalwinx.cxx
../util/mtest.o:
cd ../util && $(MAKE) mtest.o
+
+testing:
+ ../../runtests -srcdir=$(srcdir) -tests=testlist \
+ -mpiexec=@MPIEXEC@ \
+ -xmlfile=summary.xml
+clean-local:
+ -rm -f summary.xml
Modified: mpich2/trunk/test/mpi/cxx/rma/testlist
===================================================================
--- mpich2/trunk/test/mpi/cxx/rma/testlist 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/rma/testlist 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,4 +1,5 @@
winnamex 1
+wincallx 1
getgroupx 4
winfencex 4
winscale1x 4
Added: mpich2/trunk/test/mpi/cxx/rma/wincallx.cxx
===================================================================
--- mpich2/trunk/test/mpi/cxx/rma/wincallx.cxx (rev 0)
+++ mpich2/trunk/test/mpi/cxx/rma/wincallx.cxx 2010-11-29 19:22:10 UTC (rev 7521)
@@ -0,0 +1,78 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *
+ * (C) 2010 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include "mpitestconf.h"
+#ifdef HAVE_IOSTREAM
+// Not all C++ compilers have iostream instead of iostream.h
+#include <iostream>
+#ifdef HAVE_NAMESPACE_STD
+// Those that do often need the std namespace; otherwise, a bare "cout"
+// is likely to fail to compile
+using namespace std;
+#endif
+#else
+#include <iostream.h>
+#endif
+#include <stdio.h>
+#include "mpitestcxx.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+static char MTEST_Descrip[] = "Test win_call_errhandler";
+
+static int calls = 0;
+static int errs = 0;
+static MPI::Win mywin;
+void eh( MPI::Win &win, int *err, ... )
+{
+ if (*err != MPI_ERR_OTHER) {
+ errs++;
+ cout << "Unexpected error code\n";
+ }
+ if (win != mywin) {
+ char cname[MPI_MAX_OBJECT_NAME];
+ int len;
+ errs++;
+ cout << "Unexpected window\n";
+ win.Get_name( cname, len );
+ cout << "Win is " << cname << "\n";
+ mywin.Get_name( cname, len );
+ cout << "Mywin is " << cname << "\n";
+ }
+ calls++;
+ return;
+}
+int main( int argc, char *argv[] )
+{
+ MPI::Win win;
+ MPI::Errhandler newerr;
+ int i;
+ int reset_handler;
+ int buf[10];
+
+ MTest_Init( );
+
+ win = MPI::Win::Create( buf, sizeof(buf), 1, MPI::INFO_NULL, MPI::COMM_WORLD );
+ mywin = win;
+ mywin.Set_name( "dup of win_world" );
+
+ newerr = MPI::Win::Create_errhandler( eh );
+
+ win.Set_errhandler( newerr );
+ win.Call_errhandler( MPI_ERR_OTHER );
+ newerr.Free();
+ if (calls != 1) {
+ errs++;
+ cout << "Error handler not called\n";
+ }
+ win.Free();
+
+ MTest_Finalize( errs );
+ MPI::Finalize();
+ return 0;
+}
Modified: mpich2/trunk/test/mpi/cxx/testlist.in
===================================================================
--- mpich2/trunk/test/mpi/cxx/testlist.in 2010-11-29 19:18:54 UTC (rev 7520)
+++ mpich2/trunk/test/mpi/cxx/testlist.in 2010-11-29 19:22:10 UTC (rev 7521)
@@ -1,7 +1,8 @@
attr
pt2pt
-comm
-coll
+comm
+coll
+errhan
init
info
datatype
More information about the mpich2-commits
mailing list