From 33a8ba0f9c6fcd44f7f8cfbea4391bed763489ab Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Wed, 26 Apr 2017 09:27:38 -0400
Subject: [PATCH] Add read validation with ADIOS1 for BPFileWriter engine

---
 testing/adios2/engine/bp/CMakeLists.txt      |  12 +-
 testing/adios2/engine/bp/TestBPWriteRead.cpp | 403 +++++++++++++++++--
 2 files changed, 377 insertions(+), 38 deletions(-)

diff --git a/testing/adios2/engine/bp/CMakeLists.txt b/testing/adios2/engine/bp/CMakeLists.txt
index f9a211d60..87eb336a2 100644
--- a/testing/adios2/engine/bp/CMakeLists.txt
+++ b/testing/adios2/engine/bp/CMakeLists.txt
@@ -3,6 +3,12 @@
 # accompanying file Copyright.txt for details.
 #------------------------------------------------------------------------------#
 
-add_executable(TestBPWriteRead TestBPWriteRead.cpp)
-target_link_libraries(TestBPWriteRead adios2 gtest)
-add_test(NAME adios2::engine::bp::write_read COMMAND TestBPWriteRead)
+# MPI versions of the test are not properly implemented at the moment
+if(NOT ADIOS_USE_MPI)
+  find_package(ADIOS1 COMPONENTS sequential REQUIRED)
+
+  add_executable(TestBPWriteRead TestBPWriteRead.cpp)
+  target_link_libraries(TestBPWriteRead adios2 gtest adios1::adios)
+
+  add_test(NAME adios2::engine::bp::write_read COMMAND TestBPWriteRead)
+endif()
diff --git a/testing/adios2/engine/bp/TestBPWriteRead.cpp b/testing/adios2/engine/bp/TestBPWriteRead.cpp
index 6f2596bb5..0f9035220 100644
--- a/testing/adios2/engine/bp/TestBPWriteRead.cpp
+++ b/testing/adios2/engine/bp/TestBPWriteRead.cpp
@@ -3,11 +3,13 @@
  * accompanying file Copyright.txt for details.
  */
 #include <cstdint>
+#include <cstring>
 
 #include <iostream>
 #include <stdexcept>
 
 #include <adios2.h>
+#include <adios_read.h>
 
 #include <gtest/gtest.h>
 
