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();
35 if (err && verbose) fprintf(stderr, "%d errors in builtin struct test.\n", err);
38 /* print message and exit */
40 fprintf(stderr, "Found %d errors\n", errs);
43 printf(" No Errors\n");
49 /* builtin_struct_test()
51 * Tests behavior with a zero-count struct of builtins.
53 * Returns the number of errors encountered.
55 int builtin_struct_test(void)
65 err = MPI_Type_create_struct(count,
70 if (err != MPI_SUCCESS) {
73 "error creating struct type in builtin_struct_test()\n");
78 err = MPI_Type_size(newtype, &size);
79 if (err != MPI_SUCCESS) {
82 "error obtaining type size in builtin_struct_test()\n");
90 "error: size != 0 in builtin_struct_test()\n");
95 err = MPI_Type_extent(newtype, &extent);
96 if (err != MPI_SUCCESS) {
99 "error obtaining type extent in builtin_struct_test()\n");
107 "error: extent != 0 in builtin_struct_test()\n");
112 MPI_Type_free( &newtype );
118 int parse_args(int argc, char **argv)
123 while ((ret = getopt(argc, argv, "v")) >= 0)
132 if (argc > 1 && strcmp(argv[1], "-v") == 0)