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

Matthias Bolte matthias.bolte at googlemail.com
Thu May 26 20:47:55 UTC 2011


2011/5/26 Eric Blake <eblake at redhat.com>:
> 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]

It compiles for me by make check fails in 14 test (but openvzutilstest
works fine), I'll try to fix that.

>> +#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.

Thanks, pushed.

Matthias




More information about the libvir-list mailing list