mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
generator: Stablise output of common/protocol/*, daemon/*, lib/* and tests/c-api/tests.c
Sort the functions so the output is stable. This changes the order in which the C API tests run. Previously we ran the newest tests first, which was useful when we were frequently adding new APIs. Now we run them in sorted order.
This commit is contained in:
@@ -170,7 +170,7 @@ let generate_xdr () =
|
||||
pr " opaque %s<>;\n" n;
|
||||
pr "};\n\n"
|
||||
);
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
|
||||
pr "/* Table of procedure numbers. */\n";
|
||||
pr "enum guestfs_procedure {\n";
|
||||
@@ -183,7 +183,7 @@ let generate_xdr () =
|
||||
pr " GUESTFS_PROC_%s = %d,\n" (String.uppercase_ascii shortname) proc_nr;
|
||||
loop rest
|
||||
in
|
||||
loop (actions |> daemon_functions);
|
||||
loop (actions |> daemon_functions |> sort);
|
||||
pr "};\n";
|
||||
pr "\n";
|
||||
|
||||
|
||||
@@ -787,7 +787,7 @@ and generate_internal_actions_h () =
|
||||
generate_prototype ~single_line:true ~newline:true ~handle:"g"
|
||||
~prefix:"guestfs_impl_" ~optarg_proto:Argv
|
||||
c_name style
|
||||
) (actions |> non_daemon_functions);
|
||||
) (actions |> non_daemon_functions |> sort);
|
||||
|
||||
pr "\n";
|
||||
pr "#endif /* GUESTFS_INTERNAL_ACTIONS_H_ */\n"
|
||||
@@ -1777,7 +1777,7 @@ and generate_client_actions actions () =
|
||||
generate_non_daemon_wrapper f
|
||||
| { wrapper = false } ->
|
||||
() (* no wrapper *)
|
||||
) (actions |> non_daemon_functions);
|
||||
) (actions |> non_daemon_functions |> sort);
|
||||
|
||||
(* Client-side stubs for each function. *)
|
||||
let generate_daemon_stub { name = name; c_name = c_name;
|
||||
@@ -2075,7 +2075,7 @@ and generate_client_actions actions () =
|
||||
List.iter (
|
||||
fun f ->
|
||||
generate_daemon_stub f
|
||||
) (actions |> daemon_functions)
|
||||
) (actions |> daemon_functions |> sort)
|
||||
|
||||
(* Functions which have optional arguments have two or three
|
||||
* generated variants.
|
||||
|
||||
@@ -56,7 +56,7 @@ let generate_daemon_actions_h () =
|
||||
pr "#define GUESTFS_%s_%s_BITMASK (UINT64_C(1)<<%d)\n"
|
||||
uc_shortname uc_n i
|
||||
) optargs
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
|
||||
List.iter (
|
||||
fun { name = name; style = ret, args, optargs } ->
|
||||
@@ -68,7 +68,7 @@ let generate_daemon_actions_h () =
|
||||
generate_prototype
|
||||
~single_line:true ~newline:true ~in_daemon:true ~prefix:"do_"
|
||||
name style;
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
|
||||
pr "\n";
|
||||
pr "#endif /* GUESTFSD_ACTIONS_H */\n"
|
||||
@@ -193,7 +193,7 @@ let generate_daemon_stubs_h () =
|
||||
List.iter (
|
||||
fun { name = name } ->
|
||||
pr "extern void %s_stub (XDR *xdr_in);\n" name;
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
|
||||
pr "\n";
|
||||
pr "#endif /* GUESTFSD_STUBS_H */\n"
|
||||
@@ -509,7 +509,7 @@ let generate_daemon_stubs actions () =
|
||||
pr "done_no_free:\n";
|
||||
pr " return;\n";
|
||||
pr "}\n\n";
|
||||
) (actions |> daemon_functions)
|
||||
) (actions |> daemon_functions |> sort)
|
||||
|
||||
let generate_daemon_dispatch () =
|
||||
generate_header CStyle GPLv2plus;
|
||||
@@ -545,7 +545,7 @@ let generate_daemon_dispatch () =
|
||||
pr " case GUESTFS_PROC_%s:\n" (String.uppercase_ascii name);
|
||||
pr " %s_stub (xdr_in);\n" name;
|
||||
pr " break;\n"
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
|
||||
pr " default:\n";
|
||||
pr " reply_with_error (\"dispatch_incoming_message: unknown procedure number %%d, set LIBGUESTFS_PATH to point to the matching libguestfs appliance directory\", proc_nr);\n";
|
||||
@@ -759,7 +759,7 @@ let generate_daemon_names () =
|
||||
| { name = name; proc_nr = Some proc_nr } ->
|
||||
pr " [%d] = \"%s\",\n" proc_nr name
|
||||
| { proc_nr = None } -> assert false
|
||||
) (actions |> daemon_functions);
|
||||
) (actions |> daemon_functions |> sort);
|
||||
pr "};\n"
|
||||
|
||||
(* Generate the optional groups for the daemon to implement
|
||||
|
||||
@@ -94,16 +94,12 @@ let rec generate_c_api_tests () =
|
||||
pr "}\n";
|
||||
pr "\n";
|
||||
|
||||
(* Generate the actual tests. Note that we generate the tests
|
||||
* in reverse order, deliberately, so that (in general) the
|
||||
* newest tests run first. This makes it quicker and easier to
|
||||
* debug them.
|
||||
*)
|
||||
(* Generate the actual tests. *)
|
||||
let test_names =
|
||||
List.map (
|
||||
fun { name = name; optional = optional; tests = tests } ->
|
||||
mapi (generate_one_test name optional) tests
|
||||
) (List.rev actions) in
|
||||
) (actions |> sort) in
|
||||
let test_names = List.concat test_names in
|
||||
|
||||
let nr_tests = List.length test_names in
|
||||
|
||||
Reference in New Issue
Block a user