diff --git a/.ocamlformat b/.ocamlformat new file mode 100644 index 000000000..2e686658c --- /dev/null +++ b/.ocamlformat @@ -0,0 +1,2 @@ +version = 0.15.0 +disable = true diff --git a/dune-project b/dune-project index 6a4a87f19..6d722c804 100644 --- a/dune-project +++ b/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.0) +(lang dune 2.7) (name tcpip) diff --git a/examples/ping/dune b/examples/ping/dune index 16813355d..2c9ccbb2c 100644 --- a/examples/ping/dune +++ b/examples/ping/dune @@ -1,3 +1,3 @@ (executables (names ping) - (libraries cmdliner logs logs.fmt tcpip.icmpv4-socket)) + (libraries cmdliner logs logs.fmt tcpip.icmpv4-socket tcpip.unix)) diff --git a/src/icmp/dune b/src/icmp/dune index e44427007..ba3f02e0f 100644 --- a/src/icmp/dune +++ b/src/icmp/dune @@ -1,6 +1,9 @@ (library (name tcpip_icmpv4) (public_name tcpip.icmpv4) + (instrumentation + (backend bisect_ppx)) (libraries mirage-protocols rresult logs tcpip mirage-profile tcpip.udp) - (preprocess (pps ppx_cstruct)) + (preprocess + (pps ppx_cstruct)) (wrapped false)) diff --git a/src/ipv4/dune b/src/ipv4/dune index b59bf9cb7..8d6838118 100644 --- a/src/ipv4/dune +++ b/src/ipv4/dune @@ -1,7 +1,10 @@ (library (name tcpip_ipv4) (public_name tcpip.ipv4) - (libraries logs mirage-protocols ipaddr cstruct rresult tcpip - tcpip.udp mirage-random mirage-clock randomconv lru) - (preprocess (pps ppx_cstruct)) + (instrumentation + (backend bisect_ppx)) + (libraries logs mirage-protocols ipaddr cstruct rresult tcpip tcpip.udp + mirage-random mirage-clock randomconv lru) + (preprocess + (pps ppx_cstruct)) (wrapped false)) diff --git a/src/ipv6/dune b/src/ipv6/dune index 28b467d80..11817c413 100644 --- a/src/ipv6/dune +++ b/src/ipv6/dune @@ -1,8 +1,11 @@ (library (name tcpip_ipv6) (public_name tcpip.ipv6) + (instrumentation + (backend bisect_ppx)) (libraries logs mirage-protocols mirage-time mirage-net macaddr-cstruct mirage-clock duration ipaddr cstruct rresult mirage-random tcpip randomconv ethernet) - (preprocess (pps ppx_cstruct)) + (preprocess + (pps ppx_cstruct)) (wrapped false)) diff --git a/src/stack-direct/dune b/src/stack-direct/dune index f6dbf7163..884fd6789 100644 --- a/src/stack-direct/dune +++ b/src/stack-direct/dune @@ -1,5 +1,7 @@ (library (name tcpip_stack_direct) (public_name tcpip.stack-direct) - (libraries logs ipaddr lwt fmt mirage-time mirage-random - mirage-protocols mirage-stack mirage-net ethernet)) + (instrumentation + (backend bisect_ppx)) + (libraries logs ipaddr lwt fmt mirage-time mirage-random mirage-protocols + mirage-stack mirage-net ethernet)) diff --git a/src/stack-unix/dune b/src/stack-unix/dune index f1dc1e1e8..a3b111376 100644 --- a/src/stack-unix/dune +++ b/src/stack-unix/dune @@ -3,14 +3,18 @@ (public_name tcpip.icmpv4-socket) (modules icmpv4_socket) (wrapped false) - (libraries lwt.unix ipaddr.unix cstruct-lwt tcpip.icmpv4 - tcpip.ipv4 tcpip.ipv6 mirage-protocols)) + (instrumentation + (backend bisect_ppx)) + (libraries lwt.unix ipaddr.unix cstruct-lwt tcpip.icmpv4 tcpip.ipv4 + tcpip.ipv6 mirage-protocols)) (library (name udpv4_socket) (public_name tcpip.udpv4-socket) (modules udpv4_socket) (wrapped false) + (instrumentation + (backend bisect_ppx)) (libraries lwt.unix ipaddr.unix cstruct-lwt fmt mirage-protocols)) (library @@ -18,14 +22,21 @@ (public_name tcpip.udpv6-socket) (modules udpv6_socket) (wrapped false) + (instrumentation + (backend bisect_ppx)) (libraries lwt.unix ipaddr.unix cstruct-lwt fmt mirage-protocols)) (library (name tcp_socket_options) (public_name tcpip.tcp_socket_options) (modules tcp_socket_options) - (c_names tcp_socket_options_stubs) + (foreign_stubs + (language c) + (names tcp_socket_options_stubs) + (flags :standard)) (wrapped false) + (instrumentation + (backend bisect_ppx)) (libraries lwt.unix duration)) (library @@ -33,6 +44,8 @@ (public_name tcpip.tcpv4-socket) (modules tcpv4_socket tcp_socket) (wrapped false) + (instrumentation + (backend bisect_ppx)) (libraries lwt.unix ipaddr.unix cstruct-lwt fmt mirage-protocols tcp_socket_options)) @@ -41,6 +54,8 @@ (public_name tcpip.tcpv6-socket) (modules tcpv6_socket) (wrapped false) + (instrumentation + (backend bisect_ppx)) (libraries lwt.unix ipaddr.unix cstruct-lwt fmt mirage-protocols tcpv4_socket tcp_socket_options)) @@ -49,6 +64,8 @@ (public_name tcpip.stack-socket) (modules tcpip_stack_socket ipv4_socket ipv6_socket) (wrapped false) - (libraries lwt.unix cstruct-lwt ipaddr.unix logs - tcpip.tcpv4-socket tcpip.udpv4-socket tcpip.ipv4 tcpip.ipv6 tcpip.icmpv4 - mirage-protocols mirage-stack)) + (instrumentation + (backend bisect_ppx)) + (libraries lwt.unix cstruct-lwt ipaddr.unix logs tcpip.tcpv4-socket + tcpip.udpv4-socket tcpip.ipv4 tcpip.ipv6 tcpip.icmpv4 mirage-protocols + mirage-stack)) diff --git a/src/tcp/dune b/src/tcp/dune index 997de9caf..0765f2dbf 100644 --- a/src/tcp/dune +++ b/src/tcp/dune @@ -1,7 +1,10 @@ (library (name tcp) (public_name tcpip.tcp) + (instrumentation + (backend bisect_ppx)) (libraries logs mirage-protocols ipaddr cstruct lwt-dllist rresult - mirage-profile tcpip duration randomconv fmt mirage-time - mirage-clock mirage-random) - (preprocess (pps ppx_cstruct))) + mirage-profile tcpip duration randomconv fmt mirage-time mirage-clock + mirage-random) + (preprocess + (pps ppx_cstruct))) diff --git a/src/tcpip_checksum/dune b/src/tcpip_checksum/dune index 8c28b96cf..3779e54aa 100644 --- a/src/tcpip_checksum/dune +++ b/src/tcpip_checksum/dune @@ -2,6 +2,8 @@ (name tcpip) (public_name tcpip) (modules tcpip_checksum) + (instrumentation + (backend bisect_ppx)) (libraries cstruct) (wrapped false)) @@ -9,5 +11,10 @@ (name tcpip_unix) (public_name tcpip.unix) (modules tcpip_unix) - (c_names checksum_stubs) + (instrumentation + (backend bisect_ppx)) + (foreign_stubs + (language c) + (names checksum_stubs) + (flags :standard)) (wrapped false)) diff --git a/src/udp/dune b/src/udp/dune index 8ed39f677..05b926d90 100644 --- a/src/udp/dune +++ b/src/udp/dune @@ -1,6 +1,9 @@ (library (name tcpip_udpv4) (public_name tcpip.udp) + (instrumentation + (backend bisect_ppx)) (libraries mirage-protocols mirage-random rresult logs tcpip randomconv) - (preprocess (pps ppx_cstruct)) + (preprocess + (pps ppx_cstruct)) (wrapped false)) diff --git a/tcpip.opam b/tcpip.opam index eaf0d008d..4b5dd68e8 100644 --- a/tcpip.opam +++ b/tcpip.opam @@ -19,7 +19,8 @@ build: [ ] conflicts: [ "mirage-xen" {< "6.0.0"} ] depends: [ - "dune" + "dune" {>= "2.7.0"} + "bisect_ppx" {dev & >= "2.5.0"} "ocaml" {>= "4.06.0"} "rresult" {>= "0.5.0"} "cstruct" {>= "3.2.0"} @@ -28,7 +29,7 @@ depends: [ "mirage-clock" {>= "3.0.0"} "mirage-random" {>= "2.0.0"} "mirage-stack" {>= "2.1.0"} - "mirage-protocols" {>= "4.0.0"} + "mirage-protocols" {>= "4.0.0" & < "5.0.0"} "mirage-time" {>= "2.0.0"} "ipaddr" {>= "5.0.0"} "macaddr" {>="4.0.0"} diff --git a/test/dune b/test/dune index 8aa4ca180..00275c7d3 100644 --- a/test/dune +++ b/test/dune @@ -1,16 +1,10 @@ -(executables - (names test) - (libraries alcotest mirage-random-test lwt.unix logs - logs.fmt mirage-profile mirage-flow mirage-vnetif mirage-clock-unix - pcap-format duration mirage-random rresult mirage-protocols - mirage-stack arp arp-mirage ethernet tcpip.ipv4 tcpip.tcp tcpip.udp - tcpip.stack-direct tcpip.icmpv4 tcpip.udpv4-socket tcpip.tcpv4-socket - tcpip.icmpv4-socket tcpip.stack-socket tcpip.ipv6 ipaddr-cstruct - macaddr-cstruct tcpip.unix)) - -(alias - (name runtest) - (deps - (:< test.exe)) +(test + (name test) + (libraries alcotest mirage-random-test lwt.unix logs logs.fmt mirage-profile + mirage-flow mirage-vnetif mirage-clock-unix pcap-format duration + mirage-random rresult mirage-protocols mirage-stack arp arp-mirage + ethernet tcpip.ipv4 tcpip.tcp tcpip.udp tcpip.stack-direct tcpip.icmpv4 + tcpip.udpv4-socket tcpip.tcpv4-socket tcpip.icmpv4-socket + tcpip.stack-socket tcpip.ipv6 ipaddr-cstruct macaddr-cstruct tcpip.unix) (action - (run %{<} -q -e --color=always))) + (run %{test} -q -e --color=always))) diff --git a/test/test_iperf.ml b/test/test_iperf.ml index 5f92d1f17..230cb0c3c 100644 --- a/test/test_iperf.ml +++ b/test/test_iperf.ml @@ -252,7 +252,7 @@ let suite = [ test_tcp_iperf_two_stacks_uniform_packet_loss amt_quick 120.0; "iperf with two stacks and uniform packet loss of packets with no payload", `Quick, - test_tcp_iperf_two_stacks_uniform_packet_loss_no_payload amt_quick 120.0; + test_tcp_iperf_two_stacks_uniform_packet_loss_no_payload amt_quick 240.0; "iperf with two stacks and uniform packet loss of packets with no payload, longer", `Slow, test_tcp_iperf_two_stacks_uniform_packet_loss_no_payload amt_slow 240.0; diff --git a/test/test_iperf_ipv6.ml b/test/test_iperf_ipv6.ml index a4572dd08..aa1099bb6 100644 --- a/test/test_iperf_ipv6.ml +++ b/test/test_iperf_ipv6.ml @@ -250,8 +250,8 @@ let suite = [ "iperf with two stacks and uniform packet loss", `Quick, test_tcp_iperf_ipv6_two_stacks_uniform_packet_loss amt_quick 120.0; - "iperf with two stacks and uniform packet loss of packets with no payload", `Quick, - test_tcp_iperf_ipv6_two_stacks_uniform_packet_loss_no_payload amt_quick 120.0; + "iperf with two stacks and uniform packet loss of packets with no payload", `Slow, + test_tcp_iperf_ipv6_two_stacks_uniform_packet_loss_no_payload amt_quick 240.0; "iperf with two stacks and uniform packet loss of packets with no payload, longer", `Slow, test_tcp_iperf_ipv6_two_stacks_uniform_packet_loss_no_payload amt_slow 240.0;