[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 5/5] golang/xenlight: Add tests host related functionality functions



Ronald Rojas writes ("[PATCH v2 5/5] golang/xenlight: Add tests host related 
functionality functions"):
> Create tests for the following functions:
> - GetVersionInfo
> - GetPhysinfo
> - GetDominfo
> - GetMaxCpus
> - GetOnlineCpus
> - GetMaxNodes
> - GetFreeMemory

I assume this whole series is RFC still ?

I don't feel competent to review the golang code.  But I did spot some
C to review :-)

> diff --git a/tools/golang/xenlight/test/xeninfo/freememory.c 
> b/tools/golang/xenlight/test/xeninfo/freememory.c
> new file mode 100644
> index 0000000..04ee90d
> --- /dev/null
> +++ b/tools/golang/xenlight/test/xeninfo/freememory.c
> @@ -0,0 +1,24 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <libxl.h>
> +#include "print.h"
> +
> +int main(){

This is an unusual definition of main.  (I think it's still legal, but
probably not what you meant.)

> +    libxl_ctx *context;
> +    libxl_ctx_alloc(&context,LIBXL_VERSION, 0, NULL);
> +
> +    uint64_t free_memory;
> +    int err = libxl_get_free_memory(context, &free_memory);
> +    if (err < 0)
> +    {
> +        printf("%d\n", err);
> +    }
> +    else
> +    {
> +        printf("%lu\n", free_memory);
> +    }

This output is ambiguous.

> +    libxl_ctx_free(context);
> +
> +}

Returns from main without returning a value.  Error code is lost.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.