
On 09/23/2013 05:46 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Start a test case for the virNetServerClient object, which initially checks the creation of a virIdentityPtr object.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
exclude_file_name_regexp--sc_prohibit_strdup = \ - ^(docs/|examples/|python/|src/util/virstring\.c$$) + ^(docs/|examples/|python/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
Makes sense that our mock app should not be relying on the utility library, but be as close to C as possible.
+ +virnetserverclientmock_la_SOURCES = \ + virnetserverclientmock.c +virnetserverclientmock_la_CFLAGS = $(AM_CFLAGS) +virnetserverclientmock_la_LDFLAGS = -module -avoid-version \ + -rpath /evil/libtool/hack/to/force/shared/lib/creation
The mock library only makes sense under Linux where we can use LD_PRELOAD hacks; but this makefile magic doesn't seem to do any conditionals...
+++ b/tests/virnetserverclientmock.c
+ +#include <config.h> + +#include "rpc/virnetsocket.h" +#include "virutil.h" +#include "internal.h"
...should THIS file be doing some #ifdef __linux__ to provide a harmless version that will compile on mingw?
+++ b/tests/virnetserverclienttest.c @@ -0,0 +1,159 @@
+ +#include <config.h> + +#include "testutils.h" +#include "virerror.h" +#include "rpc/virnetserverclient.h"
Likewise for this file.
+ +#define VIR_FROM_THIS VIR_FROM_RPC + +#ifdef HAVE_SOCKETPAIR +static int testIdentity(const void *opaque ATTRIBUTE_UNUSED) +{
filtering on HAVE_SOCKETPAIR is okay to avoid problems on mingw...
+#else +static int +mymain(void) +{ + return AM_TEST_SKIP; +} +#endif +VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetserverclientmock.so")
but VIRT_TEST_MAIN_PRELOAD seems like it might not work on non-Linux. ACK if you have verified that ./autobuild.sh still passes on a setup with mingw cross-compilation enabled. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org