Skip to content

Commit

Permalink
Add Skipping feature
Browse files Browse the repository at this point in the history
  • Loading branch information
create2000 committed Nov 20, 2024
1 parent 5637e21 commit 59bcfa2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib_eio_linux/tests/test.ml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
exception Skip_test of string
let skip _stdenv =
raise (Skip_test "io_uring not available in Docker")

open Eio.Std

let skip_io_uring msg =
Eio.traceln "Skipping test: %s" msg;
Alcotest.skip ()

let handle_fallback = function
| `Msg msg ->
| Msg msg ->
Eio.traceln "Fallback triggered with message: %s" msg;
skip_io_uring msg

Expand All @@ -33,7 +29,7 @@ let read_one_byte ~sw r =
)

let test_poll_add () =
Eio_linux.run @@ fun _stdenv ->
Eio_linux.run ~fallback:handle_fallback @@ fun _stdenv ->
Switch.run @@ fun sw ->
let r, w = Eio_unix.pipe sw in
let thread = read_one_byte ~sw r in
Expand All @@ -46,9 +42,9 @@ let test_poll_add () =
assert (sent = 1);
let result = Promise.await_exn thread in
Alcotest.(check string) "Received data" "!" result
)

let test_poll_add_busy () =
Eio_linux.run ~queue_depth:2 @@ fun _stdenv ->
Eio_linux.run ~queue_depth:2 ~fallback:handle_fallback @@ fun _stdenv ->
Switch.run @@ fun sw ->
let r, w = Eio_unix.pipe sw in
let a = read_one_byte ~sw r in
Expand All @@ -64,7 +60,7 @@ let test_poll_add_busy () =
Alcotest.(check string) "Received data" "!" a;
let b = Promise.await_exn b in
Alcotest.(check string) "Received data" "!" b
)

(* Write a string to a pipe and read it out again. *)
let test_copy () =
Eio_linux.run ~queue_depth:3 @@ fun _stdenv ->
Expand Down

0 comments on commit 59bcfa2

Please sign in to comment.