@@ -26,6 +28,9 @@ public:
 //******************************************************************************
 TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
 {
+    std::string fname = "ADIOS2BPWriteADIOS1Read1D8.bp";
+
+    // Write test data using ADIOS2
     {
         adios::ADIOS adios(adios::Verbose::WARN, true);
 
@@ -52,7 +57,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
         method.SetEngine("BPFileWriter");
         method.AddTransport("File");
 
-        auto engine = adios.Open("ADIOS2BPWriteADIOS1Read1D8.bp", "w", method);
+        auto engine = adios.Open(fname, "w", method);
         ASSERT_NE(engine, nullptr);
 
         for (size_t step = 0; step < 3; ++step)
@@ -70,16 +75,16 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
             auto &var_r64 = adios.GetVariable<double>("r64");
 
             // Write each one
-            engine->Write(var_i8, m_TestData.I8.cbegin() + step);
-            engine->Write(var_i16, m_TestData.I16.cbegin() + step);
-            engine->Write(var_i32, m_TestData.I32.cbegin() + step);
-            engine->Write(var_i64, m_TestData.I64.cbegin() + step);
-            engine->Write(var_u8, m_TestData.U8.cbegin() + step);
-            engine->Write(var_u16, m_TestData.U16.cbegin() + step);
-            engine->Write(var_u32, m_TestData.U32.cbegin() + step);
-            engine->Write(var_u64, m_TestData.U64.cbegin() + step);
-            engine->Write(var_r32, m_TestData.R32.cbegin() + step);
-            engine->Write(var_r64, m_TestData.R64.cbegin() + step);
+            engine->Write(var_i8, m_TestData.I8.data() + step);
+            engine->Write(var_i16, m_TestData.I16.data() + step);
+            engine->Write(var_i32, m_TestData.I32.data() + step);
+            engine->Write(var_i64, m_TestData.I64.data() + step);
+            engine->Write(var_u8, m_TestData.U8.data() + step);
+            engine->Write(var_u16, m_TestData.U16.data() + step);
+            engine->Write(var_u32, m_TestData.U32.data() + step);
+            engine->Write(var_u64, m_TestData.U64.data() + step);
+            engine->Write(var_r32, m_TestData.R32.data() + step);
+            engine->Write(var_r64, m_TestData.R64.data() + step);
 
             // Advance to the next time step
             engine->Advance();
@@ -88,6 +93,114 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
         // Close the file
         engine->Close();
     }
+
+    // Read test data using ADIOS1
+#ifdef ADIOS2_HAVE_MPI
+    // Read everything from rank 0
+    int rank;
+    MPI_Comm_rank();
+    if(rank == 0)
+#endif
+    {
+        adios_read_init_method(ADIOS_READ_METHOD_BP, MPI_COMM_WORLD,
+                               "verbose=3");
+
+        // Open the file for reading
+        ADIOS_FILE *f =
+            adios_read_open_file((fname + "/" + fname + ".0").c_str(),
+                                 ADIOS_READ_METHOD_BP, MPI_COMM_WORLD);
+        ASSERT_NE(f, nullptr);
+
+        // Check the variables exist
+        ADIOS_VARINFO *var_i8 = adios_inq_var(f, "i8");
+        ASSERT_NE(var_i8, nullptr);
+        ADIOS_VARINFO *var_i16 = adios_inq_var(f, "i16");
+        ASSERT_NE(var_i16, nullptr);
+        ADIOS_VARINFO *var_i32 = adios_inq_var(f, "i32");
+        ASSERT_NE(var_i32, nullptr);
+        ADIOS_VARINFO *var_i64 = adios_inq_var(f, "i64");
+        ASSERT_NE(var_i64, nullptr);
+        ADIOS_VARINFO *var_u8 = adios_inq_var(f, "u8");
+        ASSERT_NE(var_u8, nullptr);
+        ADIOS_VARINFO *var_u16 = adios_inq_var(f, "u16");
+        ASSERT_NE(var_u16, nullptr);
+        ADIOS_VARINFO *var_u32 = adios_inq_var(f, "u32");
+        ASSERT_NE(var_u32, nullptr);
+        ADIOS_VARINFO *var_u64 = adios_inq_var(f, "u64");
+        ASSERT_NE(var_u64, nullptr);
+        ADIOS_VARINFO *var_r32 = adios_inq_var(f, "r32");
+        ASSERT_NE(var_r32, nullptr);
+        ADIOS_VARINFO *var_r64 = adios_inq_var(f, "r64");
+        ASSERT_NE(var_r64, nullptr);
+
+        std::array<char, 8> I8;
+        std::array<int16_t, 8> I16;
+        std::array<int32_t, 8> I32;
+        std::array<int64_t, 8> I64;
+        std::array<unsigned char, 8> U8;
+        std::array<uint16_t, 8> U16;
+        std::array<uint32_t, 8> U32;
+        std::array<uint64_t, 8> U64;
+        std::array<float, 8> R32;
+        std::array<double, 8> R64;
+
+        uint64_t start[1] = {0};
+        uint64_t count[1] = {8};
+        ADIOS_SELECTION *sel = adios_selection_boundingbox(1, start, count);
+
+        // Read stuff
+        for (size_t t = 0; t < 3; ++t)
+        {
+            // Read the current step
+            adios_schedule_read_byid(f, sel, var_i8->varid, t, 1, I8.data());
+            adios_schedule_read_byid(f, sel, var_i16->varid, t, 1, I16.data());
+            adios_schedule_read_byid(f, sel, var_i32->varid, t, 1, I32.data());
+            adios_schedule_read_byid(f, sel, var_i64->varid, t, 1, I64.data());
+            adios_schedule_read_byid(f, sel, var_u8->varid, t, 1, U8.data());
+            adios_schedule_read_byid(f, sel, var_u16->varid, t, 1, U16.data());
+            adios_schedule_read_byid(f, sel, var_u32->varid, t, 1, U32.data());
+            adios_schedule_read_byid(f, sel, var_u64->varid, t, 1, U64.data());
+            adios_schedule_read_byid(f, sel, var_r32->varid, t, 1, R32.data());
+            adios_schedule_read_byid(f, sel, var_r64->varid, t, 1, R64.data());
+            adios_perform_reads(f, 1);
+
+            // Check if it's correct
+            for (size_t i = 0; i < 8; ++i)
+            {
+                std::stringstream ss;
+                ss << "t=" << t << " i=" << i;
+                std::string msg = ss.str();
+
+                EXPECT_EQ(I8[i], m_TestData.I8[i + t]) << msg;
+                EXPECT_EQ(I16[i], m_TestData.I16[i + t]) << msg;
+                EXPECT_EQ(I32[i], m_TestData.I32[i + t]) << msg;
+                EXPECT_EQ(I64[i], m_TestData.I64[i + t]) << msg;
+                EXPECT_EQ(U8[i], m_TestData.U8[i + t]) << msg;
+                EXPECT_EQ(U16[i], m_TestData.U16[i + t]) << msg;
+                EXPECT_EQ(U32[i], m_TestData.U32[i + t]) << msg;
+                EXPECT_EQ(U64[i], m_TestData.U64[i + t]) << msg;
+                EXPECT_EQ(R32[i], m_TestData.R32[i + t]) << msg;
+                EXPECT_EQ(R64[i], m_TestData.R64[i + t]) << msg;
+            }
+        }
+
+        adios_selection_delete(sel);
+
+        // Cleanup variable structures
+        adios_free_varinfo(var_i8);
+        adios_free_varinfo(var_i16);
+        adios_free_varinfo(var_i32);
+        adios_free_varinfo(var_i64);
+        adios_free_varinfo(var_u8);
+        adios_free_varinfo(var_u16);
+        adios_free_varinfo(var_u32);
+        adios_free_varinfo(var_u64);
+        adios_free_varinfo(var_r32);
+        adios_free_varinfo(var_r64);
+
+        // Cleanup file
+        adios_read_close(f);
+    }
 }
 
 //******************************************************************************
