From 2c2c9111e09ca8615f5628e596d9c0dabb466ec4 Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Mon, 19 Oct 2020 13:44:37 +0200 Subject: [PATCH 1/2] Clean tests --- tests/ping-pong/dune | 8 ++++---- tests/ping-pong/test_async.ml | 17 ----------------- tests/ping-pong/test_lwt.ml | 16 ---------------- tests/ping-pong/with_async.ml | 19 ------------------- tests/ping-pong/with_lwt.ml | 25 +------------------------ 5 files changed, 5 insertions(+), 80 deletions(-) diff --git a/tests/ping-pong/dune b/tests/ping-pong/dune index 9af60313..00426674 100644 --- a/tests/ping-pong/dune +++ b/tests/ping-pong/dune @@ -7,7 +7,7 @@ (name with_lwt) (modules with_lwt) (libraries common fmt.tty logs.fmt mirage-crypto-rng.unix conduit-lwt - conduit-lwt-tls conduit-lwt-ssl)) + conduit-lwt-tls)) (executable (name test_lwt) @@ -16,7 +16,7 @@ (rule (alias runtest) - (package conduit-lwt) + (package conduit-lwt-tls) (deps (:test test_lwt.exe) with_lwt.exe @@ -32,7 +32,7 @@ (name with_async) (modules with_async) (libraries common fmt.tty logs.fmt mirage-crypto-rng.unix conduit-async - conduit-async-tls conduit-async-ssl)) + conduit-async-tls)) (executable (name test_async) @@ -41,7 +41,7 @@ (rule (alias runtest) - (package conduit-async) + (package conduit-async-tls) (deps (:test test_async.exe) with_async.exe diff --git a/tests/ping-pong/test_async.ml b/tests/ping-pong/test_async.ml index 70aaff8d..a947ec4e 100644 --- a/tests/ping-pong/test_async.ml +++ b/tests/ping-pong/test_async.ml @@ -22,23 +22,6 @@ let () = res := !res && properly_exited status ; Format.printf ">>> with_async.exe: %a.\n%!" pp_process_status status ; - let pid = - Unix.create_process_env "./with_async.exe" - [| - "./with_async.exe"; - "--with-ssl"; - "server.pem"; - "server.key"; - "client0"; - "client1"; - "client2"; - |] - [||] Unix.stdin Unix.stdout Unix.stderr in - let _, status = Unix.waitpid [] pid in - res := !res && properly_exited status ; - Format.printf ">>> with_async.exe --with-ssl: %a.\n%!" pp_process_status - status ; - let pid = Unix.create_process_env "./with_async.exe" [| diff --git a/tests/ping-pong/test_lwt.ml b/tests/ping-pong/test_lwt.ml index c9019529..3b5e0ab9 100644 --- a/tests/ping-pong/test_lwt.ml +++ b/tests/ping-pong/test_lwt.ml @@ -22,22 +22,6 @@ let () = res := !res && properly_exited status ; Format.printf ">>> with_lwt.exe: %a.\n%!" pp_process_status status ; - let pid = - Unix.create_process_env "./with_lwt.exe" - [| - "./with_lwt.exe"; - "--with-ssl"; - "server.pem"; - "server.key"; - "client0"; - "client1"; - "client2"; - |] - [||] Unix.stdin Unix.stdout Unix.stderr in - let _, status = Unix.waitpid [] pid in - res := !res && properly_exited status ; - Format.printf ">>> with_lwt.exe --with-ssl: %a.\n%!" pp_process_status status ; - let pid = Unix.create_process_env "./with_lwt.exe" [| diff --git a/tests/ping-pong/with_async.ml b/tests/ping-pong/with_async.ml index a7d400aa..e9336296 100644 --- a/tests/ping-pong/with_async.ml +++ b/tests/ping-pong/with_async.ml @@ -1,6 +1,5 @@ open Rresult open Async -open Async_ssl let () = Mirage_crypto_rng_unix.initialize () @@ -25,10 +24,6 @@ let tcp_protocol, tcp_service = let open Conduit_async.TCP in (protocol, service) -let ssl_protocol, ssl_service = - let open Conduit_async_ssl.TCP in - (protocol, service) - let tls_protocol, tls_service = let open Conduit_async_tls.TCP in (protocol, service) @@ -37,12 +32,6 @@ let failwith fmt = Format.kasprintf (fun err -> raise (Failure err)) fmt let resolve_ping_pong = Conduit_async.TCP.resolve ~port:5000 -let resolve_ssl_ping_pong = - let context = - Conduit_async_ssl.context ~verify_modes:Ssl.Verify_mode.[ Verify_none ] () - in - Conduit_async_ssl.TCP.resolve ~port:7000 ~context - let resolve_tls_ping_pong = let null ~host:_ _ = Ok None in let config = Tls.Config.client ~authenticator:null () in @@ -50,7 +39,6 @@ let resolve_tls_ping_pong = let resolvers = Conduit.empty - |> Conduit_async.add ~priority:10 ssl_protocol resolve_ssl_ping_pong |> Conduit_async.add ~priority:10 tls_protocol resolve_tls_ping_pong |> Conduit_async.add ~priority:20 tcp_protocol resolve_ping_pong @@ -84,12 +72,6 @@ let run_with_tcp clients = (Conduit_async.TCP.Listen (None, Tcp.Where_to_listen.of_port 5000)) ~protocol:tcp_protocol ~service:tcp_service clients -let run_with_ssl cert key clients = - let ctx = Conduit_async_ssl.context ~crt_file:cert ~key_file:key () in - run_with - (ctx, Conduit_async.TCP.Listen (None, Tcp.Where_to_listen.of_port 7000)) - ~protocol:ssl_protocol ~service:ssl_service clients - let load_file filename = let open Stdlib in let ic = open_in filename in @@ -117,7 +99,6 @@ let run_with_tls cert key clients = let () = match Array.to_list Stdlib.Sys.argv with - | _ :: "--with-ssl" :: cert :: key :: clients -> run_with_ssl cert key clients | _ :: "--with-tls" :: cert :: key :: clients -> run_with_tls cert key clients | _ :: clients -> run_with_tcp clients | [] -> assert false diff --git a/tests/ping-pong/with_lwt.ml b/tests/ping-pong/with_lwt.ml index 0d82e73f..573d3a35 100644 --- a/tests/ping-pong/with_lwt.ml +++ b/tests/ping-pong/with_lwt.ml @@ -2,8 +2,6 @@ open Rresult let () = Printexc.record_backtrace true -let () = Ssl.init () - let failwith fmt = Fmt.kstrf (fun err -> Lwt.fail (Failure err)) fmt module Lwt = struct @@ -25,10 +23,6 @@ let tls_protocol, tls_service = let open Conduit_lwt_tls.TCP in (protocol, service) -let ssl_protocol, ssl_service = - let open Conduit_lwt_ssl.TCP in - (protocol, service) - (* Resolution *) let resolve_ping_pong = Conduit_lwt.TCP.resolve ~port:4000 @@ -38,15 +32,10 @@ let resolve_tls_ping_pong = let config = Tls.Config.client ~authenticator:null () in Conduit_lwt_tls.TCP.resolve ~port:8000 ~config -let resolve_ssl_ping_pong = - let context = Ssl.create_context Ssl.TLSv1_2 Ssl.Client_context in - Conduit_lwt_ssl.TCP.resolve ~port:6000 ~context ?verify:None - let resolvers = Conduit.empty |> Conduit_lwt.add ~priority:20 Conduit_lwt.TCP.protocol resolve_ping_pong |> Conduit_lwt.add ~priority:10 tls_protocol resolve_tls_ping_pong - |> Conduit_lwt.add ~priority:10 ssl_protocol resolve_ssl_ping_pong (* Run *) @@ -92,17 +81,6 @@ let run_with_tcp clients = } ~protocol:Conduit_lwt.TCP.protocol ~service:Conduit_lwt.TCP.service clients -let run_with_ssl cert key clients = - let ctx = Ssl.create_context Ssl.TLSv1_2 Ssl.Server_context in - Ssl.use_certificate ctx cert key ; - run_with - ( ctx, - { - Conduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 6000); - capacity = 40; - } ) - ~protocol:ssl_protocol ~service:ssl_service clients - let run_with_tls cert key clients = let ctx = config cert key in run_with @@ -116,6 +94,5 @@ let run_with_tls cert key clients = let () = match Array.to_list Sys.argv with | _ :: "--with-tls" :: cert :: key :: clients -> run_with_tls cert key clients - | _ :: "--with-ssl" :: cert :: key :: clients -> run_with_ssl cert key clients | _ :: clients -> run_with_tcp clients - | _ -> Fmt.epr "%s [--with-tls|--with-ssl] filename...\n%!" Sys.argv.(0) + | _ -> Fmt.epr "%s [--with-tls] filename...\n%!" Sys.argv.(0) From 8273960d724e53808c384746091bbd2a6c218b85 Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Mon, 19 Oct 2020 13:45:22 +0200 Subject: [PATCH 2/2] Lint OPAM files --- conduit-async.opam | 2 -- conduit-lwt.opam | 2 -- 2 files changed, 4 deletions(-) diff --git a/conduit-async.opam b/conduit-async.opam index 1fe84238..14eb7c04 100644 --- a/conduit-async.opam +++ b/conduit-async.opam @@ -32,6 +32,4 @@ depends: [ "ke" {with-test} "fmt" {with-test} "rresult" {with-test} - "conduit-async-tls" {with-test & post} - "conduit-async-ssl" {with-test & post} ] diff --git a/conduit-lwt.opam b/conduit-lwt.opam index 85111987..2cbce14d 100644 --- a/conduit-lwt.opam +++ b/conduit-lwt.opam @@ -32,6 +32,4 @@ depends: [ "ke" {with-test} "fmt" {with-test} "rresult" {with-test} - "conduit-lwt-tls" {with-test & post} - "conduit-lwt-ssl" {with-test & post} ]