Skip to content

Commit 30d3e09

Browse files
committed
FIX: Fix macOS build and cppcheck install
1 parent 1a3039d commit 30d3e09

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
cd cppcheck
2828
cmake -S. -B build \
2929
-DCMAKE_BUILD_TYPE=Release \
30-
-DUSE_MATCHCOMPILER=ON \
30+
-DUSE_MATCHCOMPILER=On \
3131
-DHAVE_RULES=ON
3232
cmake --build build --config Release
3333
sudo cmake --install build --prefix /usr

include/databento/with_ts_out.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ template <typename R>
1111
struct WithTsOut {
1212
static bool HasRType(RType rtype) { return R::HasRType(rtype); }
1313

14-
constexpr WithTsOut(R r, UnixNanos ts) : rec{r}, ts_out{ts} {
14+
WithTsOut(R r, UnixNanos ts) : rec{r}, ts_out{ts} {
1515
// Adjust length for `ts_out`
1616
this->rec.hd.length = sizeof(*this) / kRecordHeaderLengthMultiplier;
1717
}

test/src/live_blocking_tests.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ TEST_F(LiveBlockingTests, TestNextRecordPartialRead) {
266266
TEST_F(LiveBlockingTests, TestNextRecordWithTsOut) {
267267
constexpr auto kRecCount = 5;
268268
constexpr auto kTsOut = true;
269-
constexpr WithTsOut<TradeMsg> kRec{
269+
const WithTsOut<TradeMsg> send_rec{
270270
{DummyHeader<TradeMsg>(RType::Mbp0),
271271
1,
272272
2,
@@ -279,11 +279,11 @@ TEST_F(LiveBlockingTests, TestNextRecordWithTsOut) {
279279
2},
280280
UnixNanos{std::chrono::seconds{1678910279000000000}}};
281281
const mock::MockLsgServer mock_server{
282-
dataset::kXnasItch, kTsOut, [kRec](mock::MockLsgServer& self) {
282+
dataset::kXnasItch, kTsOut, [send_rec](mock::MockLsgServer& self) {
283283
self.Accept();
284284
self.Authenticate();
285285
for (size_t i = 0; i < kRecCount; ++i) {
286-
self.SendRecord(kRec);
286+
self.SendRecord(send_rec);
287287
}
288288
}};
289289

@@ -293,16 +293,16 @@ TEST_F(LiveBlockingTests, TestNextRecordWithTsOut) {
293293
for (size_t i = 0; i < kRecCount; ++i) {
294294
const auto rec = target.NextRecord();
295295
ASSERT_TRUE(rec.Holds<WithTsOut<TradeMsg>>()) << "Failed on call " << i;
296-
EXPECT_EQ(rec.Get<WithTsOut<TradeMsg>>(), kRec);
296+
EXPECT_EQ(rec.Get<WithTsOut<TradeMsg>>(), send_rec);
297297
// Extracting the plain record (without ts_out) should also work
298298
ASSERT_TRUE(rec.Holds<TradeMsg>()) << "Failed on call " << i;
299-
EXPECT_EQ(rec.Get<TradeMsg>(), kRec.rec);
299+
EXPECT_EQ(rec.Get<TradeMsg>(), send_rec.rec);
300300
}
301301
}
302302

303303
TEST_F(LiveBlockingTests, TestStop) {
304304
constexpr auto kTsOut = true;
305-
constexpr WithTsOut<TradeMsg> kRec{
305+
const WithTsOut<TradeMsg> send_rec{
306306
{DummyHeader<WithTsOut<TradeMsg>>(RType::Mbp0),
307307
1,
308308
2,
@@ -316,27 +316,27 @@ TEST_F(LiveBlockingTests, TestStop) {
316316
UnixNanos{std::chrono::seconds{1678910279000000000}}};
317317
std::atomic<bool> has_stopped{false};
318318
std::unique_ptr<mock::MockLsgServer> mock_server{
319-
new mock::MockLsgServer{dataset::kXnasItch, kTsOut,
320-
[kRec, &has_stopped](mock::MockLsgServer& self) {
321-
self.Accept();
322-
self.Authenticate();
323-
self.SendRecord(kRec);
324-
while (!has_stopped) {
325-
std::this_thread::yield();
326-
}
327-
const std::string rec_str{
328-
reinterpret_cast<const char*>(&kRec),
329-
sizeof(kRec)};
330-
while (self.UncheckedSend(rec_str) ==
331-
static_cast<::ssize_t>(rec_str.size())) {
332-
}
333-
}} // namespace test
334-
}; // namespace databento
319+
new mock::MockLsgServer{
320+
dataset::kXnasItch, kTsOut,
321+
[send_rec, &has_stopped](mock::MockLsgServer& self) {
322+
self.Accept();
323+
self.Authenticate();
324+
self.SendRecord(send_rec);
325+
while (!has_stopped) {
326+
std::this_thread::yield();
327+
}
328+
const std::string rec_str{reinterpret_cast<const char*>(&send_rec),
329+
sizeof(send_rec)};
330+
while (self.UncheckedSend(rec_str) ==
331+
static_cast<::ssize_t>(rec_str.size())) {
332+
}
333+
}} // namespace test
334+
}; // namespace databento
335335

336336
LiveBlocking target{
337337
logger_.get(), kKey, dataset::kXnasItch, kLocalhost,
338338
mock_server->Port(), kTsOut, VersionUpgradePolicy{}};
339-
ASSERT_EQ(target.NextRecord().Get<WithTsOut<TradeMsg>>(), kRec);
339+
ASSERT_EQ(target.NextRecord().Get<WithTsOut<TradeMsg>>(), send_rec);
340340
target.Stop();
341341
has_stopped = true;
342342
// kill mock server and join thread before client goes out of scope

0 commit comments

Comments
 (0)