@@ -95,6 +208,9 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8)
 //******************************************************************************
 TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D2x4)
 {
+    std::string fname = "ADIOS2BPWriteADIOS1Read2D2x4Test.bp";
+
+    // Write test data using ADIOS2
     {
         adios::ADIOS adios(adios::Verbose::WARN, true);
 
@@ -125,8 +241,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D2x4)
         method.SetEngine("BPFileWriter");
         method.AddTransport("File");
 
-        auto engine =
-            adios.Open("ADIOS2BPWriteADIOS1Read2D2x4Test.bp", "w", method);
+        auto engine = adios.Open(fname, "w", method);
         ASSERT_NE(engine, nullptr);
 
         for (size_t step = 0; step < 3; ++step)
@@ -144,16 +259,16 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D2x4)
             auto &var_r64 = adios.GetVariable<double>("r64");
 
             // Write each one
-            engine->Write(var_i8, m_TestData.I8.cbegin() + step);
-            engine->Write(var_i16, m_TestData.I16.cbegin() + step);
-            engine->Write(var_i32, m_TestData.I32.cbegin() + step);
-            engine->Write(var_i64, m_TestData.I64.cbegin() + step);
-            engine->Write(var_u8, m_TestData.U8.cbegin() + step);
-            engine->Write(var_u16, m_TestData.U16.cbegin() + step);
-            engine->Write(var_u32, m_TestData.U32.cbegin() + step);
-            engine->Write(var_u64, m_TestData.U64.cbegin() + step);
-            engine->Write(var_r32, m_TestData.R32.cbegin() + step);
-            engine->Write(var_r64, m_TestData.R64.cbegin() + step);
+            engine->Write(var_i8, m_TestData.I8.data() + step);
+            engine->Write(var_i16, m_TestData.I16.data() + step);
+            engine->Write(var_i32, m_TestData.I32.data() + step);
+            engine->Write(var_i64, m_TestData.I64.data() + step);
+            engine->Write(var_u8, m_TestData.U8.data() + step);
+            engine->Write(var_u16, m_TestData.U16.data() + step);
+            engine->Write(var_u32, m_TestData.U32.data() + step);
+            engine->Write(var_u64, m_TestData.U64.data() + step);
+            engine->Write(var_r32, m_TestData.R32.data() + step);
+            engine->Write(var_r64, m_TestData.R64.data() + step);
 
             // Advance to the next time step
             engine->Advance();
@@ -162,6 +277,114 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D2x4)
         // Close the file
         engine->Close();
     }
