[libvirt] [PATCH] openvz: Add simple testcase for config file parsing function

Eric Blake eblake at redhat.com
Thu May 26 19:49:36 UTC 2011


On 05/26/2011 12:06 PM, Matthias Bolte wrote:
> This testcase passes before the regression is added in f0443765, fails
> after that commit and passes again after the regression was fixed.
> ---
>  src/openvz/openvz_conf.c   |    2 +-
>  src/openvz/openvz_conf.h   |    1 +
>  tests/Makefile.am          |   18 +++++++++
>  tests/openvzutilstest.c    |   91 ++++++++++++++++++++++++++++++++++++++++++++
>  tests/openvzutilstest.conf |   41 ++++++++++++++++++++
>  5 files changed, 152 insertions(+), 1 deletions(-)
>  create mode 100644 tests/openvzutilstest.c
>  create mode 100644 tests/openvzutilstest.conf

More tests are always good.

> 
> diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
> index 3e4844a..3dc6b37 100644
> --- a/src/openvz/openvz_conf.c
> +++ b/src/openvz/openvz_conf.c
> @@ -645,7 +645,7 @@ openvzWriteVPSConfigParam(int vpsid, const char *param, const char *value)
>   *
>   * Returns <0 on error, 0 if not found, 1 if found.
>   */
> -static int
> +int
>  openvzReadConfigParam(const char *conf_file, const char *param, char **value)

Will this work with './configure --with-driver-modules', or do we also
need to add it to some libvirt_xxx.syms somewhere?

[Speaking of --with-driver-modules, it's not working for me at the
moment, so that's something we should probably try to address before
0.9.2 if possible]

> +#else
> +
> +int main(void)
> +{
> +    return 77; /* means 'test skipped' for automake */

s/77/EXIT_AM_SKIP/ from testutils.h, to avoid a magic number.

ACK with that nit fixed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110526/a963f33e/attachment-0001.sig>


More information about the libvir-list mailing list