···213213214214let test_alloc_fixed_or_wait () =
215215 Eio_linux.run ~n_blocks:1 @@ fun _env ->
216216- let block = Eio_linux.Low_level.alloc_fixed_or_wait () in
217217- (* We have to wait for the block, but get cancelled while waiting. *)
218218- begin
219219- try
220220- Fiber.both
221221- (fun () -> ignore (Eio_linux.Low_level.alloc_fixed_or_wait () : Uring.Region.chunk))
222222- (fun () -> raise Exit);
223223- with Exit -> ()
224224- end;
225225- (* We have to wait for the block, and get it when the old one is freed. *)
226226- Fiber.both
227227- (fun () ->
228228- let x = Eio_linux.Low_level.alloc_fixed_or_wait () in
229229- Eio_linux.Low_level.free_fixed x
230230- )
231231- (fun () ->
232232- Eio_linux.Low_level.free_fixed block
233233- );
234234- (* The old block is passed to the waiting fiber, but it's cancelled. *)
235235- let block = Eio_linux.Low_level.alloc_fixed_or_wait () in
236236- Fiber.both
237237- (fun () ->
238238- Fiber.first
239239- (fun () -> ignore (Eio_linux.Low_level.alloc_fixed_or_wait ()); assert false)
240240- (fun () -> ())
241241- )
242242- (fun () -> Eio_linux.Low_level.free_fixed block);
243243- let block = Eio_linux.Low_level.alloc_fixed_or_wait () in
244244- Eio_linux.Low_level.free_fixed block
216216+ match Eio_linux.Low_level.alloc_fixed_or_wait () with
217217+ | exception (Failure "No fixed buffer available") [@warning "-52"] -> Alcotest.skip ()
218218+ | block ->
219219+ (* We have to wait for the block, but get cancelled while waiting. *)
220220+ begin
221221+ try
222222+ Fiber.both
223223+ (fun () -> ignore (Eio_linux.Low_level.alloc_fixed_or_wait () : Uring.Region.chunk))
224224+ (fun () -> raise Exit);
225225+ with Exit -> ()
226226+ end;
227227+ (* We have to wait for the block, and get it when the old one is freed. *)
228228+ Fiber.both
229229+ (fun () ->
230230+ let x = Eio_linux.Low_level.alloc_fixed_or_wait () in
231231+ Eio_linux.Low_level.free_fixed x
232232+ )
233233+ (fun () ->
234234+ Eio_linux.Low_level.free_fixed block
235235+ );
236236+ (* The old block is passed to the waiting fiber, but it's cancelled. *)
237237+ let block = Eio_linux.Low_level.alloc_fixed_or_wait () in
238238+ Fiber.both
239239+ (fun () ->
240240+ Fiber.first
241241+ (fun () -> ignore (Eio_linux.Low_level.alloc_fixed_or_wait ()); assert false)
242242+ (fun () -> ())
243243+ )
244244+ (fun () -> Eio_linux.Low_level.free_fixed block);
245245+ let block = Eio_linux.Low_level.alloc_fixed_or_wait () in
246246+ Eio_linux.Low_level.free_fixed block
245247246248let () =
247249 let open Alcotest in