+
+    // Read test data using ADIOS1
+#ifdef ADIOS2_HAVE_MPI
+    // Read everything from rank 0
+    int rank;
+    MPI_Comm_rank();
+    if(rank == 0)
+#endif
+    {
+        adios_read_init_method(ADIOS_READ_METHOD_BP, MPI_COMM_WORLD,
+                               "verbose=3");
+
+        // Open the file for reading
+        ADIOS_FILE *f =
+            adios_read_open_file((fname + "/" + fname + ".0").c_str(),
+                                 ADIOS_READ_METHOD_BP, MPI_COMM_WORLD);
+        ASSERT_NE(f, nullptr);
+
+        // Check the variables exist
+        ADIOS_VARINFO *var_i8 = adios_inq_var(f, "i8");
+        ASSERT_NE(var_i8, nullptr);
+        ADIOS_VARINFO *var_i16 = adios_inq_var(f, "i16");
+        ASSERT_NE(var_i16, nullptr);
+        ADIOS_VARINFO *var_i32 = adios_inq_var(f, "i32");
+        ASSERT_NE(var_i32, nullptr);
+        ADIOS_VARINFO *var_i64 = adios_inq_var(f, "i64");
+        ASSERT_NE(var_i64, nullptr);
+        ADIOS_VARINFO *var_u8 = adios_inq_var(f, "u8");
+        ASSERT_NE(var_u8, nullptr);
+        ADIOS_VARINFO *var_u16 = adios_inq_var(f, "u16");
+        ASSERT_NE(var_u16, nullptr);
+        ADIOS_VARINFO *var_u32 = adios_inq_var(f, "u32");
+        ASSERT_NE(var_u32, nullptr);
+        ADIOS_VARINFO *var_u64 = adios_inq_var(f, "u64");
+        ASSERT_NE(var_u64, nullptr);
+        ADIOS_VARINFO *var_r32 = adios_inq_var(f, "r32");
+        ASSERT_NE(var_r32, nullptr);
+        ADIOS_VARINFO *var_r64 = adios_inq_var(f, "r64");
+        ASSERT_NE(var_r64, nullptr);
+
+        std::array<char, 8> I8;
+        std::array<int16_t, 8> I16;
+        std::array<int32_t, 8> I32;
+        std::array<int64_t, 8> I64;
+        std::array<unsigned char, 8> U8;
+        std::array<uint16_t, 8> U16;
+        std::array<uint32_t, 8> U32;
+        std::array<uint64_t, 8> U64;
+        std::array<float, 8> R32;
+        std::array<double, 8> R64;
+
+        uint64_t start[1] = {0};
+        uint64_t count[1] = {8};
+        ADIOS_SELECTION *sel = adios_selection_boundingbox(1, start, count);
+
+        // Read stuff
+        for (size_t t = 0; t < 3; ++t)
+        {
+            // Read the current step
+            adios_schedule_read_byid(f, sel, var_i8->varid, t, 1, I8.data());
+            adios_schedule_read_byid(f, sel, var_i16->varid, t, 1, I16.data());
+            adios_schedule_read_byid(f, sel, var_i32->varid, t, 1, I32.data());
+            adios_schedule_read_byid(f, sel, var_i64->varid, t, 1, I64.data());
+            adios_schedule_read_byid(f, sel, var_u8->varid, t, 1, U8.data());
+            adios_schedule_read_byid(f, sel, var_u16->varid, t, 1, U16.data());
+            adios_schedule_read_byid(f, sel, var_u32->varid, t, 1, U32.data());
+            adios_schedule_read_byid(f, sel, var_u64->varid, t, 1, U64.data());
+            adios_schedule_read_byid(f, sel, var_r32->varid, t, 1, R32.data());
+            adios_schedule_read_byid(f, sel, var_r64->varid, t, 1, R64.data());
+            adios_perform_reads(f, 1);
+
+            // Check if it's correct
+            for (size_t i = 0; i < 8; ++i)
+            {
+                std::stringstream ss;
+                ss << "t=" << t << " i=" << i;
+                std::string msg = ss.str();
+
+                EXPECT_EQ(I8[i], m_TestData.I8[i + t]) << msg;
+                EXPECT_EQ(I16[i], m_TestData.I16[i + t]) << msg;
+                EXPECT_EQ(I32[i], m_TestData.I32[i + t]) << msg;
+                EXPECT_EQ(I64[i], m_TestData.I64[i + t]) << msg;
+                EXPECT_EQ(U8[i], m_TestData.U8[i + t]) << msg;
+                EXPECT_EQ(U16[i], m_TestData.U16[i + t]) << msg;
+                EXPECT_EQ(U32[i], m_TestData.U32[i + t]) << msg;
+                EXPECT_EQ(U64[i], m_TestData.U64[i + t]) << msg;
+                EXPECT_EQ(R32[i], m_TestData.R32[i + t]) << msg;
+                EXPECT_EQ(R64[i], m_TestData.R64[i + t]) << msg;
+            }
+        }
+
+        adios_selection_delete(sel);
+
+        // Cleanup variable structures
+        adios_free_varinfo(var_i8);
+        adios_free_varinfo(var_i16);
+        adios_free_varinfo(var_i32);
+        adios_free_varinfo(var_i64);
+        adios_free_varinfo(var_u8);
+        adios_free_varinfo(var_u16);
+        adios_free_varinfo(var_u32);
+        adios_free_varinfo(var_u64);
+        adios_free_varinfo(var_r32);
+        adios_free_varinfo(var_r64);
+
+        // Cleanup file
+        adios_read_close(f);
+    }
 }
 
 //******************************************************************************
