1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
3 * (C) 2006 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
5 */
6 #include "mpi.h"
7 #include <stdio.h>
8 #include "mpitest.h"
9
10 /* Set verbose to 1 to see the error message */
11 static int verbose = 0;
12
main(int argc,char * argv[])13 int main( int argc, char *argv[] )
14 {
15 int ierr, errs=0;
16 MPI_Comm newcomm = MPI_COMM_NULL;
17
18 MTest_Init( &argc, &argv );
19
20 MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
21 ierr = MPI_Comm_connect( (char*)"myhost:27", MPI_INFO_NULL, 0,
22 MPI_COMM_WORLD, &newcomm );
23 if (ierr == MPI_SUCCESS) {
24 errs++;
25 printf( "Comm_connect returned success with bogus port\n" );
26 MPI_Comm_free( &newcomm );
27 }
28 else {
29 if (verbose) {
30 char str[MPI_MAX_ERROR_STRING];
31 int slen;
32 /* Check the message */
33 MPI_Error_string( ierr, str, &slen );
34 printf( "Error message is: %s\n", str );
35 }
36 if (newcomm != MPI_COMM_NULL) {
37 errs++;
38 printf( "Comm_connect returned a communicator even with an error\n" );
39 }
40 }
41 fflush(stdout);
42
43 MTest_Finalize( errs );
44 MPI_Finalize();
45
46 return 0;
47 }
48