Skip to content

Commit ae94962

Browse files
committed
Consider OPENPMD_BP_BACKEND in tests
1 parent dcb04a9 commit ae94962

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

test/SerialIOTest.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,6 +3952,8 @@ TEST_CASE("adios2_engines_and_file_endings")
39523952
std::string const &requiredEngine,
39533953
std::string const &filesystemExt,
39543954
std::string const &jsonCfg = "{}") mutable {
3955+
// Env. var. OPENPMD_BP_BACKEND does not matter for this test as
3956+
// we always override it in the JSON config
39553957
auto basename = "../samples/file_endings/groupbased" +
39563958
std::to_string(filenameCounter++);
39573959
auto name = basename + ext;
@@ -3997,9 +3999,7 @@ TEST_CASE("adios2_engines_and_file_endings")
39973999
groupbased_test_explicit_backend(
39984000
"", true, "bp4", "", "adios2.engine.type = \"bp4\"");
39994001

4000-
#if ADIOS2_VERSION_MAJOR * 1000000000 + ADIOS2_VERSION_MINOR * 100000000 + \
4001-
ADIOS2_VERSION_PATCH * 1000000 + ADIOS2_VERSION_TWEAK >= \
4002-
2701001223
4002+
#ifdef ADIOS2_HAVE_BP5
40034003
// BP5 tests
40044004
groupbased_test_explicit_backend(".bp5", true, "bp5", "");
40054005
groupbased_test_explicit_backend(
@@ -4027,7 +4027,10 @@ TEST_CASE("adios2_engines_and_file_endings")
40274027
{
40284028
Series write(name, Access::CREATE, jsonCfg);
40294029
}
4030-
if (directory)
4030+
bool isThisADIOS1 =
4031+
auxiliary::getEnvString("OPENPMD_BP_BACKEND", "") == "ADIOS1" &&
4032+
ext == ".bp";
4033+
if (directory && !isThisADIOS1)
40314034
{
40324035
REQUIRE(auxiliary::directory_exists(filesystemname));
40334036
}
@@ -4039,7 +4042,10 @@ TEST_CASE("adios2_engines_and_file_endings")
40394042
Series read(
40404043
name,
40414044
Access::READ_ONLY,
4042-
"adios2.engine.type = \"" + requiredEngine + "\"");
4045+
isThisADIOS1
4046+
? "backend = \"adios1\""
4047+
: "backend = \"adios2\"\nadios2.engine.type = \"" +
4048+
requiredEngine + "\"");
40434049
}
40444050
};
40454051

@@ -4060,9 +4066,7 @@ TEST_CASE("adios2_engines_and_file_endings")
40604066
REQUIRE_THROWS(groupbased_test_no_explicit_backend(
40614067
"", true, "bp4", "", "adios2.engine.type = \"bp4\""));
40624068

4063-
#if ADIOS2_VERSION_MAJOR * 1000000000 + ADIOS2_VERSION_MINOR * 100000000 + \
4064-
ADIOS2_VERSION_PATCH * 1000000 + ADIOS2_VERSION_TWEAK >= \
4065-
2701001223
4069+
#ifdef ADIOS2_HAVE_BP5
40664070
// BP5 tests
40674071
groupbased_test_no_explicit_backend(".bp5", true, "bp5", "");
40684072
groupbased_test_no_explicit_backend(
@@ -4139,9 +4143,7 @@ TEST_CASE("adios2_engines_and_file_endings")
41394143
filebased_test_explicit_backend(
41404144
"", true, "bp4", "", "adios2.engine.type = \"bp4\"");
41414145

4142-
#if ADIOS2_VERSION_MAJOR * 1000000000 + ADIOS2_VERSION_MINOR * 100000000 + \
4143-
ADIOS2_VERSION_PATCH * 1000000 + ADIOS2_VERSION_TWEAK >= \
4144-
2701001223
4146+
#ifdef ADIOS2_HAVE_BP5
41454147
// BP5 tests
41464148
filebased_test_explicit_backend(".bp5", true, "bp5", "");
41474149
filebased_test_explicit_backend(
@@ -4170,7 +4172,10 @@ TEST_CASE("adios2_engines_and_file_endings")
41704172
Series write(name, Access::CREATE, jsonCfg);
41714173
write.writeIterations()[0];
41724174
}
4173-
if (directory)
4175+
bool isThisADIOS1 =
4176+
auxiliary::getEnvString("OPENPMD_BP_BACKEND", "") == "ADIOS1" &&
4177+
ext == ".bp";
4178+
if (directory && !isThisADIOS1)
41744179
{
41754180
REQUIRE(auxiliary::directory_exists(filesystemname));
41764181
}
@@ -4192,7 +4197,10 @@ TEST_CASE("adios2_engines_and_file_endings")
41924197
Series read(
41934198
name,
41944199
Access::READ_ONLY,
4195-
"adios2.engine.type = \"" + requiredEngine + "\"");
4200+
isThisADIOS1
4201+
? "backend = \"adios1\""
4202+
: "backend = \"adios2\"\nadios2.engine.type = \"" +
4203+
requiredEngine + "\"");
41964204
}
41974205
};
41984206

@@ -4213,9 +4221,7 @@ TEST_CASE("adios2_engines_and_file_endings")
42134221
REQUIRE_THROWS(filebased_test_no_explicit_backend(
42144222
"", true, "bp4", "", "adios2.engine.type = \"bp4\""));
42154223

4216-
#if ADIOS2_VERSION_MAJOR * 1000000000 + ADIOS2_VERSION_MINOR * 100000000 + \
4217-
ADIOS2_VERSION_PATCH * 1000000 + ADIOS2_VERSION_TWEAK >= \
4218-
2701001223
4224+
#ifdef ADIOS2_HAVE_BP5
42194225
// BP5 tests
42204226
filebased_test_no_explicit_backend(".bp5", true, "bp5", "");
42214227
filebased_test_no_explicit_backend(

0 commit comments

Comments
 (0)