Blame test/mpi/errors/spawn/unpub.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *
Packit 0848f5
 *  (C) 2003 by Argonne National Laboratory.
Packit 0848f5
 *      See COPYRIGHT in top-level directory.
Packit 0848f5
 */
Packit 0848f5
#include "mpi.h"
Packit 0848f5
#include <stdio.h>
Packit 0848f5
#include <string.h>
Packit 0848f5
#include "mpitest.h"
Packit 0848f5
Packit 0848f5
/* calling MPI_Unpublish_name before calling MPI_Publish_name
Packit 0848f5
   (a user error) would  cause the process manager to die. This is
Packit 0848f5
   added as a regression test so that it doesn't happen in the future. */
Packit 0848f5
Packit 0848f5
int main(int argc, char *argv[])
Packit 0848f5
{
Packit 0848f5
    int rc, errclass, errs = 0;
Packit 0848f5
    char port_name[MPI_MAX_PORT_NAME], serv_name[256];
Packit 0848f5
Packit 0848f5
    MTest_Init(&argc, &argv);
Packit 0848f5
Packit 0848f5
    strcpy(port_name, "otherhost:122");
Packit 0848f5
    strcpy(serv_name, "MyTest");
Packit 0848f5
Packit 0848f5
    MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
Packit 0848f5
Packit 0848f5
    rc = MPI_Unpublish_name(serv_name, MPI_INFO_NULL, port_name);
Packit 0848f5
    MPI_Error_class(rc, &errclass);
Packit 0848f5
    if (errclass != MPI_ERR_SERVICE)
Packit 0848f5
        ++errs;
Packit 0848f5
Packit 0848f5
    MTest_Finalize(errs);
Packit 0848f5
    MPI_Finalize();
Packit 0848f5
    return 0;
Packit 0848f5
Packit 0848f5
}