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-20 22:03:02 +0000
commit802cb6068bfb03bf929537bb028987679af2ef41 (patch)
treee09af7433bbacd4f5fd81b4108980f0cc38c209b
parente4ddeb4e856466469fdd032e9c73a933dabfdd41 (diff)
downloadlibguestfs-802cb6068bfb03bf929537bb028987679af2ef41.tar.gz
libguestfs-802cb6068bfb03bf929537bb028987679af2ef41.tar.xz
libguestfs-802cb6068bfb03bf929537bb028987679af2ef41.zip
tests: Change code for printing warnings about untested functions.
Just code cleanup, no functional change. (cherry picked from commit 56c7967cadbd87ca922e02355f142f70744c1330)
-rw-r--r--generator/generator_tests_c_api.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/generator/generator_tests_c_api.ml b/generator/generator_tests_c_api.ml
index 555b1f57..fcce6e56 100644
--- a/generator/generator_tests_c_api.ml
+++ b/generator/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, _, _, _, _, _, _) ->
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";