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();
42 if (err && verbose) fprintf(stderr, "%d errors in blockindexed test.\n",
46 MTest_Finalize( errs );
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,
75 if (err != MPI_SUCCESS) {
78 "error creating struct type no_real_types_test()\n");
80 MTestPrintError( err );
84 err = MPI_Type_size(newtype, &size);
85 if (err != MPI_SUCCESS) {
88 "error obtaining type size in no_real_types_test()\n");
90 MTestPrintError( err );
97 "error: size != 0 in no_real_types_test()\n");
102 err = MPI_Type_extent(newtype, &extent);
103 if (err != MPI_SUCCESS) {
106 "error obtaining type extent in no_real_types_test()\n");
108 MTestPrintError( err );
115 "error: extent is %ld but should be -10 in no_real_types_test()\n",
118 "type map is { (LB,10) }, so UB is 0 and extent is ub-lb\n" );
123 MPI_Type_free( &newtype );
129 int parse_args(int argc, char **argv)
134 while ((ret = getopt(argc, argv, "v")) >= 0)
143 if (argc > 1 && strcmp(argv[1], "-v") == 0)