forked from mirage/mirage-tcpip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ml
68 lines (65 loc) · 2.74 KB
/
test.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(*
* Copyright (c) 2013 Thomas Gazagnaire <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
let suite = [
"checksums" , Test_checksums.suite ;
"ipv4" , Test_ipv4.suite ;
"ipv6" , Test_ipv6.suite ;
"icmpv4" , Test_icmpv4.suite ;
"udp" , Test_udp.suite ;
"tcp_window" , Test_tcp_window.suite ;
"tcp_options" , Test_tcp_options.suite ;
"mtu+tcp" , Test_mtus.suite ;
"rfc5961" , Test_rfc5961.suite ;
"socket" , Test_socket.suite ;
"connect" , Test_connect.suite ;
"connect_ipv6" , Test_connect_ipv6.suite ;
"deadlock" , Test_deadlock.suite ;
"iperf" , Test_iperf.suite ;
"iperf_ipv6" , Test_iperf_ipv6.suite ;
"keepalive" , Test_keepalive.suite ;
"simultaneous_close", Test_simulatenous_close.suite
]
let run test () =
Lwt_main.run (test ())
let () =
Printexc.record_backtrace true;
(* someone has to call Mirage_random_test.initialize () *)
Mirage_random_test.initialize ();
(* enable logging to stdout for all modules *)
Logs.set_reporter (Logs_fmt.reporter ());
Logs.set_level ~all:true (Some Logs.Debug);
(* Uncomment to enable tracing *)
(*let buffer = MProf_unix.mmap_buffer ~size:1000000 "trace.ctf" in
let trace_config = MProf.Trace.Control.make buffer MProf_unix.timestamper in
MProf.Trace.Control.start trace_config;*)
let suite = List.map (fun (n, s) ->
n, List.map (fun (d, s, f) -> d, s, run f) s
) suite
in
let filter ~name ~index =
(* Lwt_bytes (as of 5.5.0) on Windows doesn't support UDP. *)
let skip = [
3 (* no_leak_fds_in_udpv4 *);
5 (* no_leak_fds_in_udpv6 *);
7 (* no_leak_fds_in_udpv4v6 *);
9 (* no_leak_fds_in_udpv4v6_2 *);
11 (* no_leak_fds_in_udpv4v6_3 *);
13 (* no_leak_fds_in_udpv4v6_4 *);
15 (* no_leak_fds_in_udpv4v6_5 *);
] in
if Sys.win32 && name = "socket" && List.mem index skip then `Skip else `Run
in
Alcotest.run "tcpip" suite ~filter