1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
9 #include "mpitestconf.h"
14 static int verbose = 0;
17 int builtin_struct_test(void);
19 /* helper functions */
20 int parse_args(int argc, char **argv);
22 int main(int argc, char **argv)
26 MPI_Init(&argc, &argv); /* MPI-1.2 doesn't allow for MPI_Init(0,0) */
27 parse_args(argc, argv);
29 /* To improve reporting of problems about operations, we
30 * change the error handler to errors return */
31 MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
33 /* perform some tests */
34 err = builtin_struct_test();
36 fprintf(stderr, "%d errors in builtin struct test.\n", err);
39 /* print message and exit */
41 fprintf(stderr, "Found %d errors\n", errs);
44 printf(" No Errors\n");
50 /* builtin_struct_test()
52 * Tests behavior with a zero-count struct of builtins.
54 * Returns the number of errors encountered.
56 int builtin_struct_test(void)
66 err = MPI_Type_create_struct(count, (int *) 0, (MPI_Aint *) 0, (MPI_Datatype *) 0, &newtype);
67 if (err != MPI_SUCCESS) {
69 fprintf(stderr, "error creating struct type in builtin_struct_test()\n");
74 err = MPI_Type_size(newtype, &size);
75 if (err != MPI_SUCCESS) {
77 fprintf(stderr, "error obtaining type size in builtin_struct_test()\n");
84 fprintf(stderr, "error: size != 0 in builtin_struct_test()\n");
89 err = MPI_Type_extent(newtype, &extent);
90 if (err != MPI_SUCCESS) {
92 fprintf(stderr, "error obtaining type extent in builtin_struct_test()\n");
99 fprintf(stderr, "error: extent != 0 in builtin_struct_test()\n");
104 MPI_Type_free(&newtype);
110 int parse_args(int argc, char **argv)
115 * while ((ret = getopt(argc, argv, "v")) >= 0)
124 if (argc > 1 && strcmp(argv[1], "-v") == 0)