Skip to content

Commit

Permalink
Test all backends
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Apr 1, 2022
1 parent 61550f7 commit e4e00b3
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5506,6 +5506,7 @@ TEST_CASE("no_explicit_flush", "[serial]")
void unfinished_iteration_test(
std::string const &ext, bool filebased, std::string const &config = "{}")
{
std::cout << "\n\nTESTING " << ext << "\n\n" << std::endl;
std::string file = std::string("../samples/unfinished_iteration") +
(filebased ? "_%T." : ".") + ext;
{
Expand All @@ -5525,15 +5526,27 @@ void unfinished_iteration_test(
it10.particles["e"]["mass"][RecordComponent::SCALAR];
}
{
Series read(file, Access::READ_ONLY);
Series read(file, Access::READ_ONLY, config);

std::vector<decltype(Series::iterations)::key_type> iterations;
std::cout << "Going to list iterations in " << file << ":" << std::endl;
for (auto const &iteration : read.readIterations())
for (auto iteration : read.readIterations())
{
// @todo ensure that only the correct iterations are seen.
std::cout << "Seeing iteration " << iteration.iterationIndex
<< std::endl;
iterations.push_back(iteration.iterationIndex);

Parameter<Operation::READ_ATT> readAttribute;
readAttribute.name = "this_does_definitely_not_exist";
read.IOHandler()->enqueue(IOTask(&iteration, readAttribute));
// enqueue a second time to check that the queue is cleared upon
// exception
read.IOHandler()->enqueue(IOTask(&iteration, readAttribute));

REQUIRE_THROWS_AS(
read.IOHandler()->flush({FlushLevel::InternalFlush}),
error::ReadError);
REQUIRE(read.IOHandler()->m_work.empty());
}
REQUIRE(
(iterations ==
Expand All @@ -5544,18 +5557,26 @@ void unfinished_iteration_test(
TEST_CASE("unfinished_iteration_test", "[serial]")
{
#if openPMD_HAVE_ADIOS2
unfinished_iteration_test("bp", false);
unfinished_iteration_test("bp", false, "backend = \"adios2\"");
unfinished_iteration_test(
"bp",
false,
R"(
backend = "adios2"
iteration_encoding = "variable_based"
adios2.schema = 20210209)");
unfinished_iteration_test("bp", true);
unfinished_iteration_test("bp", true, "backend = \"adios2\"");
#endif
#if 1
#if openPMD_HAVE_ADIOS2
unfinished_iteration_test("adios1.bp", false, "backend = \"adios1\"");
unfinished_iteration_test("adios1.bp", true, "backend = \"adios1\"");
#endif
#if openPMD_HAVE_HDF5
unfinished_iteration_test("h5", false);
unfinished_iteration_test("h5", true);
#endif
unfinished_iteration_test("json", false);
unfinished_iteration_test("json", true);
}
#endif

Expand Down

0 comments on commit e4e00b3

Please sign in to comment.