Skip to content

Commit ae02bad

Browse files
committed
Adapt test to recent rebase
Reading the chunk table requires NOT using template mode, otherwise the string just consists of '\0' bytes.
1 parent 22cf8b1 commit ae02bad

File tree

1 file changed

+45
-18
lines changed

1 file changed

+45
-18
lines changed

test/SerialIOTest.cpp

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,28 +1607,18 @@ struct ReadFromAnyType
16071607
}
16081608
};
16091609

1610-
inline void write_test(const std::string &backend)
1610+
inline void write_test(
1611+
const std::string &backend,
1612+
std::string jsonCfg = "{}",
1613+
bool test_rank_table = true)
16111614
{
1612-
#ifdef _WIN32
1613-
std::string jsonCfg = "{}";
1614-
#else
1615-
std::string jsonCfg = R"({"rank_table": "posix_hostname"})";
1615+
#ifndef _WIN32
1616+
jsonCfg = json::merge(jsonCfg, R"({"rank_table": "posix_hostname"})");
16161617
chunk_assignment::RankMeta compare{
16171618
{0,
16181619
host_info::byMethod(
16191620
host_info::methodFromStringDescription("posix_hostname", false))}};
16201621
#endif
1621-
jsonCfg = json::merge(jsonCfg, R"(
1622-
{
1623-
"json": {
1624-
"dataset": {
1625-
"mode": "template"
1626-
},
1627-
"attribute": {
1628-
"mode": "short"
1629-
}
1630-
}
1631-
})");
16321622
Series o =
16331623
Series("../samples/serial_write." + backend, Access::CREATE, jsonCfg);
16341624

@@ -1745,15 +1735,52 @@ inline void write_test(const std::string &backend)
17451735
variantTypeDataset);
17461736

17471737
#ifndef _WIN32
1748-
REQUIRE(read.rankTable(/* collective = */ false) == compare);
1738+
if (test_rank_table)
1739+
{
1740+
REQUIRE(read.rankTable(/* collective = */ false) == compare);
1741+
}
17491742
#endif
17501743
}
17511744

17521745
TEST_CASE("write_test", "[serial]")
17531746
{
17541747
for (auto const &t : testedFileExtensions())
17551748
{
1756-
write_test(t);
1749+
if (t == "json")
1750+
{
1751+
write_test(
1752+
"template." + t,
1753+
R"(
1754+
{
1755+
"json": {
1756+
"dataset": {
1757+
"mode": "template"
1758+
},
1759+
"attribute": {
1760+
"mode": "short"
1761+
}
1762+
}
1763+
})",
1764+
false);
1765+
write_test(
1766+
t,
1767+
R"(
1768+
{
1769+
"json": {
1770+
"dataset": {
1771+
"mode": "dataset"
1772+
},
1773+
"attribute": {
1774+
"mode": "short"
1775+
}
1776+
}
1777+
})",
1778+
true);
1779+
}
1780+
else
1781+
{
1782+
write_test(t);
1783+
}
17571784
Series list{"../samples/serial_write." + t, Access::READ_ONLY};
17581785
helper::listSeries(list);
17591786
}

0 commit comments

Comments
 (0)