WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] Rescues the indendation for several functions within t

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Rescues the indendation for several functions within the quicktest module. Splits an often-modified list of tests into multiple lines, reducing the chance that further patches will conflict with one another
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Tue, 14 Sep 2010 09:53:25 +0100
Delivery-date: Tue, 14 Sep 2010 01:54:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1284454324 -3600
# Node ID 6dc5d5527c945619673374a3e8d3321a1e3feba6
# Parent  2c66f33e8c29f8e112e2b09c0092e22ecb40e95f
Rescues the indendation for several functions within the quicktest module. 
Splits an often-modified list of tests into multiple lines, reducing the chance 
that further patches will conflict with one another.

Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>

diff -r 2c66f33e8c29 -r 6dc5d5527c94 ocaml/xapi/quicktest.ml
--- a/ocaml/xapi/quicktest.ml   Tue Sep 14 09:47:40 2010 +0100
+++ b/ocaml/xapi/quicktest.ml   Tue Sep 14 09:52:04 2010 +0100
@@ -651,49 +651,62 @@
   else failed test "one or more scenarios failed"
 
 let _ =
-  let all_tests = [ "storage"; "vm-placement"; "vm-memory-constraints"; 
"encodings"; "http"; "event"; "vdi"; "async"; "import"; "powercycle"; 
"squeezing"; "lifecycle"; "vhd" ] in
-  let default_tests = List.filter (fun x -> not(List.mem x [ "lifecycle"; 
"vhd" ])) all_tests in
+       let all_tests = [
+               "storage";
+               "vm-placement";
+               "vm-memory-constraints";
+               "encodings";
+               "http";
+               "event";
+               "vdi";
+               "async";
+               "import";
+               "powercycle";
+               "squeezing";
+               "lifecycle";
+               "vhd";
+       ] in
+       let default_tests = List.filter (fun x -> not(List.mem x [ "lifecycle"; 
"vhd" ])) all_tests in
 
