From bcbc9791f6b31a4e22d218dcf34079d2f3673fc5 Mon Sep 17 00:00:00 2001 From: guj <jgu@lbl.gov> Date: Fri, 5 May 2017 16:11:33 -0700 Subject: [PATCH] H5Tequal should be called instead of = --- examples/hello/hdf5Writer/helloHDF5Writer.cpp | 3 - .../adios2/engine/hdf5/TestHDF5WriteRead.cpp | 62 ++++++++++--------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/examples/hello/hdf5Writer/helloHDF5Writer.cpp b/examples/hello/hdf5Writer/helloHDF5Writer.cpp index 1426b07b7..38fc852b8 100644 --- a/examples/hello/hdf5Writer/helloHDF5Writer.cpp +++ b/examples/hello/hdf5Writer/helloHDF5Writer.cpp @@ -9,9 +9,6 @@ #include <vector> #include <mpi.h> - -#define ADIOS_HAVE_PHDF5 // so hdf5 related items are loaded in ADIOS_CPP.h -//#include "ADIOS_CPP.h" #include "adios2.h" int main(int argc, char *argv[]) diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp index f0e4149c9..3f2b6a69f 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp @@ -131,6 +131,7 @@ bool HDF5NativeReader::Advance() if (m_GroupId >= 0) { H5Gclose(m_GroupId); + m_GroupId = -1; } if (m_CurrentTimeStep + 1 >= m_TotalTimeSteps) @@ -279,61 +280,62 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8) hid_t h5Type; hdf5Reader.GetVarInfo("i8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_CHAR); + + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_CHAR), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("i8", I8.data()); hdf5Reader.GetVarInfo("i16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_SHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_SHORT), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("i16", I16.data()); hdf5Reader.GetVarInfo("i32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_INT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_INT), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("i32", I32.data()); hdf5Reader.GetVarInfo("i64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_LONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("i64", I64.data()); hdf5Reader.GetVarInfo("u8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UCHAR); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UCHAR), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("u8", U8.data()); hdf5Reader.GetVarInfo("u16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_USHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_USHORT), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("u16", U16.data()); hdf5Reader.GetVarInfo("u32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UINT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UINT), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("u32", U32.data()); hdf5Reader.GetVarInfo("u64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_ULONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("u64", U64.data()); hdf5Reader.GetVarInfo("r32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_FLOAT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_FLOAT), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("r32", R32.data()); hdf5Reader.GetVarInfo("r64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_DOUBLE); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_DOUBLE), 1); ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], 8); hdf5Reader.ReadVar("r64", R64.data()); @@ -483,70 +485,70 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4) hid_t h5Type; hdf5Reader.GetVarInfo("i8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_CHAR); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_CHAR), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("i8", I8.data()); hdf5Reader.GetVarInfo("i16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_SHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_SHORT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("i16", I16.data()); hdf5Reader.GetVarInfo("i32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_INT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_INT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("i32", I32.data()); hdf5Reader.GetVarInfo("i64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_LONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("i64", I64.data()); hdf5Reader.GetVarInfo("u8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UCHAR); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UCHAR), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("u8", U8.data()); hdf5Reader.GetVarInfo("u16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_USHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_USHORT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("u16", U16.data()); hdf5Reader.GetVarInfo("u32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UINT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UINT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("u32", U32.data()); hdf5Reader.GetVarInfo("u64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_ULONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("u64", U64.data()); hdf5Reader.GetVarInfo("r32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_FLOAT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_FLOAT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); hdf5Reader.ReadVar("r32", R32.data()); hdf5Reader.GetVarInfo("r64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_DOUBLE); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_DOUBLE), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], 4); @@ -697,70 +699,70 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2) hid_t h5Type; hdf5Reader.GetVarInfo("i8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_CHAR); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_CHAR), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("i8", I8.data()); hdf5Reader.GetVarInfo("i16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_SHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_SHORT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("i16", I16.data()); hdf5Reader.GetVarInfo("i32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_INT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_INT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("i32", I32.data()); hdf5Reader.GetVarInfo("i64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_LONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("i64", I64.data()); hdf5Reader.GetVarInfo("u8", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UCHAR); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UCHAR), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("u8", U8.data()); hdf5Reader.GetVarInfo("u16", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_USHORT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_USHORT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("u16", U16.data()); hdf5Reader.GetVarInfo("u32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_UINT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_UINT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("u32", U32.data()); hdf5Reader.GetVarInfo("u64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_ULONG); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("u64", U64.data()); hdf5Reader.GetVarInfo("r32", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_FLOAT); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_FLOAT), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); hdf5Reader.ReadVar("r32", R32.data()); hdf5Reader.GetVarInfo("r64", gDims, h5Type); - ASSERT_EQ(h5Type, H5T_NATIVE_DOUBLE); + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_DOUBLE), 1); ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], 2); -- GitLab