Move C API tests out of root build dir into 'capitests' subdir.
[libguestfs.git] / src / generator.ml
index 99913a3..6741541 100755 (executable)
@@ -3717,10 +3717,7 @@ int main (int argc, char *argv[])
 
   guestfs_set_error_handler (g, print_error, NULL);
 
-  srcdir = getenv (\"srcdir\");
-  if (!srcdir) srcdir = \".\";
-  chdir (srcdir);
-  guestfs_set_path (g, \".\");
+  guestfs_set_path (g, \"../appliance\");
 
   filename = \"test1.img\";
   fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
@@ -4594,9 +4591,12 @@ and generate_fish_completion () =
 #ifdef HAVE_LIBREADLINE
 
 static const char *const commands[] = {
+  BUILTIN_COMMANDS_FOR_COMPLETION,
 ";
 
-  (* Get the commands and sort them, including the aliases. *)
+  (* Get the commands, including the aliases.  They don't need to be
+   * sorted - the generator() function just does a dumb linear search.
+   *)
   let commands =
     List.map (
       fun (name, _, _, flags, _, _, _) ->
@@ -4608,7 +4608,6 @@ static const char *const commands[] = {
        if name <> alias then [name2; alias] else [name2]
     ) all_functions in
   let commands = List.flatten commands in
-  let commands = List.sort compare commands in
 
   List.iter (pr "  \"%s\",\n") commands;
 
@@ -6490,11 +6489,16 @@ public class GuestFS {
          doc ^ "\n\n" ^ danger_will_robinson
        else doc in
       let doc = pod2text ~width:60 name doc in
+      let doc = List.map (             (* RHBZ#501883 *)
+       function
+       | "" -> "<p>"
+       | nonempty -> nonempty
+      ) doc in
       let doc = String.concat "\n   * " doc in
 
       pr "  /**\n";
       pr "   * %s\n" shortdesc;
-      pr "   *\n";
+      pr "   * <p>\n";
       pr "   * %s\n" doc;
       pr "   * @throws LibGuestFSException\n";
       pr "   */\n";
@@ -7175,7 +7179,7 @@ Run it from the top source directory using the command
   generate_daemon_actions ();
   close ();
 
-  let close = output_to "tests.c" in
+  let close = output_to "capitests/tests.c" in
   generate_tests ();
   close ();