-  let tests_to_run = ref default_tests in (* default is everything *)
-  Arg.parse 
-    [ "-single", Arg.String (fun x -> tests_to_run := [ x ]), Printf.sprintf 
"Only run one test (possibilities are %s)" (String.concat ", " all_tests) ;
-         "-all", Arg.Unit (fun () -> tests_to_run := all_tests), 
Printf.sprintf "Run all tests (%s)" (String.concat ", " all_tests);
-      "-nocolour", Arg.Clear Quicktest_common.use_colour, "Don't use colour in 
the output" ]
-    (fun x -> match !host, !username, !password with
-     | "", _, _ -> host := x; rpc := rpc_remote; using_unix_domain_socket := 
false;
-     | _, "", _ -> username := x
-     | _, _, "" -> password := x
-     | _, _, _ -> Printf.fprintf stderr "Skipping unrecognised argument: %s" x)
-    "Perform some quick functional tests. The default is to test localhost 
over a Unix socket. For remote server supply <hostname> <username> and 
<password> arguments.";
-  if !host = "" then host := "localhost";
-  if !username = "" then username := "root";
-  
-  let maybe_run_test name f = 
-    assert (List.mem name all_tests);
-       if List.mem name !tests_to_run then f () in
+       let tests_to_run = ref default_tests in (* default is everything *)
+       Arg.parse [
+               "-single", Arg.String (fun x -> tests_to_run := [ x ]), 
Printf.sprintf "Only run one test (possibilities are %s)" (String.concat ", " 
all_tests) ;
+               "-all", Arg.Unit (fun () -> tests_to_run := all_tests), 
Printf.sprintf "Run all tests (%s)" (String.concat ", " all_tests);
+               "-nocolour", Arg.Clear Quicktest_common.use_colour, "Don't use 
colour in the output" ]
+               (fun x -> match !host, !username, !password with
+                       | "", _, _ -> host := x; rpc := rpc_remote; 
using_unix_domain_socket := false;
+                       | _, "", _ -> username := x
+                       | _, _, "" -> password := x
+                       | _, _, _ -> Printf.fprintf stderr "Skipping 
unrecognised argument: %s" x)
+               "Perform some quick functional tests. The default is to test 
localhost over a Unix socket. For remote server supply <hostname> <username> 
and <password> arguments.";
+       if !host = "" then host := "localhost";
+       if !username = "" then username := "root";
+       
+       let maybe_run_test name f = 
+               assert (List.mem name all_tests);
+               if List.mem name !tests_to_run then f () in
 
-  Stunnel.init_stunnel_path ();
-  let s = init_session !username !password in
-  finally
-    (fun () ->
-       (try
-         maybe_run_test "encodings" 
Quicktest_encodings.run_from_within_quicktest;
-         maybe_run_test "squeezing" squeeze_test;
-         maybe_run_test "vm-memory-constraints" 
Quicktest_vm_memory_constraints.run_from_within_quicktest;
-         maybe_run_test "vm-placement" 
Quicktest_vm_placement.run_from_within_quicktest;
-         maybe_run_test "storage" (fun () -> Quicktest_storage.go s);
-         maybe_run_test "http" Quicktest_http.run_from_within_quicktest;
-         maybe_run_test "event" event_next_unblocking_test;
-         maybe_run_test "vdi" (fun () -> vdi_test s);
-         maybe_run_test "async" (fun () -> async_test s);
-         maybe_run_test "import" (fun () -> import_export_test s);
-         maybe_run_test "vhd" (fun () -> with_vm s test_vhd_locking_hook);
-         maybe_run_test "powercycle" (fun () -> with_vm s vm_powercycle_test);
-         maybe_run_test "lifecycle" (fun () -> with_vm s 
Quicktest_lifecycle.test);
-
-       with
-       | Api_errors.Server_error (a,b) ->
-           output_string stderr (Printf.sprintf "%s: %s" a (String.concat "," 
b));
-       | e ->
-           output_string stderr (Printexc.to_string e))
-    ) (fun () -> summarise ())
+       Stunnel.init_stunnel_path ();
+       let s = init_session !username !password in
+       finally
+               (fun () ->
+                       (try
+                               maybe_run_test "encodings" 
Quicktest_encodings.run_from_within_quicktest;
+                               maybe_run_test "squeezing" squeeze_test;
+                               maybe_run_test "vm-memory-constraints" 
Quicktest_vm_memory_constraints.run_from_within_quicktest;
+                               maybe_run_test "vm-placement" 
Quicktest_vm_placement.run_from_within_quicktest;
+                               maybe_run_test "storage" (fun () -> 
Quicktest_storage.go s);
+                               maybe_run_test "http" 
Quicktest_http.run_from_within_quicktest;
+                               maybe_run_test "event" 
event_next_unblocking_test;
+                               maybe_run_test "vdi" (fun () -> vdi_test s);
+                               maybe_run_test "async" (fun () -> async_test s);
+                               maybe_run_test "import" (fun () -> 
import_export_test s);
+                               maybe_run_test "vhd" (fun () -> with_vm s 
test_vhd_locking_hook);
+                               maybe_run_test "powercycle" (fun () -> with_vm 
s vm_powercycle_test);
+                               maybe_run_test "lifecycle" (fun () -> with_vm s 
Quicktest_lifecycle.test);
+                       with
+                               | Api_errors.Server_error (a,b) ->
+                                       output_string stderr (Printf.sprintf 
"%s: %s" a (String.concat "," b));
+                               | e ->
+                                       output_string stderr 
(Printexc.to_string e))
+               ) (fun () -> summarise ())
1 file changed, 57 insertions(+), 44 deletions(-)
ocaml/xapi/quicktest.ml |  101 ++++++++++++++++++++++++++---------------------


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Rescues the indendation for several functions within the quicktest module. Splits an often-modified list of tests into multiple lines, reducing the chance that further patches will conflict with one another, Jonathan Knowles <=