diff --git a/src/snapshots/StatefulIterator.cpp b/src/snapshots/StatefulIterator.cpp index b29cd4a53c..74f24363f1 100644 --- a/src/snapshots/StatefulIterator.cpp +++ b/src/snapshots/StatefulIterator.cpp @@ -65,7 +65,8 @@ namespace detail } template - auto CurrentStep::get_variant() const -> std::optional + [[nodiscard]] auto CurrentStep::get_variant() const + -> std::optional { auto res = std::get_if(*this); if (res) diff --git a/test/Files_SerialIO/close_iteration_test.cpp b/test/Files_SerialIO/close_iteration_test.cpp index d8dcf5ea20..2863c75247 100644 --- a/test/Files_SerialIO/close_iteration_test.cpp +++ b/test/Files_SerialIO/close_iteration_test.cpp @@ -1,4 +1,5 @@ #include "SerialIOTests.hpp" +#include "openPMD/IO/ADIOS/macros.hpp" #include "openPMD/IO/Access.hpp" #include "openPMD/auxiliary/Filesystem.hpp" @@ -9,6 +10,15 @@ namespace close_and_reopen_test using namespace openPMD; #if openPMD_HAVE_ADIOS2 +constexpr char const *write_cfg = +#if openPMD_HAS_ADIOS_2_9 + R"(adios2.use_group_table = true + adios2.modifiable_attributes = true)"; +#else + R"(adios2.use_group_table = false + adios2.modifiable_attributes = false)"; +#endif + template auto run_test_filebased( WriteIterations &&writeIterations, std::string const &ext) @@ -16,11 +26,7 @@ auto run_test_filebased( std::string filename = "../samples/close_iteration_reopen/filebased_%T." + ext; auxiliary::remove_directory("../samples/close_iteration_reopen"); - Series series( - filename, - Access::CREATE, - R"(adios2.use_group_table = true - adios2.modifiable_attributes = true)"); + Series series(filename, Access::CREATE, write_cfg); { auto it = writeIterations(series)[0]; auto E_x = it.meshes["E"]["x"]; @@ -64,11 +70,7 @@ auto run_test_filebased( } series.close(); - series = Series( - filename, - Access::READ_WRITE, - R"(adios2.use_group_table = true - adios2.modifiable_attributes = true)"); + series = Series(filename, Access::READ_WRITE, write_cfg); { // @todo proper support for READ_WRITE in snapshots() @@ -172,11 +174,7 @@ auto run_test_groupbased( { std::string filename = "../samples/close_iteration_reopen/groupbased." + ext; - Series series( - filename, - Access::CREATE, - R"(adios2.use_group_table = true - adios2.modifiable_attributes = true)"); + Series series(filename, Access::CREATE, write_cfg); { auto it = writeIterations(series)[0]; auto E_x = it.meshes["E"]["x"]; diff --git a/test/Files_SerialIO/filebased_write_test.cpp b/test/Files_SerialIO/filebased_write_test.cpp index 488abd7984..0a7109ca2f 100644 --- a/test/Files_SerialIO/filebased_write_test.cpp +++ b/test/Files_SerialIO/filebased_write_test.cpp @@ -80,12 +80,24 @@ void close_and_reopen_iterations( void close_and_reopen_iterations(std::string const &filename) { close_and_reopen_iterations( - filename, Access::READ_LINEAR, "defer_iteration_parsing=false", false); + filename, + Access::READ_LINEAR, + R"({"defer_iteration_parsing":false})", + false); close_and_reopen_iterations( - filename, Access::READ_LINEAR, "defer_iteration_parsing=true", false); + filename, + Access::READ_LINEAR, + R"({"defer_iteration_parsing":true})", + false); close_and_reopen_iterations( - filename, Access::READ_ONLY, "defer_iteration_parsing=false", false); + filename, + Access::READ_ONLY, + R"({"defer_iteration_parsing":false})", + false); close_and_reopen_iterations( - filename, Access::READ_ONLY, "defer_iteration_parsing=true", true); + filename, + Access::READ_ONLY, + R"({"defer_iteration_parsing":true})", + true); } } // namespace filebased_write_test