1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #include "mpi.h"
7 #include <stdio.h>
8 #include <string.h>
9 #include "mpitest.h"
10 
11 /* calling MPI_Unpublish_name before calling MPI_Publish_name
12    (a user error) would  cause the process manager to die. This is
13    added as a regression test so that it doesn't happen in the future. */
14 
main(int argc,char * argv[])15 int main(int argc, char *argv[])
16 {
17     int rc, errclass, errs = 0;
18     char port_name[MPI_MAX_PORT_NAME], serv_name[256];
19 
20     MTest_Init(&argc, &argv);
21 
22     strcpy(port_name, "otherhost:122");
23     strcpy(serv_name, "MyTest");
24 
25     MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
26 
27     rc = MPI_Unpublish_name(serv_name, MPI_INFO_NULL, port_name);
28     MPI_Error_class(rc, &errclass);
29     if (errclass != MPI_ERR_SERVICE)
30         ++errs;
31 
32     MTest_Finalize(errs);
33     return MTestReturnValue(errs);
34 }
35