Skip to content

Commit d4e78e1

Browse files
committed
fix: broken ci
1 parent e0ef097 commit d4e78e1

4 files changed

Lines changed: 16 additions & 18 deletions

File tree

ffi.nimble

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ task test_cpp_e2e, "Build and run the C++ end-to-end tests for the timer example
9090
runOrQuit "nimble genbindings_cpp"
9191
runOrQuit "nimble genbindings_cpp_echo"
9292
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build"
93-
runOrQuit "cmake --build tests/e2e/cpp/build"
94-
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
93+
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug"
94+
# `-C Debug` is required on Windows multi-config generators because
95+
# gtest_discover_tests(PRE_TEST) loads per-config include files; harmless on
96+
# single-config generators (Make/Ninja) on Linux/macOS.
97+
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
9598

9699
task test_sanitized,
97100
"Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)":
@@ -124,8 +127,8 @@ task test_cpp_e2e_sanitized,
124127
runOrQuit "nimble genbindings_cpp_echo"
125128
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" & " -DNIM_FFI_MM=" & mm &
126129
" -DNIM_FFI_SANITIZER=" & san
127-
runOrQuit "cmake --build tests/e2e/cpp/build -j"
128-
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
130+
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug -j"
131+
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
129132

130133
task genbindings_example, "Generate Rust bindings for the timer example":
131134
exec "nim c " & nimFlagsOrc &

ffi/ffi_events.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ template enqueueOrMarkStuck(
233233
if not ffiCurrentNotifyEventEnqueued.isNil():
234234
ffiCurrentNotifyEventEnqueued()
235235

236+
template dispatchFFIEvent*(eventName: string, body: untyped) =
236237
## `body` must yield `string` / `seq[byte]`. FFI thread only: encodes into
237238
## a `c_malloc` buffer and enqueues; the event thread fans out to listeners.
238239
block:

ffi/ffi_thread.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ proc processRequest[T](
5656
## Invoked within the FFI thread to process a request coming from the FFI API consumer thread.
5757

5858
let reqId = $request[].reqId
59-
let reqIdCs = reqId.cstring # keeps reqId alive; implicit string→cstring is a warning.
59+
let reqIdCs = reqId.cstring
60+
# keeps reqId alive; implicit string→cstring is a warning.
6061

6162
let retFut =
6263
if not ctx[].registeredRequests[].contains(reqIdCs):

tests/unit/test_event_thread.nim

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ suite "event delivery is asynchronous":
130130
setupCallbackData(rsp)
131131

132132
withPool(ctx):
133-
discard addEventListener(
134-
ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt
135-
)
133+
discard
134+
addEventListener(ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt)
136135

137136
check sendRequestToFFIThread(
138137
ctx, CaptureFfiTidRequest.ffiNewReq(captureCb, addr rsp)
@@ -164,9 +163,7 @@ suite "FFI thread independence":
164163
setupCallbackData(rsp)
165164

166165
withPool(ctx):
167-
discard addEventListener(
168-
ctx[].eventRegistry, "latch", slowSleepCb, nil
169-
)
166+
discard addEventListener(ctx[].eventRegistry, "latch", slowSleepCb, nil)
170167

171168
check sendRequestToFFIThread(
172169
ctx, EmitLatchEvent.ffiNewReq(captureCb, addr rsp, 0)
@@ -178,8 +175,7 @@ suite "FFI thread independence":
178175
# chronos's `Moment` — std/times exports a `milliseconds` that
179176
# shadows chronos's at this generic-instantiation site.
180177
let started = Moment.now()
181-
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp))
182-
.isOk()
178+
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp)).isOk()
183179
waitCallback(rsp)
184180
let elapsed = Moment.now() - started
185181

@@ -212,8 +208,7 @@ when not defined(gcRefc):
212208
# Wedge long enough to cross at least one tick boundary.
213209
gBlockingEnabled.store(true)
214210
let wedgeMs =
215-
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int +
216-
1500
211+
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int + 1500
217212
check sendRequestToFFIThread(
218213
ctx, BlockingRequest.ffiNewReq(captureCb, addr rsp, wedgeMs)
219214
)
@@ -277,9 +272,7 @@ suite "queue overflow":
277272
setupCallbackData(rejected)
278273

279274
withPool(ctx):
280-
discard addEventListener(
281-
ctx[].eventRegistry, "latch", backpressureCb, addr bp
282-
)
275+
discard addEventListener(ctx[].eventRegistry, "latch", backpressureCb, addr bp)
283276
discard addEventListener(
284277
ctx[].eventRegistry, NotRespondingEventName, captureCb, addr notif
285278
)

0 commit comments

Comments
 (0)