Skip to content

Commit ad7696a

Browse files
authored
Merge pull request #222 from mseri/fixups
Backport of fixups made while porting idl to the new rpclib/rpclib-legacy packages
2 parents 84b5bf5 + 67d9515 commit ad7696a

File tree

5 files changed

+58
-28
lines changed

5 files changed

+58
-28
lines changed

rrd/jbuild

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
5050
rrd
5151
threads
5252
xcp
53-
xcp_rrd_interface_types))
53+
xcp.rrd.interface.types))
5454
(wrapped false)
5555
%s))
5656

@@ -64,7 +64,7 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
6464
rrd
6565
threads
6666
xcp
67-
xcp_rrd_interface))
67+
xcp.rrd.interface))
6868
(wrapped false)
6969
%s))
7070

storage/jbuild

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,21 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
5050
threads
5151
xapi-stdext-date
5252
xcp
53-
xcp_storage_interface_types))
53+
xcp.storage.interface.types))
5454
(wrapped false)
5555
%s))
5656

5757
(library
5858
((name xcp_storage)
5959
(public_name xcp.storage)
6060
(flags (:standard -w -39 %s))
61-
(modules (:standard \ storage_interface storage_test vdi_automaton))
61+
(modules (:standard \ storage_interface storage_test vdi_automaton vdi_automaton_test))
6262
(libraries
6363
(rpclib
6464
threads
6565
xapi-stdext-date
6666
xcp
67-
xcp_storage_interface
68-
xcp_storage_interface_types))
67+
xcp.storage.interface))
6968
(wrapped false)
7069
%s))
7170

@@ -77,6 +76,19 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
7776
(cmdliner
7877
oUnit
7978
xcp
80-
xcp_storage))
79+
xcp.storage))
8180
%s))
81+
82+
(executable
83+
((name vdi_automaton_test)
84+
(flags (:standard -w -39))
85+
(modules (vdi_automaton_test))
86+
(libraries
87+
(xcp.storage.interface.types))))
88+
89+
(alias
90+
((name runtest)
91+
(deps (vdi_automaton_test.exe))
92+
(action (run ${<}))))
93+
8294
|} (flags rewriters_ppx) coverage_rewriter (flags rewriters_camlp4) coverage_rewriter (flags rewriters_ppx) coverage_rewriter (flags rewriters_ppx) coverage_rewriter

storage/vdi_automaton.ml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,3 @@ let ( - ) x y = match x, y with
119119
| Attached RW, Activated RW -> [ Activate, Attached RW ]
120120
| _, _ -> raise (No_operation (x, y))
121121

122-
(* For any state [s] and operation [o] where [s' = s + o],
123-
[if s <> s' then s - s' = op] *)
124-
125-
let all_pairs x y =
126-
List.fold_left (fun acc x -> List.map (fun y -> x, y) y @ acc) [] x
127-
128-
let test () =
129-
List.iter
130-
(fun (s, op) ->
131-
try
132-
let s' = s + op in
133-
let op' = List.map fst (s - s') in
134-
if s <> s' && [ op ] <> op'
135-
then failwith (Printf.sprintf "s = %s; op = %s; s + op = %s; s - (s + op) = %s"
136-
(string_of_state s) (string_of_op op)
137-
(string_of_state s')
138-
(String.concat ", " (List.map string_of_op op')))
139-
with Bad_transition(_, _) -> ()
140-
) (all_pairs every_state every_op)

storage/vdi_automaton_test.ml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(*
2+
* Copyright Citrix Systems Inc.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published
6+
* by the Free Software Foundation; version 2.1 only. with the special
7+
* exception on linking described in file LICENSE.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*)
14+
15+
(* For any state [s] and operation [o] where [s' = s + o],
16+
[if s <> s' then s - s' = op] *)
17+
18+
let all_pairs x y =
19+
List.fold_left (fun acc x -> List.map (fun y -> x, y) y @ acc) [] x
20+
21+
let () =
22+
List.iter
23+
(fun (s, op) ->
24+
try
25+
let s' = Vdi_automaton.(s + op) in
26+
let op' = List.map fst Vdi_automaton.(s - s') in
27+
if s <> s' && [ op ] <> op' then
28+
failwith Vdi_automaton.(
29+
Printf.sprintf "s = %s; op = %s; s + op = %s; s - (s + op) = %s"
30+
(string_of_state s)
31+
(string_of_op op)
32+
(string_of_state s')
33+
(String.concat ", " (List.map string_of_op op')))
34+
with Vdi_automaton.Bad_transition(_, _) -> ()
35+
) (all_pairs every_state every_op);
36+
Printf.printf "Passed."
37+

xen/jbuild

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
5050
(rpclib
5151
threads
5252
xcp
53-
xcp_xen_interface_types))
53+
xcp.xen.interface.types))
5454
(wrapped false)
5555
%s))
5656

@@ -63,7 +63,7 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
6363
(rpclib
6464
threads
6565
xcp
66-
xcp_xen_interface))
66+
xcp.xen.interface))
6767
(wrapped false)
6868
%s))
6969
|} (flags rewriters_ppx) coverage_rewriter (flags rewriters_camlp4) coverage_rewriter (flags rewriters_ppx) coverage_rewriter

0 commit comments

Comments
 (0)