mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-21 00:40:16 +00:00
fix: broken ci
This commit is contained in:
parent
e0ef097ea6
commit
d4e78e1e68
11
ffi.nimble
11
ffi.nimble
@ -90,8 +90,11 @@ task test_cpp_e2e, "Build and run the C++ end-to-end tests for the timer example
|
||||
runOrQuit "nimble genbindings_cpp"
|
||||
runOrQuit "nimble genbindings_cpp_echo"
|
||||
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build"
|
||||
runOrQuit "cmake --build tests/e2e/cpp/build"
|
||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
|
||||
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug"
|
||||
# `-C Debug` is required on Windows multi-config generators because
|
||||
# gtest_discover_tests(PRE_TEST) loads per-config include files; harmless on
|
||||
# single-config generators (Make/Ninja) on Linux/macOS.
|
||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
|
||||
|
||||
task test_sanitized,
|
||||
"Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)":
|
||||
@ -124,8 +127,8 @@ task test_cpp_e2e_sanitized,
|
||||
runOrQuit "nimble genbindings_cpp_echo"
|
||||
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" & " -DNIM_FFI_MM=" & mm &
|
||||
" -DNIM_FFI_SANITIZER=" & san
|
||||
runOrQuit "cmake --build tests/e2e/cpp/build -j"
|
||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
|
||||
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug -j"
|
||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
|
||||
|
||||
task genbindings_example, "Generate Rust bindings for the timer example":
|
||||
exec "nim c " & nimFlagsOrc &
|
||||
|
||||
@ -233,6 +233,7 @@ template enqueueOrMarkStuck(
|
||||
if not ffiCurrentNotifyEventEnqueued.isNil():
|
||||
ffiCurrentNotifyEventEnqueued()
|
||||
|
||||
template dispatchFFIEvent*(eventName: string, body: untyped) =
|
||||
## `body` must yield `string` / `seq[byte]`. FFI thread only: encodes into
|
||||
## a `c_malloc` buffer and enqueues; the event thread fans out to listeners.
|
||||
block:
|
||||
|
||||
@ -56,7 +56,8 @@ proc processRequest[T](
|
||||
## Invoked within the FFI thread to process a request coming from the FFI API consumer thread.
|
||||
|
||||
let reqId = $request[].reqId
|
||||
let reqIdCs = reqId.cstring # keeps reqId alive; implicit string→cstring is a warning.
|
||||
let reqIdCs = reqId.cstring
|
||||
# keeps reqId alive; implicit string→cstring is a warning.
|
||||
|
||||
let retFut =
|
||||
if not ctx[].registeredRequests[].contains(reqIdCs):
|
||||
|
||||
@ -130,9 +130,8 @@ suite "event delivery is asynchronous":
|
||||
setupCallbackData(rsp)
|
||||
|
||||
withPool(ctx):
|
||||
discard addEventListener(
|
||||
ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt
|
||||
)
|
||||
discard
|
||||
addEventListener(ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt)
|
||||
|
||||
check sendRequestToFFIThread(
|
||||
ctx, CaptureFfiTidRequest.ffiNewReq(captureCb, addr rsp)
|
||||
@ -164,9 +163,7 @@ suite "FFI thread independence":
|
||||
setupCallbackData(rsp)
|
||||
|
||||
withPool(ctx):
|
||||
discard addEventListener(
|
||||
ctx[].eventRegistry, "latch", slowSleepCb, nil
|
||||
)
|
||||
discard addEventListener(ctx[].eventRegistry, "latch", slowSleepCb, nil)
|
||||
|
||||
check sendRequestToFFIThread(
|
||||
ctx, EmitLatchEvent.ffiNewReq(captureCb, addr rsp, 0)
|
||||
@ -178,8 +175,7 @@ suite "FFI thread independence":
|
||||
# chronos's `Moment` — std/times exports a `milliseconds` that
|
||||
# shadows chronos's at this generic-instantiation site.
|
||||
let started = Moment.now()
|
||||
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp))
|
||||
.isOk()
|
||||
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp)).isOk()
|
||||
waitCallback(rsp)
|
||||
let elapsed = Moment.now() - started
|
||||
|
||||
@ -212,8 +208,7 @@ when not defined(gcRefc):
|
||||
# Wedge long enough to cross at least one tick boundary.
|
||||
gBlockingEnabled.store(true)
|
||||
let wedgeMs =
|
||||
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int +
|
||||
1500
|
||||
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int + 1500
|
||||
check sendRequestToFFIThread(
|
||||
ctx, BlockingRequest.ffiNewReq(captureCb, addr rsp, wedgeMs)
|
||||
)
|
||||
@ -277,9 +272,7 @@ suite "queue overflow":
|
||||
setupCallbackData(rejected)
|
||||
|
||||
withPool(ctx):
|
||||
discard addEventListener(
|
||||
ctx[].eventRegistry, "latch", backpressureCb, addr bp
|
||||
)
|
||||
discard addEventListener(ctx[].eventRegistry, "latch", backpressureCb, addr bp)
|
||||
discard addEventListener(
|
||||
ctx[].eventRegistry, NotRespondingEventName, captureCb, addr notif
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user