diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7248149a2..089be71fd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -147,17 +147,17 @@ test:shell: test:p2p:io-scheduler: <<: *test_definition script: - - jbuilder build @src/lib_p2p/runtest_p2p_io_scheduler + - jbuilder build @src/lib_p2p/runtest_p2p_io_scheduler_ipv4 test:p2p:socket: <<: *test_definition script: - - jbuilder build @src/lib_p2p/runtest_p2p_socket + - jbuilder build @src/lib_p2p/runtest_p2p_socket_ipv4 test:p2p:pool: <<: *test_definition script: - - jbuilder build @src/lib_p2p/runtest_p2p_pool + - jbuilder build @src/lib_p2p/runtest_p2p_pool_ipv4 test:proto_alpha: <<: *test_definition diff --git a/src/lib_p2p/test/jbuild b/src/lib_p2p/test/jbuild index 5e70df3ab..32771ab44 100644 --- a/src/lib_p2p/test/jbuild +++ b/src/lib_p2p/test/jbuild @@ -47,6 +47,25 @@ --max-download-speed 1048576 ;; 1 << 20 = 1MB )))) +(alias + ((name runtest_p2p_socket_ipv4) + (action (run ${exe:test_p2p_socket.exe} -v + --addr "::ffff:127.0.0.1")))) + +(alias + ((name runtest_p2p_pool_ipv4) + (action (run ${exe:test_p2p_pool.exe} --clients 10 --repeat 5 -v + --addr "::ffff:127.0.0.1")))) + +(alias + ((name runtest_p2p_io_scheduler_ipv4) + (action (run ${exe:test_p2p_io_scheduler.exe} + --delay 5 --clients 8 + --max-upload-speed 262144 ;; 1 << 18 = 256kB + --max-download-speed 1048576 ;; 1 << 20 = 1MB + --addr "::ffff:127.0.0.1" + )))) + (alias ((name runtest_p2p_ipv6set) (action (run ${exe:test_p2p_ipv6set.exe} -v)))) diff --git a/src/lib_p2p/test/test_p2p_socket.ml b/src/lib_p2p/test/test_p2p_socket.ml index a09e06514..24cbb56d6 100644 --- a/src/lib_p2p/test/test_p2p_socket.ml +++ b/src/lib_p2p/test/test_p2p_socket.ml @@ -25,7 +25,7 @@ include Logging.Make (struct let name = "test.p2p.connection" end) -let default_addr = Ipaddr.V6.localhost +let addr = ref Ipaddr.V6.localhost let proof_of_work_target = Crypto_box.make_target 16. let id1 = P2p_identity.generate proof_of_work_target @@ -86,7 +86,7 @@ let sync_nodes nodes = Lwt.return err let run_nodes client server = - listen default_addr >>= fun (main_socket, port) -> + listen !addr >>= fun (main_socket, port) -> Process.detach ~prefix:"server: " begin fun channel -> let sched = P2p_io_scheduler.create ~read_buffer_size:(1 lsl 12) () in server channel sched main_socket >>=? fun () -> @@ -96,7 +96,7 @@ let run_nodes client server = Process.detach ~prefix:"client: " begin fun channel -> Lwt_utils_unix.safe_close main_socket >>= fun () -> let sched = P2p_io_scheduler.create ~read_buffer_size:(1 lsl 12) () in - client channel sched default_addr port >>=? fun () -> + client channel sched !addr port >>=? fun () -> P2p_io_scheduler.shutdown sched >>= fun () -> return_unit end >>= fun client_node -> @@ -411,6 +411,9 @@ end let spec = Arg.[ + "--addr", String (fun p -> addr := Ipaddr.V6.of_string_exn p), + " Listening addr"; + "-v", Unit (fun () -> Lwt_log_core.(add_rule "test.p2p.connection" Info) ; Lwt_log_core.(add_rule "p2p.connection" Info)),