From b5c6f6cb2f9f1ba8161c86fcb4196e9cfc78e05c Mon Sep 17 00:00:00 2001 From: OCamlPro-Iguernlala Date: Fri, 14 Apr 2017 12:57:34 +0200 Subject: [PATCH] test_p2p_connection: put more deterministic garbled data --- test/p2p/test_p2p_connection.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/p2p/test_p2p_connection.ml b/test/p2p/test_p2p_connection.ml index 86421ceaf..3985ca683 100644 --- a/test/p2p/test_p2p_connection.ml +++ b/test/p2p/test_p2p_connection.ml @@ -287,9 +287,19 @@ end module Garbled_data = struct - let encoding = Data_encoding.bytes + let encoding = + let open Data_encoding in + dynamic_size @@ option @@ string - let garbled_msg = MBytes.create (1 lsl 4) + (* generate a fixed garbled_msg to avoid 'Data_encoding.Binary.Await + _', which blocks 'make test' *) + let garbled_msg = + let buf = MBytes.create (1 lsl 4) in + MBytes.set_int32 buf 0 (Int32.of_int 4); + MBytes.set_int32 buf 4 (Int32.of_int (-1)); + MBytes.set_int32 buf 8 (Int32.of_int (-1)); + MBytes.set_int32 buf 12 (Int32.of_int (-1)); + buf let server _ch sched socket = accept sched socket >>=? fun (_info, auth_fd) ->