summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-09 20:19:30 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-09 20:19:30 +0000
commit56c7967cadbd87ca922e02355f142f70744c1330 (patch)
tree5ee679347ca2dcae9169ae7f4a49c138341cb7bd
parent04a8cffee7d93bd7fc82f7cf9ef16db75933a273 (diff)
downloadlibguestfs-56c7967cadbd87ca922e02355f142f70744c1330.tar.gz
libguestfs-56c7967cadbd87ca922e02355f142f70744c1330.tar.xz
libguestfs-56c7967cadbd87ca922e02355f142f70744c1330.zip
tests: Change code for printing warnings about untested functions.
Just code cleanup, no functional change.
-rw-r--r--generator/tests_c_api.ml15
1 files 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";