@@ -169,6 +392,9 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D2x4)
 //******************************************************************************
 TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D4x2)
 {
+    std::string fname = "ADIOS2BPWriteADIOS1Read2D4x2Test.bp";
+
+    // Write test data using ADIOS2
     {
         adios::ADIOS adios(adios::Verbose::WARN, true);
 
@@ -199,8 +425,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D4x2)
         method.SetEngine("BPFileWriter");
         method.AddTransport("File");
 
-        auto engine =
-            adios.Open("ADIOS2BPWriteADIOS1Read2D4x2Test.bp", "w", method);
+        auto engine = adios.Open(fname, "w", method);
         ASSERT_NE(engine, nullptr);
 
         for (size_t step = 0; step < 3; ++step)
@@ -218,16 +443,16 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D4x2)
             auto &var_r64 = adios.GetVariable<double>("r64");
 
             // Write each one
-            engine->Write(var_i8, m_TestData.I8.cbegin() + step);
-            engine->Write(var_i16, m_TestData.I16.cbegin() + step);
-            engine->Write(var_i32, m_TestData.I32.cbegin() + step);
-            engine->Write(var_i64, m_TestData.I64.cbegin() + step);
-            engine->Write(var_u8, m_TestData.U8.cbegin() + step);
-            engine->Write(var_u16, m_TestData.U16.cbegin() + step);
-            engine->Write(var_u32, m_TestData.U32.cbegin() + step);
-            engine->Write(var_u64, m_TestData.U64.cbegin() + step);
-            engine->Write(var_r32, m_TestData.R32.cbegin() + step);
-            engine->Write(var_r64, m_TestData.R64.cbegin() + step);
+            engine->Write(var_i8, m_TestData.I8.data() + step);
+            engine->Write(var_i16, m_TestData.I16.data() + step);
+            engine->Write(var_i32, m_TestData.I32.data() + step);
+            engine->Write(var_i64, m_TestData.I64.data() + step);
+            engine->Write(var_u8, m_TestData.U8.data() + step);
+            engine->Write(var_u16, m_TestData.U16.data() + step);
+            engine->Write(var_u32, m_TestData.U32.data() + step);
+            engine->Write(var_u64, m_TestData.U64.data() + step);
+            engine->Write(var_r32, m_TestData.R32.data() + step);
+            engine->Write(var_r64, m_TestData.R64.data() + step);
 
             // Advance to the next time step
             engine->Advance();
@@ -236,6 +461,114 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read2D4x2)
         // Close the file
         engine->Close();
     }
