X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fgenerator.ml;h=8d16945ae44dae477ccf9e7fcb1c5c338af58c48;hb=9f7ebef3d464a2e40fae75012201a5da2740b99c;hp=9ef99bdf489a5ecd33a70c8901586c05f0c71850;hpb=2f1a50d81671810256dce0852e6b1e0810ac44af;p=libguestfs.git diff --git a/src/generator.ml b/src/generator.ml index 9ef99bd..8d16945 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -90,7 +90,7 @@ and ret = (* "RStruct" is a function which returns a single named structure * or an error indication (in C, a struct, and in other languages * with varying representations, but usually very efficient). See - * after the function list below for the structures. + * after the function list below for the structures. *) | RStruct of string * string (* name of retval, name of struct *) @@ -301,6 +301,12 @@ and test_init = (* Block devices are empty and no filesystems are mounted. *) | InitEmpty + (* /dev/sda contains a single partition /dev/sda1, with random + * content. /dev/sdb and /dev/sdc may have random content. + * No LVM. + *) + | InitPartition + (* /dev/sda contains a single partition /dev/sda1, which is formatted * as ext2, empty [except for lost+found] and mounted on /. * /dev/sdb and /dev/sdc may have random content. @@ -1619,8 +1625,7 @@ This is the same as the C system call."); ("statvfs", (RStruct ("statbuf", "statvfs"), [String "path"]), 54, [], [InitSquashFS, Always, TestOutputStruct ( - [["statvfs"; "/"]], [CompareWithInt ("namemax", 256); - CompareWithInt ("bsize", 131072)])], + [["statvfs"; "/"]], [CompareWithInt ("namemax", 256)])], "get file system statistics", "\ Returns file system statistics for any mounted file system. @@ -1756,7 +1761,8 @@ This uses the L command."); [InitBasicFS, Always, TestOutput ( (* Pick a file from cwd which isn't likely to change. *) [["upload"; "../COPYING.LIB"; "/COPYING.LIB"]; - ["checksum"; "md5"; "/COPYING.LIB"]], "e3eda01d9815f8d24aae2dbd89b68b06")], + ["checksum"; "md5"; "/COPYING.LIB"]], + Digest.to_hex (Digest.file "COPYING.LIB"))], "upload a file from the local machine", "\ Upload local file C to C on the @@ -1772,7 +1778,8 @@ See also C."); [["upload"; "../COPYING.LIB"; "/COPYING.LIB"]; ["download"; "/COPYING.LIB"; "testdownload.tmp"]; ["upload"; "testdownload.tmp"; "/upload"]; - ["checksum"; "md5"; "/upload"]], "e3eda01d9815f8d24aae2dbd89b68b06")], + ["checksum"; "md5"; "/upload"]], + Digest.to_hex (Digest.file "COPYING.LIB"))], "download a file to the local machine", "\ Download file C and save it as C @@ -3206,10 +3213,10 @@ C command which allocates a file in the host and attaches it as a device."); ("swapon_device", (RErr, [String "device"]), 170, [], - [InitNone, Always, TestRun ( - [["mkswap"; "/dev/sdb"]; - ["swapon_device"; "/dev/sdb"]; - ["swapoff_device"; "/dev/sdb"]])], + [InitPartition, Always, TestRun ( + [["mkswap"; "/dev/sda1"]; + ["swapon_device"; "/dev/sda1"]; + ["swapoff_device"; "/dev/sda1"]])], "enable swap on device", "\ This command enables the libguestfs appliance to use the @@ -3254,7 +3261,9 @@ This command disables the libguestfs appliance swap on file."); [["sfdiskM"; "/dev/sdb"; ","]; ["mkswap_L"; "swapit"; "/dev/sdb1"]; ["swapon_label"; "swapit"]; - ["swapoff_label"; "swapit"]])], + ["swapoff_label"; "swapit"]; + ["zero"; "/dev/sdb"]; + ["blockdev_rereadpt"; "/dev/sdb"]])], "enable swap on labelled swap partition", "\ This command enables swap to a labelled swap partition. @@ -5315,6 +5324,13 @@ and generate_one_test_body name i test_name init test = [["blockdev_setrw"; "/dev/sda"]; ["umount_all"]; ["lvm_remove_all"]] + | InitPartition -> + pr " /* InitPartition for %s: create /dev/sda1 */\n" test_name; + List.iter (generate_test_command_call test_name) + [["blockdev_setrw"; "/dev/sda"]; + ["umount_all"]; + ["lvm_remove_all"]; + ["sfdiskM"; "/dev/sda"; ","]] | InitBasicFS -> pr " /* InitBasicFS for %s: create ext2 on /dev/sda1 */\n" test_name; List.iter (generate_test_command_call test_name) @@ -8488,6 +8504,16 @@ and generate_java_struct_list_return typ jtyp cols = pr " guestfs_free_%s_list (r);\n" typ; pr " return jr;\n" +and generate_java_makefile_inc () = + generate_header HashStyle GPLv2; + + pr "java_built_sources = \\\n"; + List.iter ( + fun (typ, jtyp) -> + pr "\tcom/redhat/et/libguestfs/%s.java \\\n" jtyp; + ) java_structs; + pr "\tcom/redhat/et/libguestfs/GuestFS.java\n" + and generate_haskell_hs () = generate_header HaskellStyle LGPLv2; @@ -9245,12 +9271,7 @@ Run it from the top source directory using the command ) java_structs; let close = output_to "java/Makefile.inc" in - pr "java_built_sources ="; - List.iter ( - fun (typ, jtyp) -> - pr " com/redhat/et/libguestfs/%s.java" jtyp; - ) java_structs; - pr " com/redhat/et/libguestfs/GuestFS.java\n"; + generate_java_makefile_inc (); close (); let close = output_to "java/com_redhat_et_libguestfs_GuestFS.c" in