tests: Change code for printing warnings about untested functions.

Just code cleanup, no functional change.
(cherry picked from commit 56c7967cad)
This commit is contained in:
Richard W.M. Jones
2012-11-09 20:19:30 +00:00
parent e4ddeb4e85
commit 802cb6068b

View File

@@ -135,8 +135,11 @@ get_key (char **hash, const char *key)
";
(* Generate a list of commands which are not tested anywhere. *)
pr "static void no_test_warnings (void)\n";
pr "static void\n";
pr "no_test_warnings (void)\n";
pr "{\n";
pr " size_t i;\n";
pr " const char *no_tests[] = {\n";
let hash : (string, bool) Hashtbl.t = Hashtbl.create 13 in
List.iter (
@@ -154,9 +157,15 @@ get_key (char **hash, const char *key)
List.iter (
fun (name, _, _, _, _, _, _) ->
if not (Hashtbl.mem hash name) then
pr " fprintf (stderr, \"warning: \\\"guestfs_%s\\\" has no tests\\n\");\n" name
) all_functions;
pr " \"%s\",\n" name
) all_functions_sorted;
pr " NULL\n";
pr " };\n";
pr "\n";
pr " for (i = 0; no_tests[i] != NULL; ++i)\n";
pr " fprintf (stderr, \"warning: \\\"guestfs_%%s\\\" has no tests\\n\",\n";
pr " no_tests[i]);\n";
pr "}\n";
pr "\n";