summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-05-17 15:50:16 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-05-17 17:05:12 +0100
commitb43482964a8c7e19f47943506872cd58601c28e9 (patch)
treedcf8d3cb64da5d2243258c0f603d31b340a1724a /generator
parent34acb80a28d1b48e734883a32f7f3344dc216ec0 (diff)
downloadlibguestfs-b43482964a8c7e19f47943506872cd58601c28e9.tar.gz
libguestfs-b43482964a8c7e19f47943506872cd58601c28e9.tar.xz
libguestfs-b43482964a8c7e19f47943506872cd58601c28e9.zip
generator: Check the flags fields.
Diffstat (limited to 'generator')
-rw-r--r--generator/generator_checks.ml32
1 files changed, 32 insertions, 0 deletions
diff --git a/generator/generator_checks.ml b/generator/generator_checks.ml
index 0fb8ea42..8ee06b59 100644
--- a/generator/generator_checks.ml
+++ b/generator/generator_checks.ml
@@ -188,6 +188,38 @@ let () =
in
loop proc_nrs;
+ (* Check flags. *)
+ List.iter (
+ fun (name, _, _, flags, _, _, _) ->
+ List.iter (
+ function
+ | ProtocolLimitWarning
+ | DangerWillRobinson
+ | FishOutput _
+ | NotInFish
+ | NotInDocs
+ | Progress -> ()
+ | FishAlias n ->
+ if contains_uppercase n then
+ failwithf "%s: guestfish alias %s should not contain uppercase chars" name n;
+ if String.contains n '_' then
+ failwithf "%s: guestfish alias %s should not contain '_'" name n
+ | DeprecatedBy n ->
+ (* 'n' must be a cross-ref to the name of another action. *)
+ if not (List.exists (
+ function
+ | (n', _, _, _, _, _, _) when n = n' -> true
+ | _ -> false
+ ) all_functions) then
+ failwithf "%s: DeprecatedBy flag must be cross-reference to another action" name
+ | Optional n ->
+ if contains_uppercase n then
+ failwithf "%s: Optional group name %s should not contain uppercase chars" name n;
+ if String.contains n '-' || String.contains n '_' then
+ failwithf "%s: Optional group name %s should not contain '-' or '_'" name n
+ ) flags
+ ) (all_functions @ fish_commands);
+
(* Check tests. *)
List.iter (
function