mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-08-08 07:53:15 +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"
|
||||||
runOrQuit "nimble genbindings_cpp_echo"
|
runOrQuit "nimble genbindings_cpp_echo"
|
||||||
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build"
|
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build"
|
||||||
runOrQuit "cmake --build tests/e2e/cpp/build"
|
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug"
|
||||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
|
# `-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,
|
task test_sanitized,
|
||||||
"Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)":
|
"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 "nimble genbindings_cpp_echo"
|
||||||
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" & " -DNIM_FFI_MM=" & mm &
|
runOrQuit "cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" & " -DNIM_FFI_MM=" & mm &
|
||||||
" -DNIM_FFI_SANITIZER=" & san
|
" -DNIM_FFI_SANITIZER=" & san
|
||||||
runOrQuit "cmake --build tests/e2e/cpp/build -j"
|
runOrQuit "cmake --build tests/e2e/cpp/build --config Debug -j"
|
||||||
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure"
|
runOrQuit "ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
|
||||||
|
|
||||||
task genbindings_example, "Generate Rust bindings for the timer example":
|
task genbindings_example, "Generate Rust bindings for the timer example":
|
||||||
exec "nim c " & nimFlagsOrc &
|
exec "nim c " & nimFlagsOrc &
|
||||||
|
|||||||
@ -233,6 +233,7 @@ template enqueueOrMarkStuck(
|
|||||||
if not ffiCurrentNotifyEventEnqueued.isNil():
|
if not ffiCurrentNotifyEventEnqueued.isNil():
|
||||||
ffiCurrentNotifyEventEnqueued()
|
ffiCurrentNotifyEventEnqueued()
|
||||||
|
|
||||||
|
template dispatchFFIEvent*(eventName: string, body: untyped) =
|
||||||
## `body` must yield `string` / `seq[byte]`. FFI thread only: encodes into
|
## `body` must yield `string` / `seq[byte]`. FFI thread only: encodes into
|
||||||
## a `c_malloc` buffer and enqueues; the event thread fans out to listeners.
|
## a `c_malloc` buffer and enqueues; the event thread fans out to listeners.
|
||||||
block:
|
block:
|
||||||
|
|||||||
@ -56,7 +56,8 @@ proc processRequest[T](
|
|||||||
## Invoked within the FFI thread to process a request coming from the FFI API consumer thread.
|
## Invoked within the FFI thread to process a request coming from the FFI API consumer thread.
|
||||||
|
|
||||||
let reqId = $request[].reqId
|
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 =
|
let retFut =
|
||||||
if not ctx[].registeredRequests[].contains(reqIdCs):
|
if not ctx[].registeredRequests[].contains(reqIdCs):
|
||||||
|
|||||||
@ -130,9 +130,8 @@ suite "event delivery is asynchronous":
|
|||||||
setupCallbackData(rsp)
|
setupCallbackData(rsp)
|
||||||
|
|
||||||
withPool(ctx):
|
withPool(ctx):
|
||||||
discard addEventListener(
|
discard
|
||||||
ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt
|
addEventListener(ctx[].eventRegistry, "latch", captureThreadIdCb, addr evt)
|
||||||
)
|
|
||||||
|
|
||||||
check sendRequestToFFIThread(
|
check sendRequestToFFIThread(
|
||||||
ctx, CaptureFfiTidRequest.ffiNewReq(captureCb, addr rsp)
|
ctx, CaptureFfiTidRequest.ffiNewReq(captureCb, addr rsp)
|
||||||
@ -164,9 +163,7 @@ suite "FFI thread independence":
|
|||||||
setupCallbackData(rsp)
|
setupCallbackData(rsp)
|
||||||
|
|
||||||
withPool(ctx):
|
withPool(ctx):
|
||||||
discard addEventListener(
|
discard addEventListener(ctx[].eventRegistry, "latch", slowSleepCb, nil)
|
||||||
ctx[].eventRegistry, "latch", slowSleepCb, nil
|
|
||||||
)
|
|
||||||
|
|
||||||
check sendRequestToFFIThread(
|
check sendRequestToFFIThread(
|
||||||
ctx, EmitLatchEvent.ffiNewReq(captureCb, addr rsp, 0)
|
ctx, EmitLatchEvent.ffiNewReq(captureCb, addr rsp, 0)
|
||||||
@ -178,8 +175,7 @@ suite "FFI thread independence":
|
|||||||
# chronos's `Moment` — std/times exports a `milliseconds` that
|
# chronos's `Moment` — std/times exports a `milliseconds` that
|
||||||
# shadows chronos's at this generic-instantiation site.
|
# shadows chronos's at this generic-instantiation site.
|
||||||
let started = Moment.now()
|
let started = Moment.now()
|
||||||
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp))
|
check sendRequestToFFIThread(ctx, PingEvent.ffiNewReq(captureCb, addr rsp)).isOk()
|
||||||
.isOk()
|
|
||||||
waitCallback(rsp)
|
waitCallback(rsp)
|
||||||
let elapsed = Moment.now() - started
|
let elapsed = Moment.now() - started
|
||||||
|
|
||||||
@ -212,8 +208,7 @@ when not defined(gcRefc):
|
|||||||
# Wedge long enough to cross at least one tick boundary.
|
# Wedge long enough to cross at least one tick boundary.
|
||||||
gBlockingEnabled.store(true)
|
gBlockingEnabled.store(true)
|
||||||
let wedgeMs =
|
let wedgeMs =
|
||||||
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int +
|
(EventThreadTickInterval + FFIHeartbeatStaleThreshold).milliseconds.int + 1500
|
||||||
1500
|
|
||||||
check sendRequestToFFIThread(
|
check sendRequestToFFIThread(
|
||||||
ctx, BlockingRequest.ffiNewReq(captureCb, addr rsp, wedgeMs)
|
ctx, BlockingRequest.ffiNewReq(captureCb, addr rsp, wedgeMs)
|
||||||
)
|
)
|
||||||
@ -277,9 +272,7 @@ suite "queue overflow":
|
|||||||
setupCallbackData(rejected)
|
setupCallbackData(rejected)
|
||||||
|
|
||||||
withPool(ctx):
|
withPool(ctx):
|
||||||
discard addEventListener(
|
discard addEventListener(ctx[].eventRegistry, "latch", backpressureCb, addr bp)
|
||||||
ctx[].eventRegistry, "latch", backpressureCb, addr bp
|
|
||||||
)
|
|
||||||
discard addEventListener(
|
discard addEventListener(
|
||||||
ctx[].eventRegistry, NotRespondingEventName, captureCb, addr notif
|
ctx[].eventRegistry, NotRespondingEventName, captureCb, addr notif
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user