@@ -4562,11 +4562,9 @@ TEST_CASE( "deferred_parsing", "[serial]" )
45624562 }
45634563}
45644564
4565- // @todo merge this back with the chaotic_stream test of PR #949
4566- // (bug noticed while working on that branch)
4567- void no_explicit_flush ( std::string filename )
4565+ void chaotic_stream ( std::string filename, bool variableBased )
45684566{
4569- std::vector< uint64_t > sampleData { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
4567+ std::vector< uint64_t > iterations { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
45704568 std::string jsonConfig = R"(
45714569{
45724570 "adios2": {
@@ -4578,16 +4576,31 @@ void no_explicit_flush( std::string filename )
45784576 }
45794577})" ;
45804578
4579+ bool weirdOrderWhenReading{};
4580+
45814581 {
45824582 Series series ( filename, Access::CREATE, jsonConfig );
4583- for ( uint64_t currentIteration = 0 ; currentIteration < 10 ;
4584- ++currentIteration )
4583+ /*
4584+ * When using ADIOS2 steps, iterations are read not by logical order
4585+ * (iteration index), but by order of writing.
4586+ */
4587+ weirdOrderWhenReading = series.backend () == " ADIOS2" &&
4588+ series.iterationEncoding () != IterationEncoding::fileBased;
4589+ if ( variableBased )
4590+ {
4591+ if ( series.backend () != " ADIOS2" )
4592+ {
4593+ return ;
4594+ }
4595+ series.setIterationEncoding ( IterationEncoding::variableBased );
4596+ }
4597+ for ( auto currentIteration : iterations )
45854598 {
45864599 auto dataset =
45874600 series.writeIterations ()[ currentIteration ]
45884601 .meshes [ " iterationOrder" ][ MeshRecordComponent::SCALAR ];
45894602 dataset.resetDataset ( { determineDatatype< uint64_t >(), { 10 } } );
4590- dataset.storeChunk ( sampleData , { 0 }, { 10 } );
4603+ dataset.storeChunk ( iterations , { 0 }, { 10 } );
45914604 // series.writeIterations()[ currentIteration ].close();
45924605 }
45934606 }
@@ -4597,19 +4610,27 @@ void no_explicit_flush( std::string filename )
45974610 size_t index = 0 ;
45984611 for ( auto iteration : series.readIterations () )
45994612 {
4600- REQUIRE ( iteration.iterationIndex == index );
4613+ if ( weirdOrderWhenReading )
4614+ {
4615+ REQUIRE ( iteration.iterationIndex == iterations[ index ] );
4616+ }
4617+ else
4618+ {
4619+ REQUIRE ( iteration.iterationIndex == index );
4620+ }
46014621 ++index;
46024622 }
4603- REQUIRE ( index == 10 );
4623+ REQUIRE ( index == iterations. size () );
46044624 }
46054625}
46064626
4607- TEST_CASE ( " no_explicit_flush " , " [serial]" )
4627+ TEST_CASE ( " chaotic_stream " , " [serial]" )
46084628{
46094629 for ( auto const & t : testedFileExtensions () )
46104630 {
4611- no_explicit_flush ( " ../samples/no_explicit_flush_filebased_%T." + t );
4612- no_explicit_flush ( " ../samples/no_explicit_flush." + t );
4631+ chaotic_stream ( " ../samples/chaotic_stream_filebased_%T." + t, false );
4632+ chaotic_stream ( " ../samples/chaotic_stream." + t, false );
4633+ chaotic_stream ( " ../samples/chaotic_stream_vbased." + t, true );
46134634 }
46144635}
46154636
0 commit comments