From 59bcfa27714ae8fc1cda61152b878624ac0b9d4d Mon Sep 17 00:00:00 2001 From: Anthony Onah Date: Wed, 20 Nov 2024 16:11:20 +0100 Subject: [PATCH] Add Skipping feature --- lib_eio_linux/tests/test.ml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib_eio_linux/tests/test.ml b/lib_eio_linux/tests/test.ml index 387c0b27..010f7b62 100644 --- a/lib_eio_linux/tests/test.ml +++ b/lib_eio_linux/tests/test.ml @@ -1,7 +1,3 @@ -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 = @@ -9,7 +5,7 @@ let skip_io_uring msg = Alcotest.skip () let handle_fallback = function - | `Msg msg -> + | Msg msg -> Eio.traceln "Fallback triggered with message: %s" msg; skip_io_uring msg @@ -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 @@ -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 @@ -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 ->