+
+    // Read test data using ADIOS1
+#ifdef ADIOS2_HAVE_MPI
+    // Read everything from rank 0
+    int rank;
+    MPI_Comm_rank();
+    if(rank == 0)
+#endif
+    {
+        adios_read_init_method(ADIOS_READ_METHOD_BP, MPI_COMM_WORLD,
+                               "verbose=3");
+
+        // Open the file for reading
+        ADIOS_FILE *f =
+            adios_read_open_file((fname + "/" + fname + ".0").c_str(),
+                                 ADIOS_READ_METHOD_BP, MPI_COMM_WORLD);
+        ASSERT_NE(f, nullptr);
+
+        // Check the variables exist
+        ADIOS_VARINFO *var_i8 = adios_inq_var(f, "i8");
+        ASSERT_NE(var_i8, nullptr);
+        ADIOS_VARINFO *var_i16 = adios_inq_var(f, "i16");
+        ASSERT_NE(var_i16, nullptr);
+        ADIOS_VARINFO *var_i32 = adios_inq_var(f, "i32");
+        ASSERT_NE(var_i32, nullptr);
+        ADIOS_VARINFO *var_i64 = adios_inq_var(f, "i64");
+        ASSERT_NE(var_i64, nullptr);
+        ADIOS_VARINFO *var_u8 = adios_inq_var(f, "u8");
+        ASSERT_NE(var_u8, nullptr);
+        ADIOS_VARINFO *var_u16 = adios_inq_var(f, "u16");
+        ASSERT_NE(var_u16, nullptr);
+        ADIOS_VARINFO *var_u32 = adios_inq_var(f, "u32");
+        ASSERT_NE(var_u32, nullptr);
+        ADIOS_VARINFO *var_u64 = adios_inq_var(f, "u64");
+        ASSERT_NE(var_u64, nullptr);
+        ADIOS_VARINFO *var_r32 = adios_inq_var(f, "r32");
+        ASSERT_NE(var_r32, nullptr);
+        ADIOS_VARINFO *var_r64 = adios_inq_var(f, "r64");
+        ASSERT_NE(var_r64, nullptr);
+
+        std::array<char, 8> I8;
+        std::array<int16_t, 8> I16;
+        std::array<int32_t, 8> I32;
+        std::array<int64_t, 8> I64;
+        std::array<unsigned char, 8> U8;
+        std::array<uint16_t, 8> U16;
+        std::array<uint32_t, 8> U32;
+        std::array<uint64_t, 8> U64;
+        std::array<float, 8> R32;
+        std::array<double, 8> R64;
+
+        uint64_t start[1] = {0};
+        uint64_t count[1] = {8};
+        ADIOS_SELECTION *sel = adios_selection_boundingbox(1, start, count);
+
+        // Read stuff
+        for (size_t t = 0; t < 3; ++t)
+        {
+            // Read the current step
+            adios_schedule_read_byid(f, sel, var_i8->varid, t, 1, I8.data());
+            adios_schedule_read_byid(f, sel, var_i16->varid, t, 1, I16.data());
+            adios_schedule_read_byid(f, sel, var_i32->varid, t, 1, I32.data());
+            adios_schedule_read_byid(f, sel, var_i64->varid, t, 1, I64.data());
+            adios_schedule_read_byid(f, sel, var_u8->varid, t, 1, U8.data());
+            adios_schedule_read_byid(f, sel, var_u16->varid, t, 1, U16.data());
+            adios_schedule_read_byid(f, sel, var_u32->varid, t, 1, U32.data());
+            adios_schedule_read_byid(f, sel, var_u64->varid, t, 1, U64.data());
+            adios_schedule_read_byid(f, sel, var_r32->varid, t, 1, R32.data());
+            adios_schedule_read_byid(f, sel, var_r64->varid, t, 1, R64.data());
+            adios_perform_reads(f, 1);
+
+            // Check if it's correct
+            for (size_t i = 0; i < 8; ++i)
+            {
+                std::stringstream ss;
+                ss << "t=" << t << " i=" << i;
+                std::string msg = ss.str();
+
+                EXPECT_EQ(I8[i], m_TestData.I8[i + t]) << msg;
+                EXPECT_EQ(I16[i], m_TestData.I16[i + t]) << msg;
+                EXPECT_EQ(I32[i], m_TestData.I32[i + t]) << msg;
+                EXPECT_EQ(I64[i], m_TestData.I64[i + t]) << msg;
+                EXPECT_EQ(U8[i], m_TestData.U8[i + t]) << msg;
+                EXPECT_EQ(U16[i], m_TestData.U16[i + t]) << msg;
+                EXPECT_EQ(U32[i], m_TestData.U32[i + t]) << msg;
+                EXPECT_EQ(U64[i], m_TestData.U64[i + t]) << msg;
+                EXPECT_EQ(R32[i], m_TestData.R32[i + t]) << msg;
+                EXPECT_EQ(R64[i], m_TestData.R64[i + t]) << msg;
+            }
+        }
+
+        adios_selection_delete(sel);
+
+        // Cleanup variable structures
+        adios_free_varinfo(var_i8);
+        adios_free_varinfo(var_i16);
+        adios_free_varinfo(var_i32);
+        adios_free_varinfo(var_i64);
+        adios_free_varinfo(var_u8);
+        adios_free_varinfo(var_u16);
+        adios_free_varinfo(var_u32);
+        adios_free_varinfo(var_u64);
+        adios_free_varinfo(var_r32);
+        adios_free_varinfo(var_r64);
+
+        // Cleanup file
+        adios_read_close(f);
+    }
 }
 
 //******************************************************************************
-- 
GitLab