[mpich2-commits] r5622 - in mpich2/trunk/test/mpi: errors/cxx/io errors/io io
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Thu Oct 29 16:56:55 CDT 2009
Author: goodell
Date: 2009-10-29 16:56:55 -0500 (Thu, 29 Oct 2009)
New Revision: 5622
Modified:
mpich2/trunk/test/mpi/errors/cxx/io/fileerrretx.cxx
mpich2/trunk/test/mpi/errors/io/fileerrret.c
mpich2/trunk/test/mpi/io/userioerr.c
Log:
Fix errhandler leaks in fileerrret, fileerrretx, and userioerr tests.
Reviewed by robl at .
Modified: mpich2/trunk/test/mpi/errors/cxx/io/fileerrretx.cxx
===================================================================
--- mpich2/trunk/test/mpi/errors/cxx/io/fileerrretx.cxx 2009-10-29 21:48:44 UTC (rev 5621)
+++ mpich2/trunk/test/mpi/errors/cxx/io/fileerrretx.cxx 2009-10-29 21:56:55 UTC (rev 5622)
@@ -66,6 +66,7 @@
// the error handler on MPI::FILE_NULL.
eh = MPI::File::Create_errhandler( efn );
MPI::FILE_NULL.Set_errhandler( eh );
+ eh.Free();
sawErr = 0;
try {
fh = MPI::File::Open(MPI::COMM_WORLD, filename,
Modified: mpich2/trunk/test/mpi/errors/io/fileerrret.c
===================================================================
--- mpich2/trunk/test/mpi/errors/io/fileerrret.c 2009-10-29 21:48:44 UTC (rev 5621)
+++ mpich2/trunk/test/mpi/errors/io/fileerrret.c 2009-10-29 21:56:55 UTC (rev 5622)
@@ -46,6 +46,7 @@
the error handler on MPI_FILE_NULL. */
MPI_File_create_errhandler( efn, &eh );
MPI_File_set_errhandler( MPI_FILE_NULL, eh );
+ MPI_Errhandler_free(&eh);
rc = MPI_File_open(MPI_COMM_WORLD, filename,
MPI_MODE_RDWR, MPI_INFO_NULL, &fh );
Modified: mpich2/trunk/test/mpi/io/userioerr.c
===================================================================
--- mpich2/trunk/test/mpi/io/userioerr.c 2009-10-29 21:48:44 UTC (rev 5621)
+++ mpich2/trunk/test/mpi/io/userioerr.c 2009-10-29 21:56:55 UTC (rev 5622)
@@ -48,8 +48,24 @@
}
rc = MPI_File_create_errhandler( user_handler, &ioerr_handler );
+ if (rc) {
+ errs++;
+ printf("MPI_Errhandler_create returned an error code: %d\n");
+ }
+
rc = MPI_File_set_errhandler( fh, ioerr_handler );
+ if (rc) {
+ errs++;
+ printf("MPI_File_set_errhandler returned an error code: %d\n");
+ }
+ /* avoid leaking the errhandler, safe because they have refcount semantics */
+ rc = MPI_Errhandler_free(&ioerr_handler);
+ if (rc) {
+ errs++;
+ printf("MPI_Errhandler_free returned an error code: %d\n");
+ }
+
/* This should generate an error because the file mode is WRONLY */
rc = MPI_File_read_at( fh, 0, inbuf, 80, MPI_BYTE, &status );
if (handlerCalled != 1) {
@@ -57,8 +73,12 @@
printf( "User-defined error handler was not called\n" );
}
- MPI_File_close( &fh );
-
+ rc = MPI_File_close( &fh );
+ if (rc) {
+ errs++;
+ printf("MPI_File_close returned an error code: %d\n");
+ }
+
MTest_Finalize( errs );
MPI_Finalize( );
return 0;
More information about the mpich2-commits
mailing list