Skip to content

Commit 4fbdd31

Browse files
committed
CI fixes
1 parent fe9a74c commit 4fbdd31

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

test/SerialIOTest.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@
4848
#undef max
4949
#endif
5050

51+
// On Windows, REQUIRE() might not be able to print more complex data structures
52+
// upon failure:
53+
// CoreTest.obj : error LNK2001: unresolved external symbol
54+
// "class std::string const Catch::Detail::unprintableString" (...)
55+
#ifdef _WIN32
56+
#define OPENPMD_REQUIRE_GUARD_WINDOWS(...) \
57+
do \
58+
{ \
59+
bool guarded_require_boolean = __VA_ARGS__; \
60+
REQUIRE(guarded_require_boolean); \
61+
} while (0);
62+
#else
63+
#define OPENPMD_REQUIRE_GUARD_WINDOWS(...) REQUIRE(__VA_ARGS__)
64+
#endif
65+
5166
using namespace openPMD;
5267

5368
struct BackendSelection
@@ -950,10 +965,10 @@ inline void constant_scalar(std::string const &file_ending)
950965
E_mesh.setAxisLabels(axisLabels);
951966
E_mesh.setUnitDimension(unitDimensions);
952967
E_mesh.setTimeOffset(timeOffset);
953-
REQUIRE(
968+
OPENPMD_REQUIRE_GUARD_WINDOWS(
954969
E_mesh.gridUnitSIPerDimension() == std::vector<double>{1., 1., 1.});
955970
E_mesh.setGridUnitSI(std::vector(3, gridUnitSI));
956-
REQUIRE(
971+
OPENPMD_REQUIRE_GUARD_WINDOWS(
957972
E_mesh.gridUnitSIPerDimension() ==
958973
std::vector<double>{gridUnitSI, gridUnitSI, gridUnitSI});
959974

@@ -1116,7 +1131,7 @@ inline void constant_scalar(std::string const &file_ending)
11161131
Extent{3, 2, 1});
11171132

11181133
Mesh &E_mesh = s.iterations[1].meshes["E"];
1119-
REQUIRE(
1134+
OPENPMD_REQUIRE_GUARD_WINDOWS(
11201135
E_mesh.gridUnitDimension() ==
11211136
std::vector{
11221137
std::array<double, 7>{1., 0., 0., 0., 0, .0, 0.},

test/python/unittest/API/APITest.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ def testFieldData(self):
9898
self.assertEqual(len(i.meshes), 2)
9999
for m in i.meshes:
100100
self.assertTrue(m in ["E", "rho"])
101-
self.assertEqual(i.meshes[m].unit_dimension, io.Unit_Dimension.as_array(
102-
io.Unit_Dimension.as_map(i.meshes[m].unit_dimension)))
103-
self.assertEqual(io.Unit_Dimension.as_maps(i.meshes[m].grid_unit_dimension), [
104-
{io.Unit_Dimension.L: 1}, {io.Unit_Dimension.L: 1}])
101+
self.assertEqual(
102+
i.meshes[m].unit_dimension,
103+
io.Unit_Dimension.as_array(
104+
io.Unit_Dimension.as_map(i.meshes[m].unit_dimension)))
105+
self.assertEqual(
106+
io.Unit_Dimension.as_maps(i.meshes[m].grid_unit_dimension),
107+
[{io.Unit_Dimension.L: 1}, {io.Unit_Dimension.L: 1}])
105108
self.assertEqual(io.Unit_Dimension.from_index(0), io.Unit_Dimension.L)
106109
self.assertEqual(io.Unit_Dimension.L.as_index(), 0)
107110
for idx in range(7):

0 commit comments

Comments
 (0)