[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b4-190-g5e111d0

Service Account noreply at mpich.org
Sun Aug 23 10:05:47 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  5e111d03852277b3a67607c4df50b0a7df0fc084 (commit)
      from  82730e28c4c8e632cfebc129a7bccf3b928a72bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/5e111d03852277b3a67607c4df50b0a7df0fc084

commit 5e111d03852277b3a67607c4df50b0a7df0fc084
Author: Yanfei Guo <yanf.guo at gmail.com>
Date:   Thu Aug 20 09:49:13 2015 -0500

    Add new tests for keyval double freeing
    
    The existing test uses deprecated MPI_Keyval_* APIs. These new tests
    use the new keyval APIs of Comm, Type, and Win.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/test/mpi/attr/Makefile.am b/test/mpi/attr/Makefile.am
index e1d788b..5a0dded 100644
--- a/test/mpi/attr/Makefile.am
+++ b/test/mpi/attr/Makefile.am
@@ -28,7 +28,10 @@ noinst_PROGRAMS =      \
     fkeyval            \
     fkeyvalcomm        \
     fkeyvaltype        \
-    keyval_double_free
+    keyval_double_free \
+    keyval_double_free_comm \
+    keyval_double_free_type \
+    keyval_double_free_win
 
 EXTRA_DIST = testlist
 
diff --git a/test/mpi/attr/keyval_double_free_comm.c b/test/mpi/attr/keyval_double_free_comm.c
new file mode 100644
index 0000000..f14b09e
--- /dev/null
+++ b/test/mpi/attr/keyval_double_free_comm.c
@@ -0,0 +1,43 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2015 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include <mpi.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "mpitest.h"
+
+/* tests multiple invocations of MPI_Comm_free_keyval on the same keyval */
+
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra);
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra)
+{
+    MPI_Comm_free_keyval(&keyval);
+    return MPI_SUCCESS;
+}
+
+int main(int argc, char **argv)
+{
+    MPI_Comm duped;
+    int keyval = MPI_KEYVAL_INVALID;
+    int keyval_copy = MPI_KEYVAL_INVALID;
+    int errs = 0;
+
+    MTest_Init(&argc, &argv);
+    MPI_Comm_dup(MPI_COMM_SELF, &duped);
+
+    MPI_Comm_create_keyval(MPI_NULL_COPY_FN, delete_fn, &keyval, NULL);
+    keyval_copy = keyval;
+
+    MPI_Comm_set_attr(MPI_COMM_SELF, keyval, NULL);
+    MPI_Comm_set_attr(duped, keyval, NULL);
+
+    MPI_Comm_free(&duped);      /* first MPI_Comm_free_keyval */
+    MPI_Comm_free_keyval(&keyval);   /* second MPI_Comm_free_keyval */
+    MPI_Comm_free_keyval(&keyval_copy);      /* third MPI_Comm_free_keyval */
+    MTest_Finalize(errs);
+    MPI_Finalize();     /* fourth MPI_Comm_free_keyval */
+    return 0;
+}
diff --git a/test/mpi/attr/keyval_double_free_type.c b/test/mpi/attr/keyval_double_free_type.c
new file mode 100644
index 0000000..10ffc2a
--- /dev/null
+++ b/test/mpi/attr/keyval_double_free_type.c
@@ -0,0 +1,41 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2015 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include <mpi.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "mpitest.h"
+
+/* tests multiple invocations of MPI_Type_free_keyval on the same keyval */
+
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra);
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra)
+{
+    MPI_Type_free_keyval(&keyval);
+    return MPI_SUCCESS;
+}
+
+int main(int argc, char **argv)
+{
+    MPI_Datatype type;
+    int keyval = MPI_KEYVAL_INVALID;
+    int keyval_copy = MPI_KEYVAL_INVALID;
+    int errs = 0;
+
+    MTest_Init(&argc, &argv);
+    MPI_Type_dup(MPI_INT, &type);
+
+    MPI_Type_create_keyval(MPI_NULL_COPY_FN, delete_fn, &keyval, NULL);
+    keyval_copy = keyval;
+    MPI_Type_set_attr(type, keyval, NULL);
+
+    MPI_Type_free(&type);      /* first MPI_Type_free_keyval */
+    MPI_Type_free_keyval(&keyval);   /* second MPI_Type_free_keyval */
+    MPI_Type_free_keyval(&keyval_copy);      /* third MPI_Type_free_keyval */
+    MTest_Finalize(errs);
+    MPI_Finalize();
+    return 0;
+}
diff --git a/test/mpi/attr/keyval_double_free_win.c b/test/mpi/attr/keyval_double_free_win.c
new file mode 100644
index 0000000..24d4b38
--- /dev/null
+++ b/test/mpi/attr/keyval_double_free_win.c
@@ -0,0 +1,45 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2015 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include <mpi.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "mpitest.h"
+
+/* tests multiple invocations of MPI_Win_free_keyval on the same keyval */
+
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra);
+int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra)
+{
+    MPI_Win_free_keyval(&keyval);
+    return MPI_SUCCESS;
+}
+
+int main(int argc, char **argv)
+{
+    void *base_ptr = NULL;
+    MPI_Win window;
+    int keyval = MPI_KEYVAL_INVALID;
+    int keyval_copy = MPI_KEYVAL_INVALID;
+    int errs = 0;
+
+    MTest_Init(&argc, &argv);
+    MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &base_ptr);
+    MPI_Win_create(base_ptr, sizeof(int), 1, MPI_INFO_NULL, MPI_COMM_WORLD, &window);
+
+    MPI_Win_create_keyval(MPI_NULL_COPY_FN, delete_fn, &keyval, NULL);
+    keyval_copy = keyval;
+    MPI_Win_set_attr(window, keyval, NULL);
+
+    MPI_Win_free(&window);      /* first MPI_Win_free_keyval */
+    MPI_Free_mem(base_ptr);
+    MPI_Win_free_keyval(&keyval);   /* second MPI_Win_free_keyval */
+    MPI_Win_free_keyval(&keyval_copy);      /* third MPI_Win_free_keyval */
+    MTest_Finalize(errs);
+    MPI_Finalize();
+    return 0;
+}
+
diff --git a/test/mpi/attr/testlist b/test/mpi/attr/testlist
index 4db94df..07868d1 100644
--- a/test/mpi/attr/testlist
+++ b/test/mpi/attr/testlist
@@ -18,3 +18,6 @@ fkeyval 1
 fkeyvalcomm 1
 fkeyvaltype 1
 keyval_double_free 1
+keyval_double_free_comm 1
+keyval_double_free_type 1
+keyval_double_free_win 1

-----------------------------------------------------------------------

Summary of changes:
 test/mpi/attr/Makefile.am                          |    5 ++-
 ...val_double_free.c => keyval_double_free_comm.c} |   20 ++++----
 test/mpi/attr/keyval_double_free_type.c            |   41 ++++++++++++++++++
 test/mpi/attr/keyval_double_free_win.c             |   45 ++++++++++++++++++++
 test/mpi/attr/testlist                             |    3 +
 5 files changed, 103 insertions(+), 11 deletions(-)
 copy test/mpi/attr/{keyval_double_free.c => keyval_double_free_comm.c} (52%)
 create mode 100644 test/mpi/attr/keyval_double_free_type.c
 create mode 100644 test/mpi/attr/keyval_double_free_win.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list