|
| 1 | +(* |
| 2 | + * Copyright (C) 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 | +open OUnit |
| 16 | +open Test_highlevel |
| 17 | +open Features |
| 18 | + |
| 19 | +module OfAssocList = Generic.Make(struct |
| 20 | + module Io = struct |
| 21 | + type input_t = (string * string) list |
| 22 | + type output_t = Features.feature list |
| 23 | + |
| 24 | + let string_of_input_t = Test_printers.(assoc_list string string) |
| 25 | + let string_of_output_t = |
| 26 | + Test_printers.(fun features -> String.concat "," (List.map name_of_feature features)) |
| 27 | + end |
| 28 | + |
| 29 | + let transform = of_assoc_list |
| 30 | + |
| 31 | + (* Xen_motion and AD are enabled unless explicitly disabled. All other features |
| 32 | + are disabled unless explitly enabled. *) |
| 33 | + let tests = [ |
| 34 | + [], |
| 35 | + [Xen_motion; AD]; |
| 36 | + |
| 37 | + ["restrict_xen_motion", "true"; |
| 38 | + "restrict_ad", "true"], |
| 39 | + []; |
| 40 | + |
| 41 | + ["restrict_xen_motion", "true"], |
| 42 | + [AD]; |
| 43 | + |
| 44 | + ["restrict_xen_motion", "false"], |
| 45 | + [Xen_motion; AD]; |
| 46 | + |
| 47 | + ["restrict_xen_motion", "false"; |
| 48 | + "restrict_dmc", "false"], |
| 49 | + [DMC; Xen_motion; AD]; |
| 50 | + |
| 51 | + ["restrict_xen_motion", "false"; |
| 52 | + "restrict_ad", "true"; |
| 53 | + "restrict_dmc", "false"], |
| 54 | + [DMC; Xen_motion]; |
| 55 | + |
| 56 | + ["enable_xha", "true"; |
| 57 | + "restrict_xen_motion", "true"], |
| 58 | + [HA; AD]; |
| 59 | + ] |
| 60 | +end) |
| 61 | + |
| 62 | + |
| 63 | +let test = |
| 64 | + "pool_license" >::: |
| 65 | + [ |
| 66 | + "test_of_assoc_list" >::: OfAssocList.tests; |
| 67 | + ] |
0 commit comments