From 56c7967cadbd87ca922e02355f142f70744c1330 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 9 Nov 2012 20:19:30 +0000 Subject: tests: Change code for printing warnings about untested functions. Just code cleanup, no functional change. --- generator/tests_c_api.ml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml index 035b77f6..e1f408bb 100644 --- a/generator/tests_c_api.ml +++ b/generator/tests_c_api.ml @@ -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 = 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"; -- cgit