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 int_with_lb_ub_test(void);
25 int contig_of_int_with_lb_ub_test(void);
26 int contig_negextent_of_int_with_lb_ub_test(void);
27 int vector_of_int_with_lb_ub_test(void);
28 int vector_blklen_of_int_with_lb_ub_test(void);
29 int vector_blklen_stride_of_int_with_lb_ub_test(void);
30 int vector_blklen_stride_negextent_of_int_with_lb_ub_test(void);
31 int vector_blklen_negstride_negextent_of_int_with_lb_ub_test(void);
32 int int_with_negextent_test(void);
33 int vector_blklen_negstride_of_int_with_lb_ub_test(void);
35 /* helper functions */
36 int parse_args(int argc, char **argv);
38 int main(int argc, char **argv)
42 MTest_Init(&argc, &argv);
43 parse_args(argc, argv);
45 /* To improve reporting of problems about operations, we
46 * change the error handler to errors return */
47 MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
49 /* perform some tests */
50 err = int_with_lb_ub_test();
52 fprintf(stderr, "found %d errors in simple lb/ub test\n", err);
55 err = contig_of_int_with_lb_ub_test();
57 fprintf(stderr, "found %d errors in contig test\n", err);
60 err = contig_negextent_of_int_with_lb_ub_test();
62 fprintf(stderr, "found %d errors in negextent contig test\n", err);
65 err = vector_of_int_with_lb_ub_test();
67 fprintf(stderr, "found %d errors in simple vector test\n", err);
70 err = vector_blklen_of_int_with_lb_ub_test();
72 fprintf(stderr, "found %d errors in vector blklen test\n", err);
75 err = vector_blklen_stride_of_int_with_lb_ub_test();
77 fprintf(stderr, "found %d errors in strided vector test\n", err);
80 err = vector_blklen_negstride_of_int_with_lb_ub_test();
82 fprintf(stderr, "found %d errors in negstrided vector test\n", err);
85 err = int_with_negextent_test();
87 fprintf(stderr, "found %d errors in negextent lb/ub test\n", err);
90 err = vector_blklen_stride_negextent_of_int_with_lb_ub_test();
92 fprintf(stderr, "found %d errors in strided negextent vector test\n", err);
95 err = vector_blklen_negstride_negextent_of_int_with_lb_ub_test();
97 fprintf(stderr, "found %d errors in negstrided negextent vector test\n", err);
100 MTest_Finalize(errs);
105 int parse_args(int argc, char **argv)
110 * while ((ret = getopt(argc, argv, "v")) >= 0)
119 if (argc > 1 && strcmp(argv[1], "-v") == 0)
124 int int_with_lb_ub_test(void)
126 int err, errs = 0, val;
127 MPI_Aint lb, extent, aval, true_lb;
128 int blocks[3] = { 1, 4, 1 };
129 MPI_Aint disps[3] = { -3, 0, 6 };
130 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
132 MPI_Datatype eviltype;
134 err = MPI_Type_struct(3, blocks, disps, types, &eviltype);
135 if (err != MPI_SUCCESS) {
138 fprintf(stderr, " MPI_Type_struct failed.\n");
140 MTestPrintError(err);
143 err = MPI_Type_size(eviltype, &val);
144 if (err != MPI_SUCCESS) {
147 fprintf(stderr, " MPI_Type_size failed.\n");
149 MTestPrintError(err);
155 fprintf(stderr, " size of type = %d; should be %d\n", val, 4);
158 err = MPI_Type_extent(eviltype, &aval);
159 if (err != MPI_SUCCESS) {
162 fprintf(stderr, " MPI_Type_extent failed.\n");
164 MTestPrintError(err);
170 fprintf(stderr, " extent of type = %ld; should be %d\n", (long) aval, 9);
173 err = MPI_Type_lb(eviltype, &aval);
174 if (err != MPI_SUCCESS) {
177 fprintf(stderr, " MPI_Type_lb failed.\n");
179 MTestPrintError(err);
185 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
188 err = MPI_Type_get_extent(eviltype, &lb, &extent);
189 if (err != MPI_SUCCESS) {
192 fprintf(stderr, " MPI_Type_get_extent failed.\n");
194 MTestPrintError(err);
200 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
206 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 9);
209 err = MPI_Type_ub(eviltype, &aval);
210 if (err != MPI_SUCCESS) {
213 fprintf(stderr, " MPI_Type_ub failed.\n");
215 MTestPrintError(err);
221 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, 6);
224 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
225 if (err != MPI_SUCCESS) {
228 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
230 MTestPrintError(err);
236 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, 0);
242 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 4);
245 MPI_Type_free(&eviltype);
250 int contig_of_int_with_lb_ub_test(void)
252 int err, errs = 0, val;
253 MPI_Aint lb, extent, aval, true_lb;
254 int blocks[3] = { 1, 4, 1 };
255 MPI_Aint disps[3] = { -3, 0, 6 };
256 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
257 char *typemapstring = 0;
259 MPI_Datatype inttype, eviltype;
261 /* build same type as in int_with_lb_ub_test() */
262 typemapstring = (char *) "{ (LB,-3),4*(BYTE,0),(UB,6) }";
263 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
264 if (err != MPI_SUCCESS) {
267 fprintf(stderr, " MPI_Type_struct of %s failed.\n", typemapstring);
269 MTestPrintError(err);
270 /* no point in continuing */
274 typemapstring = (char *)
275 "{ (LB,-3),4*(BYTE,0),(UB,6),(LB,6),4*(BYTE,9),(UB,15),(LB,15),4*(BYTE,18),(UB,24)}";
276 err = MPI_Type_contiguous(3, inttype, &eviltype);
277 if (err != MPI_SUCCESS) {
280 fprintf(stderr, " MPI_Type_contiguous of %s failed.\n", typemapstring);
282 MTestPrintError(err);
283 /* no point in continuing */
287 err = MPI_Type_size(eviltype, &val);
288 if (err != MPI_SUCCESS) {
291 fprintf(stderr, " MPI_Type_size of %s failed.\n", typemapstring);
293 MTestPrintError(err);
299 fprintf(stderr, " size of type = %d; should be %d\n", val, 12);
302 err = MPI_Type_extent(eviltype, &aval);
303 if (err != MPI_SUCCESS) {
306 fprintf(stderr, " MPI_Type_extent failed.\n");
308 MTestPrintError(err);
314 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 27);
316 fprintf(stderr, " for type %s\n", typemapstring);
319 err = MPI_Type_lb(eviltype, &aval);
320 if (err != MPI_SUCCESS) {
323 fprintf(stderr, " MPI_Type_lb failed.\n");
325 MTestPrintError(err);
331 fprintf(stderr, " lb of type = %d from Type_lb; should be %d in %s\n", (int) aval, -3,
335 err = MPI_Type_get_extent(eviltype, &lb, &extent);
336 if (err != MPI_SUCCESS) {
339 fprintf(stderr, " MPI_Type_get_extent failed.\n");
341 MTestPrintError(err);
347 fprintf(stderr, " lb of type = %d from Type_get_extent; should be %d in %s\n",
348 (int) aval, -3, typemapstring);
354 fprintf(stderr, " extent of type = %d from Type_get_extent; should be %d in %s\n",
355 (int) extent, 27, typemapstring);
358 err = MPI_Type_ub(eviltype, &aval);
359 if (err != MPI_SUCCESS) {
362 fprintf(stderr, " MPI_Type_ub failed.\n");
364 MTestPrintError(err);
370 fprintf(stderr, " ub of type = %d in Type_ub; should be %din %s\n", (int) aval, 24,
374 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
375 if (err != MPI_SUCCESS) {
378 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
380 MTestPrintError(err);
386 fprintf(stderr, " true_lb of type = %d; should be %d in %s\n", (int) true_lb, 0,
393 fprintf(stderr, " true extent of type = %d; should be %d in %s\n", (int) aval, 22,
397 MPI_Type_free(&inttype);
398 MPI_Type_free(&eviltype);
403 int contig_negextent_of_int_with_lb_ub_test(void)
405 int err, errs = 0, val;
406 MPI_Aint lb, extent, aval, true_lb;
407 int blocks[3] = { 1, 4, 1 };
408 MPI_Aint disps[3] = { 6, 0, -3 };
409 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
410 char *typemapstring = 0;
412 MPI_Datatype inttype, eviltype;
414 /* build same type as in int_with_lb_ub_test() */
415 typemapstring = (char *) "{ (LB,6),4*(BYTE,0),(UB,-3) }";
416 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
417 if (err != MPI_SUCCESS) {
420 fprintf(stderr, " MPI_Type_struct of %s failed.\n", typemapstring);
422 MTestPrintError(err);
423 /* No point in continuing */
427 typemapstring = (char *)
428 "{ (LB,6),4*(BYTE,0),(UB,-3),(LB,-3),4*(BYTE,-9),(UB,-12),(LB,-12),4*(BYTE,-18),(UB,-21) }";
429 err = MPI_Type_contiguous(3, inttype, &eviltype);
430 if (err != MPI_SUCCESS) {
433 fprintf(stderr, " MPI_Type_contiguous of %s failed.\n", typemapstring);
435 MTestPrintError(err);
436 /* No point in continuing */
440 err = MPI_Type_size(eviltype, &val);
441 if (err != MPI_SUCCESS) {
444 fprintf(stderr, " MPI_Type_size of %s failed.\n", typemapstring);
446 MTestPrintError(err);
452 fprintf(stderr, " size of type = %d; should be %d\n", val, 12);
455 err = MPI_Type_extent(eviltype, &aval);
456 if (err != MPI_SUCCESS) {
459 fprintf(stderr, " MPI_Type_extent failed.\n");
461 MTestPrintError(err);
467 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 9);
470 err = MPI_Type_lb(eviltype, &aval);
471 if (err != MPI_SUCCESS) {
474 fprintf(stderr, " MPI_Type_lb failed.\n");
476 MTestPrintError(err);
482 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -12);
485 err = MPI_Type_get_extent(eviltype, &lb, &extent);
486 if (err != MPI_SUCCESS) {
489 fprintf(stderr, " MPI_Type_get_extent failed.\n");
491 MTestPrintError(err);
497 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -12);
503 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 9);
506 err = MPI_Type_ub(eviltype, &aval);
507 if (err != MPI_SUCCESS) {
510 fprintf(stderr, " MPI_Type_ub failed.\n");
512 MTestPrintError(err);
518 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, -3);
521 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
522 if (err != MPI_SUCCESS) {
525 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
527 MTestPrintError(err);
530 if (true_lb != -18) {
533 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, -18);
539 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 22);
542 MPI_Type_free(&inttype);
543 MPI_Type_free(&eviltype);
548 int vector_of_int_with_lb_ub_test(void)
550 int err, errs = 0, val;
551 MPI_Aint lb, extent, aval, true_lb;
552 int blocks[3] = { 1, 4, 1 };
553 MPI_Aint disps[3] = { -3, 0, 6 };
554 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
556 MPI_Datatype inttype, eviltype;
558 /* build same type as in int_with_lb_ub_test() */
559 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
560 if (err != MPI_SUCCESS) {
563 fprintf(stderr, " MPI_Type_struct failed.\n");
565 MTestPrintError(err);
566 /* no point in continuing */
570 err = MPI_Type_vector(3, 1, 1, inttype, &eviltype);
571 if (err != MPI_SUCCESS) {
574 fprintf(stderr, " MPI_Type_vector failed.\n");
576 MTestPrintError(err);
577 /* no point in continuing */
581 err = MPI_Type_size(eviltype, &val);
582 if (err != MPI_SUCCESS) {
585 fprintf(stderr, " MPI_Type_size failed.\n");
587 MTestPrintError(err);
593 fprintf(stderr, " size of type = %d; should be %d\n", val, 12);
596 err = MPI_Type_extent(eviltype, &aval);
597 if (err != MPI_SUCCESS) {
600 fprintf(stderr, " MPI_Type_extent failed.\n");
602 MTestPrintError(err);
608 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 27);
611 err = MPI_Type_lb(eviltype, &aval);
612 if (err != MPI_SUCCESS) {
615 fprintf(stderr, " MPI_Type_lb failed.\n");
617 MTestPrintError(err);
623 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
626 err = MPI_Type_get_extent(eviltype, &lb, &extent);
627 if (err != MPI_SUCCESS) {
630 fprintf(stderr, " MPI_Type_get_extent failed.\n");
632 MTestPrintError(err);
638 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
644 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 27);
647 err = MPI_Type_ub(eviltype, &aval);
648 if (err != MPI_SUCCESS) {
651 fprintf(stderr, " MPI_Type_ub failed.\n");
653 MTestPrintError(err);
659 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, 24);
662 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
663 if (err != MPI_SUCCESS) {
666 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
668 MTestPrintError(err);
674 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, 0);
680 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 22);
683 MPI_Type_free(&inttype);
684 MPI_Type_free(&eviltype);
692 int vector_blklen_of_int_with_lb_ub_test(void)
694 int err, errs = 0, val;
695 MPI_Aint lb, extent, aval, true_lb;
696 int blocks[3] = { 1, 4, 1 };
697 MPI_Aint disps[3] = { -3, 0, 6 };
698 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
700 MPI_Datatype inttype, eviltype;
702 /* build same type as in int_with_lb_ub_test() */
703 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
704 if (err != MPI_SUCCESS) {
707 fprintf(stderr, " MPI_Type_struct failed.\n");
709 MTestPrintError(err);
710 /* no point in continuing */
714 err = MPI_Type_vector(3, 4, 1, inttype, &eviltype);
715 if (err != MPI_SUCCESS) {
718 fprintf(stderr, " MPI_Type_vector failed.\n");
720 MTestPrintError(err);
721 /* no point in continuing */
725 err = MPI_Type_size(eviltype, &val);
726 if (err != MPI_SUCCESS) {
729 fprintf(stderr, " MPI_Type_size failed.\n");
731 MTestPrintError(err);
737 fprintf(stderr, " size of type = %d; should be %d\n", val, 48);
740 err = MPI_Type_extent(eviltype, &aval);
741 if (err != MPI_SUCCESS) {
744 fprintf(stderr, " MPI_Type_extent failed.\n");
746 MTestPrintError(err);
752 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 54);
755 err = MPI_Type_lb(eviltype, &aval);
756 if (err != MPI_SUCCESS) {
759 fprintf(stderr, " MPI_Type_lb failed.\n");
761 MTestPrintError(err);
767 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
769 MTestPrintError(err);
772 err = MPI_Type_get_extent(eviltype, &lb, &extent);
773 if (err != MPI_SUCCESS) {
776 fprintf(stderr, " MPI_Type_get_extent failed.\n");
778 MTestPrintError(err);
784 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
790 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 54);
793 err = MPI_Type_ub(eviltype, &aval);
794 if (err != MPI_SUCCESS) {
797 fprintf(stderr, " MPI_Type_ub failed.\n");
799 MTestPrintError(err);
805 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, 51);
808 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
809 if (err != MPI_SUCCESS) {
812 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
814 MTestPrintError(err);
820 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, 0);
826 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 49);
829 MPI_Type_free(&inttype);
830 MPI_Type_free(&eviltype);
835 int vector_blklen_stride_of_int_with_lb_ub_test(void)
837 int err, errs = 0, val;
838 MPI_Aint lb, extent, aval, true_lb;
839 int blocks[3] = { 1, 4, 1 };
840 MPI_Aint disps[3] = { -3, 0, 6 };
841 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
842 char *typemapstring = 0;
844 MPI_Datatype inttype, eviltype;
846 /* build same type as in int_with_lb_ub_test() */
847 typemapstring = (char *) "{ (LB,-3),4*(BYTE,0),(UB,6) }";
848 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
849 if (err != MPI_SUCCESS) {
852 fprintf(stderr, " MPI_Type_struct of %s failed.\n", typemapstring);
854 MTestPrintError(err);
855 /* No point in continuing */
859 err = MPI_Type_vector(3, 4, 5, inttype, &eviltype);
860 if (err != MPI_SUCCESS) {
863 fprintf(stderr, " MPI_Type_vector failed.\n");
865 MTestPrintError(err);
866 /* no point in continuing */
870 err = MPI_Type_size(eviltype, &val);
871 if (err != MPI_SUCCESS) {
874 fprintf(stderr, " MPI_Type_size failed.\n");
876 MTestPrintError(err);
882 fprintf(stderr, " size of type = %d; should be %d\n", val, 48);
885 err = MPI_Type_extent(eviltype, &aval);
886 if (err != MPI_SUCCESS) {
889 fprintf(stderr, " MPI_Type_extent failed.\n");
891 MTestPrintError(err);
897 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 126);
900 err = MPI_Type_lb(eviltype, &aval);
901 if (err != MPI_SUCCESS) {
904 fprintf(stderr, " MPI_Type_lb failed.\n");
906 MTestPrintError(err);
912 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
915 err = MPI_Type_get_extent(eviltype, &lb, &extent);
916 if (err != MPI_SUCCESS) {
919 fprintf(stderr, " MPI_Type_get_extent failed.\n");
921 MTestPrintError(err);
927 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -3);
933 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 126);
936 err = MPI_Type_ub(eviltype, &aval);
937 if (err != MPI_SUCCESS) {
940 fprintf(stderr, " MPI_Type_ub failed.\n");
942 MTestPrintError(err);
948 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, 123);
951 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
952 if (err != MPI_SUCCESS) {
955 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
957 MTestPrintError(err);
963 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, 0);
969 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 121);
972 MPI_Type_free(&inttype);
973 MPI_Type_free(&eviltype);
978 int vector_blklen_negstride_of_int_with_lb_ub_test(void)
980 int err, errs = 0, val;
981 MPI_Aint lb, extent, aval, true_lb;
982 int blocks[3] = { 1, 4, 1 };
983 MPI_Aint disps[3] = { -3, 0, 6 };
984 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
986 MPI_Datatype inttype, eviltype;
988 /* build same type as in int_with_lb_ub_test() */
989 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
990 if (err != MPI_SUCCESS) {
993 fprintf(stderr, " MPI_Type_struct failed.\n");
995 MTestPrintError(err);
996 /* no point in continuing */
1000 err = MPI_Type_vector(3, 4, -5, inttype, &eviltype);
1001 if (err != MPI_SUCCESS) {
1004 fprintf(stderr, " MPI_Type_vector failed.\n");
1006 MTestPrintError(err);
1007 /* no point in continuing */
1011 err = MPI_Type_size(eviltype, &val);
1012 if (err != MPI_SUCCESS) {
1015 fprintf(stderr, " MPI_Type_size failed.\n");
1017 MTestPrintError(err);
1023 fprintf(stderr, " size of type = %d; should be %d\n", val, 48);
1026 err = MPI_Type_extent(eviltype, &aval);
1027 if (err != MPI_SUCCESS) {
1030 fprintf(stderr, " MPI_Type_extent failed.\n");
1032 MTestPrintError(err);
1038 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 126);
1041 err = MPI_Type_lb(eviltype, &aval);
1042 if (err != MPI_SUCCESS) {
1045 fprintf(stderr, " MPI_Type_lb failed.\n");
1047 MTestPrintError(err);
1053 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -93);
1056 err = MPI_Type_get_extent(eviltype, &lb, &extent);
1057 if (err != MPI_SUCCESS) {
1060 fprintf(stderr, " MPI_Type_get_extent failed.\n");
1062 MTestPrintError(err);
1068 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -93);
1071 if (extent != 126) {
1074 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 126);
1077 err = MPI_Type_ub(eviltype, &aval);
1078 if (err != MPI_SUCCESS) {
1081 fprintf(stderr, " MPI_Type_ub failed.\n");
1083 MTestPrintError(err);
1089 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, 33);
1092 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
1093 if (err != MPI_SUCCESS) {
1096 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
1098 MTestPrintError(err);
1101 if (true_lb != -90) {
1104 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, -90);
1110 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 121);
1113 MPI_Type_free(&inttype);
1114 MPI_Type_free(&eviltype);
1119 int int_with_negextent_test(void)
1121 int err, errs = 0, val;
1122 MPI_Aint lb, extent, aval, true_lb;
1123 int blocks[3] = { 1, 4, 1 };
1124 MPI_Aint disps[3] = { 6, 0, -3 };
1125 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
1126 char *typemapstring = 0;
1128 MPI_Datatype eviltype;
1130 typemapstring = (char *) "{ (LB,6),4*(BYTE,0),(UB,-3) }";
1131 err = MPI_Type_struct(3, blocks, disps, types, &eviltype);
1132 if (err != MPI_SUCCESS) {
1135 fprintf(stderr, " MPI_Type_struct of %s failed.\n", typemapstring);
1137 MTestPrintError(err);
1138 /* No point in contiuing */
1142 err = MPI_Type_size(eviltype, &val);
1143 if (err != MPI_SUCCESS) {
1146 fprintf(stderr, " MPI_Type_size failed.\n");
1148 MTestPrintError(err);
1154 fprintf(stderr, " size of type = %d; should be %d\n", val, 4);
1157 err = MPI_Type_extent(eviltype, &aval);
1158 if (err != MPI_SUCCESS) {
1161 fprintf(stderr, " MPI_Type_extent failed.\n");
1163 MTestPrintError(err);
1169 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, -9);
1172 err = MPI_Type_lb(eviltype, &aval);
1173 if (err != MPI_SUCCESS) {
1176 fprintf(stderr, " MPI_Type_lb failed.\n");
1178 MTestPrintError(err);
1184 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, 6);
1187 err = MPI_Type_get_extent(eviltype, &lb, &extent);
1188 if (err != MPI_SUCCESS) {
1191 fprintf(stderr, " MPI_Type_get_extent failed.\n");
1193 MTestPrintError(err);
1199 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, 6);
1205 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, -9);
1208 err = MPI_Type_ub(eviltype, &aval);
1209 if (err != MPI_SUCCESS) {
1212 fprintf(stderr, " MPI_Type_ub failed.\n");
1214 MTestPrintError(err);
1220 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, -3);
1223 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
1224 if (err != MPI_SUCCESS) {
1227 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
1229 MTestPrintError(err);
1235 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, 0);
1241 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 4);
1244 MPI_Type_free(&eviltype);
1249 int vector_blklen_stride_negextent_of_int_with_lb_ub_test(void)
1251 int err, errs = 0, val;
1252 MPI_Aint lb, extent, true_lb, aval;
1253 int blocks[3] = { 1, 4, 1 };
1254 MPI_Aint disps[3] = { 6, 0, -3 };
1255 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
1256 MPI_Datatype inttype, eviltype;
1257 char *typemapstring = 0;
1259 /* build same type as in int_with_lb_ub_test() */
1260 typemapstring = (char *) "{ (LB,6),4*(BYTE,0),(UB,-3) }";
1261 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
1262 if (err != MPI_SUCCESS) {
1265 fprintf(stderr, " MPI_Type_struct of %s failed.\n", typemapstring);
1267 MTestPrintError(err);
1268 /* No point in continuing */
1272 err = MPI_Type_vector(3, 4, 5, inttype, &eviltype);
1273 if (err != MPI_SUCCESS) {
1276 fprintf(stderr, " MPI_Type_vector failed.\n");
1278 MTestPrintError(err);
1279 /* no point in continuing */
1283 err = MPI_Type_size(eviltype, &val);
1284 if (err != MPI_SUCCESS) {
1287 fprintf(stderr, " MPI_Type_size failed.\n");
1289 MTestPrintError(err);
1295 fprintf(stderr, " size of type = %d; should be %d\n", val, 48);
1298 err = MPI_Type_extent(eviltype, &aval);
1299 if (err != MPI_SUCCESS) {
1302 fprintf(stderr, " MPI_Type_extent failed.\n");
1304 MTestPrintError(err);
1310 fprintf(stderr, " extent of type = %d; should be %d\n", (int) aval, 108);
1313 err = MPI_Type_lb(eviltype, &aval);
1314 if (err != MPI_SUCCESS) {
1317 fprintf(stderr, " MPI_Type_lb failed.\n");
1319 MTestPrintError(err);
1325 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -111);
1328 err = MPI_Type_get_extent(eviltype, &lb, &extent);
1329 if (err != MPI_SUCCESS) {
1332 fprintf(stderr, " MPI_Type_get_extent failed.\n");
1334 MTestPrintError(err);
1340 fprintf(stderr, " lb of type = %d; should be %d\n", (int) aval, -111);
1343 if (extent != 108) {
1346 fprintf(stderr, " extent of type = %d; should be %d\n", (int) extent, 108);
1349 err = MPI_Type_ub(eviltype, &aval);
1350 if (err != MPI_SUCCESS) {
1353 fprintf(stderr, " MPI_Type_ub failed.\n");
1355 MTestPrintError(err);
1361 fprintf(stderr, " ub of type = %d; should be %d\n", (int) aval, -3);
1364 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
1365 if (err != MPI_SUCCESS) {
1368 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
1370 MTestPrintError(err);
1373 if (true_lb != -117) {
1376 fprintf(stderr, " true_lb of type = %d; should be %d\n", (int) true_lb, -117);
1382 fprintf(stderr, " true extent of type = %d; should be %d\n", (int) aval, 121);
1385 MPI_Type_free(&inttype);
1386 MPI_Type_free(&eviltype);
1391 int vector_blklen_negstride_negextent_of_int_with_lb_ub_test(void)
1393 int err, errs = 0, val;
1394 MPI_Aint extent, lb, aval, true_lb;
1395 int blocks[3] = { 1, 4, 1 };
1396 MPI_Aint disps[3] = { 6, 0, -3 };
1397 MPI_Datatype types[3] = { MPI_LB, MPI_BYTE, MPI_UB };
1399 MPI_Datatype inttype, eviltype;
1401 /* build same type as in int_with_lb_ub_test() */
1402 err = MPI_Type_struct(3, blocks, disps, types, &inttype);
1403 if (err != MPI_SUCCESS) {
1406 fprintf(stderr, " MPI_Type_struct failed.\n");
1408 MTestPrintError(err);
1409 /* no point in continuing */
1413 err = MPI_Type_vector(3, 4, -5, inttype, &eviltype);
1414 if (err != MPI_SUCCESS) {
1417 fprintf(stderr, " MPI_Type_vector failed.\n");
1419 MTestPrintError(err);
1420 /* no point in continuing */
1424 err = MPI_Type_size(eviltype, &val);
1425 if (err != MPI_SUCCESS) {
1428 fprintf(stderr, " MPI_Type_size failed.\n");
1430 MTestPrintError(err);
1436 fprintf(stderr, " size of type = %d; should be %d\n", val, 48);
1439 err = MPI_Type_extent(eviltype, &aval);
1440 if (err != MPI_SUCCESS) {
1443 fprintf(stderr, " MPI_Type_extent failed.\n");
1445 MTestPrintError(err);
1451 fprintf(stderr, " extent of type = %ld; should be %d\n", (long) aval, 108);
1454 err = MPI_Type_lb(eviltype, &aval);
1455 if (err != MPI_SUCCESS) {
1458 fprintf(stderr, " MPI_Type_lb failed.\n");
1460 MTestPrintError(err);
1466 fprintf(stderr, " lb of type = %ld; should be %d\n", (long) aval, -21);
1469 err = MPI_Type_get_extent(eviltype, &lb, &extent);
1470 if (err != MPI_SUCCESS) {
1473 fprintf(stderr, " MPI_Type_get_extent failed.\n");
1475 MTestPrintError(err);
1481 fprintf(stderr, " lb of type = %ld; should be %d\n", (long) aval, -21);
1484 if (extent != 108) {
1487 fprintf(stderr, " extent of type = %ld; should be %d\n", (long) extent, 108);
1491 err = MPI_Type_ub(eviltype, &aval);
1492 if (err != MPI_SUCCESS) {
1495 fprintf(stderr, " MPI_Type_ub failed.\n");
1497 MTestPrintError(err);
1503 fprintf(stderr, " ub of type = %ld; should be %d\n", (long) aval, 87);
1506 err = MPI_Type_get_true_extent(eviltype, &true_lb, &aval);
1507 if (err != MPI_SUCCESS) {
1510 fprintf(stderr, " MPI_Type_get_true_extent failed.\n");
1512 MTestPrintError(err);
1515 if (true_lb != -27) {
1518 fprintf(stderr, " true_lb of type = %ld; should be %d\n", (long) true_lb, -27);
1524 fprintf(stderr, " true extent of type = %ld; should be %d\n", (long) aval, 121);
1527 MPI_Type_free(&inttype);
1528 MPI_Type_free(&eviltype);