You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by em...@apache.org on 2019/06/27 07:36:25 UTC

[arrow] branch master updated: ARROW-5194: [C++][Plasma] TEST(PlasmaSerialization, GetReply) is failing

This is an automated email from the ASF dual-hosted git repository.

emkornfield pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new c7160e9  ARROW-5194: [C++][Plasma] TEST(PlasmaSerialization, GetReply) is failing
c7160e9 is described below

commit c7160e9dfe39b81456eabc02d5495e85f3b05fa0
Author: Guillaume Horel <gu...@gmail.com>
AuthorDate: Thu Jun 27 00:35:15 2019 -0700

    ARROW-5194: [C++][Plasma] TEST(PlasmaSerialization, GetReply) is failing
    
    Author: Guillaume Horel <gu...@gmail.com>
    
    Closes #4203 from thrasibule/fix_test and squashes the following commits:
    
    2d91efd71 <Guillaume Horel> implement operator== for PlasmaObject
    b651f3ebf <Guillaume Horel> compare struct fields, not memory layout
---
 cpp/src/plasma/plasma.h                    | 10 ++++++++++
 cpp/src/plasma/test/serialization_tests.cc | 13 +++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/cpp/src/plasma/plasma.h b/cpp/src/plasma/plasma.h
index e23969d..0948e6d 100644
--- a/cpp/src/plasma/plasma.h
+++ b/cpp/src/plasma/plasma.h
@@ -91,6 +91,16 @@ struct PlasmaObject {
   int64_t metadata_size;
   /// Device number object is on.
   int device_num;
+
+  bool operator==(const PlasmaObject& other) const {
+    return (
+#ifdef PLASMA_CUDA
+        (ipc_handle == other.ipc_handle) &&
+#endif
+        (store_fd == other.store_fd) && (data_offset == other.data_offset) &&
+        (metadata_offset == other.metadata_offset) && (data_size == other.data_size) &&
+        (metadata_size == other.metadata_size) && (device_num == other.device_num));
+  }
 };
 
 enum class ObjectStatus : int {
diff --git a/cpp/src/plasma/test/serialization_tests.cc b/cpp/src/plasma/test/serialization_tests.cc
index 96967da..7e2bc88 100644
--- a/cpp/src/plasma/test/serialization_tests.cc
+++ b/cpp/src/plasma/test/serialization_tests.cc
@@ -202,12 +202,13 @@ TEST_F(TestPlasmaSerialization, GetReply) {
 
   ASSERT_EQ(object_ids[0], object_ids_return[0]);
   ASSERT_EQ(object_ids[1], object_ids_return[1]);
-  ASSERT_EQ(memcmp(&plasma_objects[object_ids[0]], &plasma_objects_return[0],
-                   sizeof(PlasmaObject)),
-            0);
-  ASSERT_EQ(memcmp(&plasma_objects[object_ids[1]], &plasma_objects_return[1],
-                   sizeof(PlasmaObject)),
-            0);
+
+  PlasmaObject po, po2;
+  for (int i = 0; i < 2; ++i) {
+    po = plasma_objects[object_ids[i]];
+    po2 = plasma_objects_return[i];
+    ASSERT_EQ(po, po2);
+  }
   ASSERT_TRUE(store_fds == store_fds_return);
   ASSERT_TRUE(mmap_sizes == mmap_sizes_return);
   close(fd);