X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=e3453a3adae9fb704bb93248d11e5ce5fe988313;hp=d3040d5fb88eb97ed7779923a87e9afb57ecf85b;hb=0c07f0d23698798475e0d09491812aca52440328;hpb=9af96c41f64567e6fbe0dd25f6ffa90385e9c49a diff --git a/src/generator.ml b/src/generator.ml index d3040d5..e3453a3 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -25,13 +25,11 @@ * daemon/.c to write the implementation. * * After editing this file, run it (./src/generator.ml) to regenerate all the - * output files. Note that if you are using a separate build directory you must - * run generator.ml from your top level build directory. You must also have run - * configure before generator.ml will run. + * output files. Note that if you are using a separate build directory you + * must run generator.ml from the _source_ directory. * * IMPORTANT: This script should NOT print any warnings. If it prints * warnings, you should treat them as errors. - * [Need to add -warn-error to ocaml command line] *) #load "unix.cma";; @@ -45,39 +43,62 @@ and ret = * indication, ie. 0 or -1. *) | RErr + (* "RInt" as a return value means an int which is -1 for error * or any value >= 0 on success. Only use this for smallish * positive ints (0 <= i < 2^30). *) | RInt of string + (* "RInt64" is the same as RInt, but is guaranteed to be able * to return a full 64 bit value, _except_ that -1 means error * (so -1 cannot be a valid, non-error return value). *) | RInt64 of string + (* "RBool" is a bool return value which can be true/false or * -1 for error. *) | RBool of string + (* "RConstString" is a string that refers to a constant value. + * The return value must NOT be NULL (since NULL indicates + * an error). + * * Try to avoid using this. In particular you cannot use this * for values returned from the daemon, because there is no * thread-safe way to return them in the C API. *) | RConstString of string - (* "RString" and "RStringList" are caller-frees. *) + + (* "RConstOptString" is an even more broken version of + * "RConstString". The returned string may be NULL and there + * is no way to return an error indication. Avoid using this! + *) + | RConstOptString of string + + (* "RString" is a returned string. It must NOT be NULL, since + * a NULL return indicates an error. The caller frees this. + *) | RString of string + + (* "RStringList" is a list of strings. No string in the list + * can be NULL. The caller frees the strings and the array. + *) | RStringList of string + (* "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 *) + (* "RStructList" is a function which returns either a list/array * of structures (could be zero-length), or an error indication. *) | RStructList of string * string (* name of retval, name of struct *) + (* Key-value pairs of untyped strings. Turns into a hashtable or * dictionary in languages which support it. DON'T use this as a * general "bucket" for results. Prefer a stronger typed return @@ -86,16 +107,21 @@ and ret = * inefficient. Keys should be unique. NULLs are not permitted. *) | RHashtable of string -(* Not implemented: + (* "RBufferOut" is handled almost exactly like RString, but * it allows the string to contain arbitrary 8 bit data including * ASCII NUL. In the C API this causes an implicit extra parameter - * to be added of type . Other programming languages - * support strings with arbitrary 8 bit data. At the RPC layer - * we have to use the opaque<> type instead of string<>. + * to be added of type . The extra parameter + * returns the actual size of the return buffer in bytes. + * + * Other programming languages support strings with arbitrary 8 bit + * data. + * + * At the RPC layer we have to use the opaque<> type instead of + * string<>. Returned data is still limited to the max message + * size (ie. ~ 2 MB). *) | RBufferOut of string -*) and args = argt list (* Function parameters, guestfs handle is implicit. *) @@ -108,6 +134,7 @@ and args = argt list (* Function parameters, guestfs handle is implicit. *) *) and argt = | String of string (* const char *name, cannot be NULL *) + | Device of string (* /dev device name, cannot be NULL *) | OptString of string (* const char *name, may be NULL *) | StringList of string(* list of strings (each string cannot be NULL) *) | Bool of string (* boolean *) @@ -142,15 +169,7 @@ type flags = | FishAction of string (* call this function in guestfish *) | NotInFish (* do not export via guestfish *) | NotInDocs (* do not add this function to documentation *) - -let protocol_limit_warning = - "Because of the message protocol, there is a transfer limit -of somewhere between 2MB and 4MB. To transfer large files you should use -FTP." - -let danger_will_robinson = - "B." + | DeprecatedBy of string (* function is deprecated, use .. instead *) (* You can supply zero or as many tests as you want per API call. * @@ -188,45 +207,60 @@ type tests = (test_init * test_prereq * test) list and test = (* Run the command sequence and just expect nothing to fail. *) | TestRun of seq + (* Run the command sequence and expect the output of the final * command to be the string. *) | TestOutput of seq * string + (* Run the command sequence and expect the output of the final * command to be the list of strings. *) | TestOutputList of seq * string list + (* Run the command sequence and expect the output of the final * command to be the list of block devices (could be either * "/dev/sd.." or "/dev/hd.." form - we don't check the 5th * character of each string). *) | TestOutputListOfDevices of seq * string list + (* Run the command sequence and expect the output of the final * command to be the integer. *) | TestOutputInt of seq * int + (* Run the command sequence and expect the output of the final * command to be , eg. ">=", "1". *) | TestOutputIntOp of seq * string * int + (* Run the command sequence and expect the output of the final * command to be a true value (!= 0 or != NULL). *) | TestOutputTrue of seq + (* Run the command sequence and expect the output of the final * command to be a false value (== 0 or == NULL, but not an error). *) | TestOutputFalse of seq + (* Run the command sequence and expect the output of the final * command to be a list of the given length (but don't care about * content). *) | TestOutputLength of seq * int + + (* Run the command sequence and expect the output of the final + * command to be a buffer (RBufferOut), ie. string + size. + *) + | TestOutputBuffer of seq * string + (* Run the command sequence and expect the output of the final * command to be a structure. *) | TestOutputStruct of seq * test_field_compare list + (* Run the command sequence and expect the final command (only) * to fail. *) @@ -243,14 +277,17 @@ and test_field_compare = and test_prereq = (* Test always runs. *) | Always + (* Test is currently disabled - eg. it fails, or it tests some * unimplemented feature. *) | Disabled + (* 'string' is some C code (a function body) that should return * true or false. The test will run if the code returns true. *) | If of string + (* As for 'If' but the test runs _unless_ the code returns true. *) | Unless of string @@ -261,14 +298,23 @@ and test_init = * a bad idea. *) | InitNone + (* 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. * No LVM. *) | InitBasicFS + (* /dev/sda: * /dev/sda1 (is a PV): * /dev/VG/LV (size 8MB): @@ -277,6 +323,11 @@ and test_init = *) | InitBasicFSonLVM + (* /dev/sdd (the squashfs, see images/ directory in source) + * is mounted on / + *) + | InitSquashFS + (* Sequence of commands for testing. *) and seq = cmd list and cmd = string list @@ -307,6 +358,7 @@ let test_all_rets = [ "test0rint64", RInt64 "valout"; "test0rbool", RBool "valout"; "test0rconststring", RConstString "valout"; + "test0rconstoptstring", RConstOptString "valout"; "test0rstring", RString "valout"; "test0rstringlist", RStringList "valout"; "test0rstruct", RStruct ("valout", "lvm_pv"); @@ -330,9 +382,9 @@ You probably don't want to call this function."); List.map ( fun (name, ret) -> [(name, (ret, [String "val"]), -1, [NotInFish; NotInDocs], - [], - "internal test function - do not use", - "\ + [], + "internal test function - do not use", + "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible return type correctly. @@ -341,9 +393,9 @@ It converts string C to the return type. You probably don't want to call this function."); (name ^ "err", (ret, []), -1, [NotInFish; NotInDocs], - [], - "internal test function - do not use", - "\ + [], + "internal test function - do not use", + "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible return type correctly. @@ -403,6 +455,8 @@ image). This is equivalent to the qemu parameter C<-drive file=filename,cache=off,if=...>. +C is omitted in cases where it is not supported by +the underlying filesystem. Note that this call checks for the existence of C. This stops you from specifying other types of drive which are supported @@ -501,7 +555,7 @@ Return the current search path. This is always non-NULL. If it wasn't set already, then this will return the default path."); - ("set_append", (RErr, [String "append"]), -1, [FishAlias "append"], + ("set_append", (RErr, [OptString "append"]), -1, [FishAlias "append"], [], "add options to kernel command line", "\ @@ -514,7 +568,7 @@ C environment variable. Setting C to C means I additional options are passed (libguestfs always adds a few of its own)."); - ("get_append", (RConstString "append", []), -1, [], + ("get_append", (RConstOptString "append", []), -1, [], (* This cannot be tested with the current framework. The * function can return NULL in normal operations, which the * test framework interprets as an error. @@ -710,6 +764,31 @@ C<$major.$minor.$release$extra> I Don't use this call to test for availability of features. Distro backports makes this unreliable."); + ("set_selinux", (RErr, [Bool "selinux"]), -1, [FishAlias "selinux"], + [InitNone, Always, TestOutputTrue ( + [["set_selinux"; "true"]; + ["get_selinux"]])], + "set SELinux enabled or disabled at appliance boot", + "\ +This sets the selinux flag that is passed to the appliance +at boot time. The default is C (disabled). + +Note that if SELinux is enabled, it is always in +Permissive mode (C). + +For more information on the architecture of libguestfs, +see L."); + + ("get_selinux", (RBool "selinux", []), -1, [], + [], + "get SELinux enabled flag", + "\ +This returns the current setting of the selinux flag which +is passed to the appliance at boot time. See C. + +For more information on the architecture of libguestfs, +see L."); + ] (* daemon_functions are any functions which cause some action @@ -717,7 +796,7 @@ of features. Distro backports makes this unreliable."); *) let daemon_functions = [ - ("mount", (RErr, [String "device"; String "mountpoint"]), 1, [], + ("mount", (RErr, [Device "device"; String "mountpoint"]), 1, [], [InitEmpty, Always, TestOutput ( [["sfdiskM"; "/dev/sda"; ","]; ["mkfs"; "ext2"; "/dev/sda1"]; @@ -764,22 +843,21 @@ update the timestamps on a file, or, if the file does not exist, to create a new zero-length file."); ("cat", (RString "content", [String "path"]), 4, [ProtocolLimitWarning], - [InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "new file contents"; "0"]; - ["cat"; "/new"]], "new file contents")], + [InitSquashFS, Always, TestOutput ( + [["cat"; "/known-2"]], "abcdef\n")], "list the contents of a file", "\ Return the contents of the file named C. Note that this function cannot correctly handle binary files (specifically, files containing C<\\0> character which is treated -as end of string). For those you need to use the C -function which has a more complex interface."); +as end of string). For those you need to use the C +or C functions which have a more complex interface."); ("ll", (RString "listing", [String "directory"]), 5, [], [], (* XXX Tricky to test because it depends on the exact format - * of the 'ls -l' command, which changes between F10 and F11. - *) + * of the 'ls -l' command, which changes between F10 and F11. + *) "list the files in a directory (long format)", "\ List the files in C (relative to the root directory, @@ -913,12 +991,10 @@ List all the logical volumes detected. This is the equivalent of the L command. The \"full\" version includes all fields."); ("read_lines", (RStringList "lines", [String "path"]), 15, [], - [InitBasicFS, Always, TestOutputList ( - [["write_file"; "/new"; "line1\r\nline2\nline3"; "0"]; - ["read_lines"; "/new"]], ["line1"; "line2"; "line3"]); - InitBasicFS, Always, TestOutputList ( - [["write_file"; "/new"; ""; "0"]; - ["read_lines"; "/new"]], [])], + [InitSquashFS, Always, TestOutputList ( + [["read_lines"; "/known-4"]], ["abc"; "def"; "ghi"]); + InitSquashFS, Always, TestOutputList ( + [["read_lines"; "/empty"]], [])], "read file as lines", "\ Return the contents of the file named C. @@ -1179,12 +1255,10 @@ names, you will need to locate and parse the password file yourself (Augeas support makes this relatively easy)."); ("exists", (RBool "existsflag", [String "path"]), 36, [], - [InitBasicFS, Always, TestOutputTrue ( - [["touch"; "/new"]; - ["exists"; "/new"]]); - InitBasicFS, Always, TestOutputTrue ( - [["mkdir"; "/new"]; - ["exists"; "/new"]])], + [InitSquashFS, Always, TestOutputTrue ( + [["exists"; "/empty"]]); + InitSquashFS, Always, TestOutputTrue ( + [["exists"; "/directory"]])], "test if file or directory exists", "\ This returns C if and only if there is a file, directory @@ -1193,12 +1267,10 @@ This returns C if and only if there is a file, directory See also C, C, C."); ("is_file", (RBool "fileflag", [String "path"]), 37, [], - [InitBasicFS, Always, TestOutputTrue ( - [["touch"; "/new"]; - ["is_file"; "/new"]]); - InitBasicFS, Always, TestOutputFalse ( - [["mkdir"; "/new"]; - ["is_file"; "/new"]])], + [InitSquashFS, Always, TestOutputTrue ( + [["is_file"; "/known-1"]]); + InitSquashFS, Always, TestOutputFalse ( + [["is_file"; "/directory"]])], "test if file exists", "\ This returns C if and only if there is a file @@ -1208,12 +1280,10 @@ other objects like directories. See also C."); ("is_dir", (RBool "dirflag", [String "path"]), 38, [], - [InitBasicFS, Always, TestOutputFalse ( - [["touch"; "/new"]; - ["is_dir"; "/new"]]); - InitBasicFS, Always, TestOutputTrue ( - [["mkdir"; "/new"]; - ["is_dir"; "/new"]])], + [InitSquashFS, Always, TestOutputFalse ( + [["is_dir"; "/known-3"]]); + InitSquashFS, Always, TestOutputTrue ( + [["is_dir"; "/directory"]])], "test if file exists", "\ This returns C if and only if there is a directory @@ -1222,7 +1292,7 @@ other objects like files. See also C."); - ("pvcreate", (RErr, [String "device"]), 39, [], + ("pvcreate", (RErr, [Device "device"]), 39, [], [InitEmpty, Always, TestOutputListOfDevices ( [["sfdiskM"; "/dev/sda"; ",100 ,200 ,"]; ["pvcreate"; "/dev/sda1"]; @@ -1270,7 +1340,7 @@ from the non-empty list of physical volumes C."); This creates an LVM volume group called C on the volume group C, with C megabytes."); - ("mkfs", (RErr, [String "fstype"; String "device"]), 42, [], + ("mkfs", (RErr, [String "fstype"; Device "device"]), 42, [], [InitEmpty, Always, TestOutput ( [["sfdiskM"; "/dev/sda"; ","]; ["mkfs"; "ext2"; "/dev/sda1"]; @@ -1283,9 +1353,9 @@ This creates a filesystem on C (usually a partition or LVM logical volume). The filesystem type is C, for example C."); - ("sfdisk", (RErr, [String "device"; - Int "cyls"; Int "heads"; Int "sectors"; - StringList "lines"]), 43, [DangerWillRobinson], + ("sfdisk", (RErr, [Device "device"; + Int "cyls"; Int "heads"; Int "sectors"; + StringList "lines"]), 43, [DangerWillRobinson], [], "create partitions on a block device", "\ @@ -1371,7 +1441,9 @@ contains the filesystem."); This returns the list of currently mounted filesystems. It returns the list of devices (eg. C, C). -Some internal mounts are not shown."); +Some internal mounts are not shown. + +See also: C"); ("umount_all", (RErr, []), 47, [FishAlias "unmount-all"], [InitBasicFS, Always, TestOutputList ( @@ -1405,21 +1477,22 @@ This command removes all LVM logical volumes, volume groups and physical volumes."); ("file", (RString "description", [String "path"]), 49, [], - [InitBasicFS, Always, TestOutput ( - [["touch"; "/new"]; - ["file"; "/new"]], "empty"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "some content\n"; "0"]; - ["file"; "/new"]], "ASCII text"); - InitBasicFS, Always, TestLastFail ( - [["file"; "/nofile"]])], + [InitSquashFS, Always, TestOutput ( + [["file"; "/empty"]], "empty"); + InitSquashFS, Always, TestOutput ( + [["file"; "/known-1"]], "ASCII text"); + InitSquashFS, Always, TestLastFail ( + [["file"; "/notexists"]])], "determine file type", "\ This call uses the standard L command to determine the type or contents of the file. This also works on devices, for example to find out whether a partition contains a filesystem. -The exact command which runs is C. Note in +This call will also transparently look inside various types +of compressed file. + +The exact command which runs is C. Note in particular that the filename is not prepended to the output (the C<-b> option)."); @@ -1557,9 +1630,8 @@ result into a list of lines. See also: C"); ("stat", (RStruct ("statbuf", "stat"), [String "path"]), 52, [], - [InitBasicFS, Always, TestOutputStruct ( - [["touch"; "/new"]; - ["stat"; "/new"]], [CompareWithInt ("size", 0)])], + [InitSquashFS, Always, TestOutputStruct ( + [["stat"; "/empty"]], [CompareWithInt ("size", 0)])], "get file information", "\ Returns file information for the given C. @@ -1567,9 +1639,8 @@ Returns file information for the given C. This is the same as the C system call."); ("lstat", (RStruct ("statbuf", "stat"), [String "path"]), 53, [], - [InitBasicFS, Always, TestOutputStruct ( - [["touch"; "/new"]; - ["lstat"; "/new"]], [CompareWithInt ("size", 0)])], + [InitSquashFS, Always, TestOutputStruct ( + [["lstat"; "/empty"]], [CompareWithInt ("size", 0)])], "get file information for a symbolic link", "\ Returns file information for the given C. @@ -1581,9 +1652,8 @@ refers to. This is the same as the C system call."); ("statvfs", (RStruct ("statbuf", "statvfs"), [String "path"]), 54, [], - [InitBasicFS, Always, TestOutputStruct ( - [["statvfs"; "/"]], [CompareWithInt ("namemax", 255); - CompareWithInt ("bsize", 1024)])], + [InitSquashFS, Always, TestOutputStruct ( + [["statvfs"; "/"]], [CompareWithInt ("namemax", 256)])], "get file system statistics", "\ Returns file system statistics for any mounted file system. @@ -1592,7 +1662,7 @@ C should be a file or directory in the mounted file system This is the same as the C system call."); - ("tune2fs_l", (RHashtable "superblock", [String "device"]), 55, [], + ("tune2fs_l", (RHashtable "superblock", [Device "device"]), 55, [], [], (* XXX test *) "get ext2/ext3/ext4 superblock details", "\ @@ -1604,7 +1674,7 @@ manpage for more details. The list of fields returned isn't clearly defined, and depends on both the version of C that libguestfs was built against, and the filesystem itself."); - ("blockdev_setro", (RErr, [String "device"]), 56, [], + ("blockdev_setro", (RErr, [Device "device"]), 56, [], [InitEmpty, Always, TestOutputTrue ( [["blockdev_setro"; "/dev/sda"]; ["blockdev_getro"; "/dev/sda"]])], @@ -1614,7 +1684,7 @@ Sets the block device named C to read-only. This uses the L command."); - ("blockdev_setrw", (RErr, [String "device"]), 57, [], + ("blockdev_setrw", (RErr, [Device "device"]), 57, [], [InitEmpty, Always, TestOutputFalse ( [["blockdev_setrw"; "/dev/sda"]; ["blockdev_getro"; "/dev/sda"]])], @@ -1624,7 +1694,7 @@ Sets the block device named C to read-write. This uses the L command."); - ("blockdev_getro", (RBool "ro", [String "device"]), 58, [], + ("blockdev_getro", (RBool "ro", [Device "device"]), 58, [], [InitEmpty, Always, TestOutputTrue ( [["blockdev_setro"; "/dev/sda"]; ["blockdev_getro"; "/dev/sda"]])], @@ -1635,7 +1705,7 @@ Returns a boolean indicating if the block device is read-only This uses the L command."); - ("blockdev_getss", (RInt "sectorsize", [String "device"]), 59, [], + ("blockdev_getss", (RInt "sectorsize", [Device "device"]), 59, [], [InitEmpty, Always, TestOutputInt ( [["blockdev_getss"; "/dev/sda"]], 512)], "get sectorsize of block device", @@ -1648,7 +1718,7 @@ for that). This uses the L command."); - ("blockdev_getbsz", (RInt "blocksize", [String "device"]), 60, [], + ("blockdev_getbsz", (RInt "blocksize", [Device "device"]), 60, [], [InitEmpty, Always, TestOutputInt ( [["blockdev_getbsz"; "/dev/sda"]], 4096)], "get blocksize of block device", @@ -1660,7 +1730,7 @@ I). This uses the L command."); - ("blockdev_setbsz", (RErr, [String "device"; Int "blocksize"]), 61, [], + ("blockdev_setbsz", (RErr, [Device "device"; Int "blocksize"]), 61, [], [], (* XXX test *) "set blocksize of block device", "\ @@ -1671,7 +1741,7 @@ I). This uses the L command."); - ("blockdev_getsz", (RInt64 "sizeinsectors", [String "device"]), 62, [], + ("blockdev_getsz", (RInt64 "sizeinsectors", [Device "device"]), 62, [], [InitEmpty, Always, TestOutputInt ( [["blockdev_getsz"; "/dev/sda"]], 1024000)], "get total size of device in 512-byte sectors", @@ -1685,7 +1755,7 @@ useful I. This uses the L command."); - ("blockdev_getsize64", (RInt64 "sizeinbytes", [String "device"]), 63, [], + ("blockdev_getsize64", (RInt64 "sizeinbytes", [Device "device"]), 63, [], [InitEmpty, Always, TestOutputInt ( [["blockdev_getsize64"; "/dev/sda"]], 524288000)], "get total size of device in bytes", @@ -1696,7 +1766,7 @@ See also C. This uses the L command."); - ("blockdev_flushbufs", (RErr, [String "device"]), 64, [], + ("blockdev_flushbufs", (RErr, [Device "device"]), 64, [], [InitEmpty, Always, TestRun [["blockdev_flushbufs"; "/dev/sda"]]], "flush device buffers", @@ -1706,7 +1776,7 @@ with C. This uses the L command."); - ("blockdev_rereadpt", (RErr, [String "device"]), 65, [], + ("blockdev_rereadpt", (RErr, [Device "device"]), 65, [], [InitEmpty, Always, TestRun [["blockdev_rereadpt"; "/dev/sda"]]], "reread partition table", @@ -1719,7 +1789,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 @@ -1735,7 +1806,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 @@ -1746,35 +1818,22 @@ C can also be a named pipe. See also C, C."); ("checksum", (RString "checksum", [String "csumtype"; String "path"]), 68, [], - [InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "crc"; "/new"]], "935282863"); - InitBasicFS, Always, TestLastFail ( - [["checksum"; "crc"; "/new"]]); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "md5"; "/new"]], "d8e8fca2dc0f896fd7cb4cb0031ba249"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "sha1"; "/new"]], "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "sha224"; "/new"]], "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "sha256"; "/new"]], "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "sha384"; "/new"]], "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d"); - InitBasicFS, Always, TestOutput ( - [["write_file"; "/new"; "test\n"; "0"]; - ["checksum"; "sha512"; "/new"]], "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123"); - InitBasicFS, Always, TestOutput ( - (* RHEL 5 thinks this is an HFS+ filesystem unless we give - * the type explicitly. - *) - [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; - ["checksum"; "md5"; "/known-3"]], "46d6ca27ee07cdc6fa99c2e138cc522c")], + [InitSquashFS, Always, TestOutput ( + [["checksum"; "crc"; "/known-3"]], "2891671662"); + InitSquashFS, Always, TestLastFail ( + [["checksum"; "crc"; "/notexists"]]); + InitSquashFS, Always, TestOutput ( + [["checksum"; "md5"; "/known-3"]], "46d6ca27ee07cdc6fa99c2e138cc522c"); + InitSquashFS, Always, TestOutput ( + [["checksum"; "sha1"; "/known-3"]], "b7ebccc3ee418311091c3eda0a45b83c0a770f15"); + InitSquashFS, Always, TestOutput ( + [["checksum"; "sha224"; "/known-3"]], "d2cd1774b28f3659c14116be0a6dc2bb5c4b350ce9cd5defac707741"); + InitSquashFS, Always, TestOutput ( + [["checksum"; "sha256"; "/known-3"]], "75bb71b90cd20cb13f86d2bea8dad63ac7194e7517c3b52b8d06ff52d3487d30"); + InitSquashFS, Always, TestOutput ( + [["checksum"; "sha384"; "/known-3"]], "5fa7883430f357b5d7b7271d3a1d2872b51d73cba72731de6863d3dea55f30646af2799bef44d5ea776a5ec7941ac640"); + InitSquashFS, Always, TestOutput ( + [["checksum"; "sha512"; "/known-3"]], "2794062c328c6b216dca90443b7f7134c5f40e56bd0ed7853123275a09982a6f992e6ca682f9d2fba34a4c5e870d8fe077694ff831e3032a004ee077e00603f6")], "compute MD5, SHAx or CRC checksum of file", "\ This call computes the MD5, SHAx or CRC checksum of the @@ -1858,7 +1917,7 @@ it to local file C. To download an uncompressed tarball, use C."); - ("mount_ro", (RErr, [String "device"; String "mountpoint"]), 73, [], + ("mount_ro", (RErr, [Device "device"; String "mountpoint"]), 73, [], [InitBasicFS, Always, TestLastFail ( [["umount"; "/"]; ["mount_ro"; "/dev/sda1"; "/"]; @@ -1873,7 +1932,7 @@ To download an uncompressed tarball, use C."); This is the same as the C command, but it mounts the filesystem with the read-only (I<-o ro>) flag."); - ("mount_options", (RErr, [String "options"; String "device"; String "mountpoint"]), 74, [], + ("mount_options", (RErr, [String "options"; Device "device"; String "mountpoint"]), 74, [], [], "mount a guest disk with mount options", "\ @@ -1881,7 +1940,7 @@ This is the same as the C command, but it allows you to set the mount options as for the L I<-o> flag."); - ("mount_vfs", (RErr, [String "options"; String "vfstype"; String "device"; String "mountpoint"]), 75, [], + ("mount_vfs", (RErr, [String "options"; String "vfstype"; Device "device"; String "mountpoint"]), 75, [], [], "mount a guest disk with mount options and vfstype", "\ @@ -1901,7 +1960,7 @@ There is no comprehensive help for this command. You have to look at the file C in the libguestfs source to find out what you can do."); - ("lvremove", (RErr, [String "device"]), 77, [], + ("lvremove", (RErr, [Device "device"]), 77, [], [InitEmpty, Always, TestOutputList ( [["sfdiskM"; "/dev/sda"; ","]; ["pvcreate"; "/dev/sda1"]; @@ -1958,7 +2017,7 @@ Remove an LVM volume group C, (for example C). This also forcibly removes all logical volumes in the volume group (if any)."); - ("pvremove", (RErr, [String "device"]), 79, [], + ("pvremove", (RErr, [Device "device"]), 79, [], [InitEmpty, Always, TestOutputListOfDevices ( [["sfdiskM"; "/dev/sda"; ","]; ["pvcreate"; "/dev/sda1"]; @@ -1995,7 +2054,7 @@ The implementation uses the C command which refuses to wipe physical volumes that contain any volume groups, so you have to remove those first."); - ("set_e2label", (RErr, [String "device"; String "label"]), 80, [], + ("set_e2label", (RErr, [Device "device"; String "label"]), 80, [], [InitBasicFS, Always, TestOutput ( [["set_e2label"; "/dev/sda1"; "testlabel"]; ["get_e2label"; "/dev/sda1"]], "testlabel")], @@ -2008,14 +2067,14 @@ C to C