@@ -5506,6 +5506,7 @@ TEST_CASE("no_explicit_flush", "[serial]")
55065506void unfinished_iteration_test (
55075507 std::string const &ext, bool filebased, std::string const &config = " {}" )
55085508{
5509+ std::cout << " \n\n TESTING " << ext << " \n\n " << std::endl;
55095510 std::string file = std::string (" ../samples/unfinished_iteration" ) +
55105511 (filebased ? " _%T." : " ." ) + ext;
55115512 {
@@ -5525,15 +5526,27 @@ void unfinished_iteration_test(
55255526 it10.particles [" e" ][" mass" ][RecordComponent::SCALAR];
55265527 }
55275528 {
5528- Series read (file, Access::READ_ONLY);
5529+ Series read (file, Access::READ_ONLY, config);
5530+
55295531 std::vector<decltype (Series::iterations)::key_type> iterations;
55305532 std::cout << " Going to list iterations in " << file << " :" << std::endl;
5531- for (auto const & iteration : read.readIterations ())
5533+ for (auto iteration : read.readIterations ())
55325534 {
5533- // @todo ensure that only the correct iterations are seen.
55345535 std::cout << " Seeing iteration " << iteration.iterationIndex
55355536 << std::endl;
55365537 iterations.push_back (iteration.iterationIndex );
5538+
5539+ Parameter<Operation::READ_ATT> readAttribute;
5540+ readAttribute.name = " this_does_definitely_not_exist" ;
5541+ read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
5542+ // enqueue a second time to check that the queue is cleared upon
5543+ // exception
5544+ read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
5545+
5546+ REQUIRE_THROWS_AS (
5547+ read.IOHandler ()->flush ({FlushLevel::InternalFlush}),
5548+ error::ReadError);
5549+ REQUIRE (read.IOHandler ()->m_work .empty ());
55375550 }
55385551 REQUIRE (
55395552 (iterations ==
@@ -5544,18 +5557,26 @@ void unfinished_iteration_test(
55445557TEST_CASE (" unfinished_iteration_test" , " [serial]" )
55455558{
55465559#if openPMD_HAVE_ADIOS2
5547- unfinished_iteration_test (" bp" , false );
5560+ unfinished_iteration_test (" bp" , false , " backend = \" adios2 \" " );
55485561 unfinished_iteration_test (
55495562 " bp" ,
55505563 false ,
55515564 R"(
5565+ backend = "adios2"
55525566iteration_encoding = "variable_based"
55535567adios2.schema = 20210209)" );
5554- unfinished_iteration_test (" bp" , true );
5568+ unfinished_iteration_test (" bp" , true , " backend = \" adios2 \" " );
55555569#endif
5556- #if 1
5570+ #if openPMD_HAVE_ADIOS2
5571+ unfinished_iteration_test (" adios1.bp" , false , " backend = \" adios1\" " );
5572+ unfinished_iteration_test (" adios1.bp" , true , " backend = \" adios1\" " );
5573+ #endif
5574+ #if openPMD_HAVE_HDF5
55575575 unfinished_iteration_test (" h5" , false );
5576+ unfinished_iteration_test (" h5" , true );
55585577#endif
5578+ unfinished_iteration_test (" json" , false );
5579+ unfinished_iteration_test (" json" , true );
55595580}
55605581#endif
55615582
0 commit comments