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.
10 #include "mpitestconf.h"
16 The default behavior of the test routines should be to briefly indicate
17 the cause of any errors - in this test, that means that verbose needs
18 to be set. Verbose should turn on output that is independent of error
21 static int verbose = 1;
24 int no_real_types_test(void);
26 /* helper functions */
27 int parse_args(int argc, char **argv);
29 int main(int argc, char **argv)
33 MTest_Init(&argc, &argv);
34 parse_args(argc, argv);
36 /* To improve reporting of problems about operations, we
37 * change the error handler to errors return */
38 MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
40 /* perform some tests */
41 err = no_real_types_test();
43 fprintf(stderr, "%d errors in blockindexed test.\n", err);
51 /* no_real_types_test()
53 * Tests behavior with an empty struct type
55 * Returns the number of errors encountered.
57 int no_real_types_test(void)
64 MPI_Datatype type = MPI_LB;
70 err = MPI_Type_create_struct(count, &len, &disp, &type, &newtype);
71 if (err != MPI_SUCCESS) {
73 fprintf(stderr, "error creating struct type no_real_types_test()\n");
79 err = MPI_Type_size(newtype, &size);
80 if (err != MPI_SUCCESS) {
82 fprintf(stderr, "error obtaining type size in no_real_types_test()\n");
90 fprintf(stderr, "error: size != 0 in no_real_types_test()\n");
95 err = MPI_Type_extent(newtype, &extent);
96 if (err != MPI_SUCCESS) {
98 fprintf(stderr, "error obtaining type extent in no_real_types_test()\n");
100 MTestPrintError(err);
107 "error: extent is %ld but should be -10 in no_real_types_test()\n",
109 fprintf(stderr, "type map is { (LB,10) }, so UB is 0 and extent is ub-lb\n");
114 MPI_Type_free(&newtype);
120 int parse_args(int argc, char **argv)
125 * while ((ret = getopt(argc, argv, "v")) >= 0)
134 if (argc > 1 && strcmp(argv[1], "-v") == 0)