@@ -4564,11 +4564,9 @@ TEST_CASE( "deferred_parsing", "[serial]" )
45644564 }
45654565}
45664566
4567- // @todo merge this back with the chaotic_stream test of PR #949
4568- // (bug noticed while working on that branch)
4569- void no_explicit_flush ( std::string filename )
4567+ void chaotic_stream ( std::string filename, bool variableBased )
45704568{
4571- std::vector< uint64_t > sampleData { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
4569+ std::vector< uint64_t > iterations { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
45724570 std::string jsonConfig = R"(
45734571{
45744572 "adios2": {
@@ -4580,16 +4578,31 @@ void no_explicit_flush( std::string filename )
45804578 }
45814579})" ;
45824580
4581+ bool weirdOrderWhenReading{};
4582+
45834583 {
45844584 Series series ( filename, Access::CREATE, jsonConfig );
4585- for ( uint64_t currentIteration = 0 ; currentIteration < 10 ;
4586- ++currentIteration )
4585+ /*
4586+ * When using ADIOS2 steps, iterations are read not by logical order
4587+ * (iteration index), but by order of writing.
4588+ */
4589+ weirdOrderWhenReading = series.backend () == " ADIOS2" &&
4590+ series.iterationEncoding () != IterationEncoding::fileBased;
4591+ if ( variableBased )
4592+ {
4593+ if ( series.backend () != " ADIOS2" )
4594+ {
4595+ return ;
4596+ }
4597+ series.setIterationEncoding ( IterationEncoding::variableBased );
4598+ }
4599+ for ( auto currentIteration : iterations )
45874600 {
45884601 auto dataset =
45894602 series.writeIterations ()[ currentIteration ]
45904603 .meshes [ " iterationOrder" ][ MeshRecordComponent::SCALAR ];
45914604 dataset.resetDataset ( { determineDatatype< uint64_t >(), { 10 } } );
4592- dataset.storeChunk ( sampleData , { 0 }, { 10 } );
4605+ dataset.storeChunk ( iterations , { 0 }, { 10 } );
45934606 // series.writeIterations()[ currentIteration ].close();
45944607 }
45954608 }
@@ -4599,19 +4612,27 @@ void no_explicit_flush( std::string filename )
45994612 size_t index = 0 ;
46004613 for ( auto iteration : series.readIterations () )
46014614 {
4602- REQUIRE ( iteration.iterationIndex == index );
4615+ if ( weirdOrderWhenReading )
4616+ {
4617+ REQUIRE ( iteration.iterationIndex == iterations[ index ] );
4618+ }
4619+ else
4620+ {
4621+ REQUIRE ( iteration.iterationIndex == index );
4622+ }
46034623 ++index;
46044624 }
4605- REQUIRE ( index == 10 );
4625+ REQUIRE ( index == iterations. size () );
46064626 }
46074627}
46084628
4609- TEST_CASE ( " no_explicit_flush " , " [serial]" )
4629+ TEST_CASE ( " chaotic_stream " , " [serial]" )
46104630{
46114631 for ( auto const & t : testedFileExtensions () )
46124632 {
4613- no_explicit_flush ( " ../samples/no_explicit_flush_filebased_%T." + t );
4614- no_explicit_flush ( " ../samples/no_explicit_flush." + t );
4633+ chaotic_stream ( " ../samples/chaotic_stream_filebased_%T." + t, false );
4634+ chaotic_stream ( " ../samples/chaotic_stream." + t, false );
4635+ chaotic_stream ( " ../samples/chaotic_stream_vbased." + t, true );
46154636 }
46164637}
46174638
0 commit comments