summaryrefslogtreecommitdiffstats
path: root/generator/generator_capitests.ml
Commit message (Collapse)AuthorAgeFilesLines
* tests: Rename capitests -> tests/c-api.Richard W.M. Jones2011-12-221-955/+0
|
* generator: Support testing the output of RHashtable functions.Richard W.M. Jones2011-11-111-0/+38
| | | | | You can use TestOutputHashtable to test the output of RHashtable functions.
* tests: Fix bitmask parameter when testing optional arguments.Richard W.M. Jones2011-11-091-6/+7
| | | | | | | | The bitmask was being constructed backwards(!) As a result, any test which tested optional arguments didn't work. There are very few such tests and they happened not to be affected by this.
* pclose: Fix other places where we only tested pclose == -1.Richard W.M. Jones2011-08-231-1/+1
| | | | pclose can return > 0 when the status of the command was non-zero.
* capitests: Allow tests to properly test optional arguments.Richard W.M. Jones2011-07-061-13/+31
| | | | | | For optional arguments, you can now specify empty string to mean no argument, except for String optional arguments where you must use "NOARG" (empty string meaning a supplied empty string argument).
* generator: Introduce error code (errcode) concept.Richard W.M. Jones2011-03-071-24/+32
| | | | | | | | There was a lot of repeated code to map return types (eg. RErr) to error cases (eg. -1 or NULL). This commit introduces an error code type and two functions to map return types to error codes and error codes to strings.
* generator: Code to handle optional arguments in daemon functions.Richard W.M. Jones2010-12-021-17/+49
| | | | | | | | Previously we only supported optional arguments for library functions (commit 14490c3e1aac61c6ac90f28828896683f64f0dc9). This extends that work so that optional arguments can also be passed through to the daemon.
* capitests: Add 'InitScratchFS' test environment.Richard W.M. Jones2010-11-301-0/+17
| | | | | | This should allow us to perform filesystem-based write tests much more quickly, because we don't need to recreate the filesystem from scratch each time.
* generator: Add Pointer parameter type to the generator.Richard Jones2010-11-101-0/+4
| | | | | | | | | | | | | | | | | | | This allows generic "foo *bar" pointers to be passed to library functions (not to daemon functions). In the language bindings (except Perl) these are handled as generic int64s with the assumption being that any pointer can be converted to and from this. There is room to add specific support for some pointer types in future by specializing the match cases. However this is inherently tricky because it depends on the implementation details of other bindings (eg. to support virDomainPtr in OCaml depends on the implementation details of the ocaml-libvirt project). Perl is slightly different in that you have to supply a typemap. Again this would depend on the implementation detail of an external library unless you supplied a generic typemap for int64.
* capitests: Use ftruncate instead of seek + write to create test files.Richard W.M. Jones2010-11-031-24/+6
|
* capitests: Don't open test files with O_NONBLOCK.Richard W.M. Jones2010-11-031-3/+3
| | | | I have no idea why we were doing this.
* capitests: Set path in TESTS_ENVIRONMENT instead of in tests.cRichard W.M. Jones2010-11-031-2/+0
| | | | | By exporting LIBGUESTFS_PATH with the right path to the appliance, we no longer need to hard code the path in tests.c
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This large commit changes the generator so that optional arguments can be supported for functions. The model for arguments (known as the "style") is changed from (ret, args) to (ret, args, optargs) where optargs is a more limited list of arguments. One function has been added which takes optional arguments, it is "add-drive-opts", modelled as: (RErr, [String "filename"], #required [Bool "readonly"; String "format"; String "iface"]) #optional Note that this function is processed in the library (does not go over the RPC protocol to the daemon). This has allowed us to simplify the current implementation by omitting changes related to RPC or the daemon, although we plan to add these at some point in the future. From C this function can be called in 3 different ways as in these examples: guestfs_add_drive_opts (g, filename, GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", -1); (the argument(s) between 'filename' and '-1' are the optional ones). guestfs_add_drive_opts_va (g, filename, args); where 'args' is a va_list. This works like the first version. struct guestfs_add_drive_opts_argv optargs = { .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK, .readonly = 1, } guestfs_add_drive_opts_argv (g, filename, &optargs); This last form lets you construct lists of optional arguments, and is used by guestfish and the language bindings. In guestfish optional arguments are used like this: add-drive-opts filename readonly:true In OCaml these are mapped naturally to OCaml optional arguments, eg: g#add_drive_opts ~readonly:true filename; In Perl these are mapped to extra arguments, eg: $g->add_drive_opts ($filename, readonly => 1); In Python these are mapped to optional arguments, eg: g.add_drive_opts ("file", readonly = 1, format = "qcow2") In Ruby these are mapped to a final hash argument, eg: g.add_drive_opts("file", {}) g.add_drive_opts("file", :readonly => 1) g.add_drive_opts("file", :readonly => 1, :iface => "virtio") In PHP these are mapped to extra parameters. This is not quite accurate since you cannot omit arbitrary optional parameters, but there's not much than can be done within the limitations of PHP as a language. Unimplemented in: Haskell, C#, Java.
* generator: Add TestOutputDevice.Richard Jones2010-09-151-0/+13
| | | | | | This is for testing functions that return a device or partition name, so that we can compare the return value with the canonical device name (eg. "/dev/vda1" == "/dev/sda1").
* generator: Calculate MD5 of test.iso at runtime.Richard Jones2010-09-111-0/+35
| | | | | | | | | Because this used to be compiled into the C test, it changed every time the ISO was rebuilt (which because of Makefile deps was every run). Now it is calculated at runtime so the C test file doesn't keep changing.
* Split generator into separate source files.Richard Jones2010-09-111-0/+802
'src/generator.ml' is no more. Instead the generator is logically split up over many different source files. Read generator/README for help and tips. We compile the generator down to bytecode, not native code. This means it will run more slowly, but is done for maximum portability.