- if (comm != MPI_COMM_WORLD && comm != MPI_COMM_SELF) {
- MPI_Comm_free( &comm );
- /* Check that the original attribute was freed */
- if (attrval != 0) {
- errs++;
- printf( "Attribute not decremented when comm %s freed\n",
- MTestGetIntracommName() );
- }
- }
- else {
- /* Explicitly delete the attributes from world and self */
- MPI_Attr_delete( comm, saveKeyval );
- }
- /* Free those other keyvals */
- for (i=0; i<32; i++) {
- MPI_Keyval_free( &key[i] );
- }
+ MPI_Comm_dup(comm, &dupcomm);
+ /* Check that the attribute was copied */
+ if (attrval != 2) {
+ errs++;
+ printf("Attribute not incremented when comm dup'ed (%s)\n", MTestGetIntracommName());
+ }
+ MPI_Comm_free(&dupcomm);
+ if (attrval != 1) {
+ errs++;
+ printf("Attribute not decremented when dupcomm %s freed\n", MTestGetIntracommName());
+ }
+ /* Check that the attribute was freed in the dupcomm */
+
+ if (comm != MPI_COMM_WORLD && comm != MPI_COMM_SELF) {
+ MPI_Comm_free(&comm);
+ /* Check that the original attribute was freed */
+ if (attrval != 0) {
+ errs++;
+ printf("Attribute not decremented when comm %s freed\n", MTestGetIntracommName());
+ }
+ }
+ else {
+ /* Explicitly delete the attributes from world and self */
+ MPI_Attr_delete(comm, saveKeyval);
+ }
+ /* Free those other keyvals */
+ for (i = 0; i < 32; i++) {
+ MPI_Keyval_free(&key[i]);
+ }