Blame test/mpi/errors/comm/cfree.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *  (C) 2001 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 "mpitest.h"
Packit 0848f5
Packit 0848f5
/* Check that freed communicators are detected */
Packit 0848f5
int main(int argc, char *argv[])
Packit 0848f5
{
Packit 0848f5
    MPI_Comm dup, dupcopy;
Packit 0848f5
    int errs = 0;
Packit 0848f5
    int ierr;
Packit 0848f5
Packit 0848f5
    MTest_Init(&argc, &argv);
Packit 0848f5
Packit 0848f5
    MPI_Comm_dup(MPI_COMM_WORLD, &dup;;
Packit 0848f5
    MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
Packit 0848f5
    dupcopy = dup;
Packit 0848f5
    MPI_Comm_free(&dupcopy);
Packit 0848f5
    ierr = MPI_Barrier(dup);
Packit 0848f5
    if (ierr == MPI_SUCCESS) {
Packit 0848f5
        errs++;
Packit 0848f5
        printf("Returned wrong code (SUCCESS) in barrier\n");
Packit 0848f5
    }
Packit 0848f5
Packit 0848f5
    {
Packit 0848f5
        int in, *input = ∈
Packit 0848f5
        int out, *output = &out;
Packit 0848f5
        ierr = MPI_Allgather(input, 1, MPI_INT, output, 1, MPI_INT, dup);
Packit 0848f5
    }
Packit 0848f5
    if (ierr == MPI_SUCCESS) {
Packit 0848f5
        errs++;
Packit 0848f5
        printf("Returned wrong code (SUCCESS) in allgather\n");
Packit 0848f5
    }
Packit 0848f5
Packit 0848f5
    MTest_Finalize(errs);
Packit 0848f5
Packit 0848f5
    MPI_Finalize();
Packit 0848f5
    return 0;
Packit 0848f5
}