X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=aecb152b17ae57b8e1e5c941b3f7ba42fd13d7ee;hp=1342c38ea9b87e0f59d7ff802b6dc31dee9c5d14;hb=5af058b7d02607dcbcfb8f561cc0b8fec9a7d305;hpb=d164ae963297a99e2222bc32b11928c1635c45d8 diff --git a/src/generator.ml b/src/generator.ml index 1342c38..aecb152 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2131,7 +2131,13 @@ The returned strings are transcoded to UTF-8."); ("hexdump", (RString "dump", [String "path"]), 96, [ProtocolLimitWarning], [InitBasicFS, Always, TestOutput ( [["write_file"; "/new"; "hello\nworld\n"; "12"]; - ["hexdump"; "/new"]], "00000000 68 65 6c 6c 6f 0a 77 6f 72 6c 64 0a |hello.world.|\n0000000c\n")], + ["hexdump"; "/new"]], "00000000 68 65 6c 6c 6f 0a 77 6f 72 6c 64 0a |hello.world.|\n0000000c\n"); + (* Test for RHBZ#501888c2 regression which caused large hexdump + * commands to segfault. + *) + InitBasicFS, Always, TestRun ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["hexdump"; "/100krandom"]])], "dump a file in hexadecimal", "\ This runs C on the given C. The result is @@ -2167,7 +2173,7 @@ or data on the filesystem."); This resizes (expands or shrinks) an existing LVM physical volume to match the new size of the underlying device."); - ("sfdisk_N", (RErr, [String "device"; Int "n"; + ("sfdisk_N", (RErr, [String "device"; Int "partnum"; Int "cyls"; Int "heads"; Int "sectors"; String "line"]), 99, [DangerWillRobinson], [], @@ -2467,6 +2473,33 @@ directory and its contents after use. See also: L"); + ("wc_l", (RInt "lines", [String "path"]), 118, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_l"; "/10klines"]], 10000)], + "count lines in a file", + "\ +This command counts the lines in a file, using the +C external command."); + + ("wc_w", (RInt "words", [String "path"]), 119, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_w"; "/10klines"]], 10000)], + "count words in a file", + "\ +This command counts the words in a file, using the +C external command."); + + ("wc_c", (RInt "chars", [String "path"]), 120, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_c"; "/100kallspaces"]], 102400)], + "count characters in a file", + "\ +This command counts the characters in a file, using the +C external command."); + ] let all_functions = non_daemon_functions @ daemon_functions @@ -2747,8 +2780,8 @@ let check_functions () = failwithf "%s has a param/ret called 'value', which causes conflicts in the OCaml bindings, use something like 'val' or a more descriptive name" name; if n = "int" || n = "char" || n = "short" || n = "long" then failwithf "%s has a param/ret which conflicts with a C type (eg. 'int', 'char' etc.)" name; - if n = "i" then - failwithf "%s has a param/ret called 'i', which will cause some conflicts in the generated code" name; + if n = "i" || n = "n" then + failwithf "%s has a param/ret called 'i' or 'n', which will cause some conflicts in the generated code" name; if n = "argv" || n = "args" then failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name in @@ -4154,6 +4187,9 @@ static int %s_skip (void) { const char *str; + str = getenv (\"TEST_ONLY\"); + if (str) + return strstr (str, \"%s\") == NULL; str = getenv (\"SKIP_%s\"); if (str && strcmp (str, \"1\") == 0) return 1; str = getenv (\"SKIP_TEST_%s\"); @@ -4161,7 +4197,7 @@ static int %s_skip (void) return 0; } -" test_name (String.uppercase test_name) (String.uppercase name); +" test_name name (String.uppercase test_name) (String.uppercase name); (match prereq with | Disabled | Always -> () @@ -4177,7 +4213,7 @@ static int %s_skip (void) static int %s (void) { if (%s_skip ()) { - printf (\"%%s skipped (reason: SKIP_TEST_* variable set)\\n\", \"%s\"); + printf (\"%%s skipped (reason: environment variable set)\\n\", \"%s\"); return 0; }