On 03/23/2014 07:17 AM, Roman Bogorodskiy wrote:
At this point unittest covers 4 basic cases:
- minimal working XML for bhyve
- same as above, but with virtio disk
- ACPI and APIC args test
- MAC address test
---
src/util/virnetdevtap.c | 1 -
tests/Makefile.am | 25 ++++
.../bhyvexml2argvdata/bhyvexml2argv-acpiapic.args | 3 +
tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.xml | 24 ++++
tests/bhyvexml2argvdata/bhyvexml2argv-base.args | 3 +
tests/bhyvexml2argvdata/bhyvexml2argv-base.xml | 20 +++
.../bhyvexml2argv-disk-virtio.args | 3 +
.../bhyvexml2argv-disk-virtio.xml | 20 +++
tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args | 3 +
tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.xml | 21 +++
tests/bhyvexml2argvmock.c | 49 +++++++
tests/bhyvexml2argvtest.c | 155 +++++++++++++++++++++
12 files changed, 326 insertions(+), 1 deletion(-)
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-base.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-base.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.xml
create mode 100644 tests/bhyvexml2argvmock.c
create mode 100644 tests/bhyvexml2argvtest.c
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8025e77..4da1d60 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -232,6 +232,10 @@ if WITH_VMWARE
test_programs += vmwarevertest
endif WITH_VMWARE
+if WITH_BHYVE
+test_programs += bhyvexml2argvtest
+endif WITH_BHYVE
+
if WITH_CIL
test_programs += objectlocking
endif WITH_CIL
@@ -353,6 +357,10 @@ test_libraries += libqemumonitortestutils.la \
$(NULL)
endif WITH_QEMU
+if WITH_BHYVE
+test_libraries += bhyvexml2argvmock.la
+endif WITH_BHYVE
+
if WITH_DBUS
test_libraries += virsystemdmock.la
endif WITH_DBUS
@@ -602,6 +610,23 @@ else ! WITH_VMWARE
EXTRA_DIST += vmwarevertest.c
endif ! WITH_VMWARE
+if WITH_BHYVE
+bhyvexml2argvmock_la_SOURCES = \
+ bhyvexml2argvmock.c
+bhyvexml2argvmock_la_CFLAGS = $(AM_CFLAGS)
+bhyvexml2argvmock_la_LDFLAGS = -module -avoid-version \
+ -rpath /evil/libtool/hack/to/force/shared/lib/creation
+
+bhyve_LDADDS = ../src/libvirt_driver_bhyve_impl.la
+bhyve_LDADDS += $(LDADDS)
+bhyvexml2argvtest_SOURCES = \
+ bhyvexml2argvtest.c \
+ testutils.c testutils.h
+bhyvexml2argvtest_LDADD = $(bhyve_LDADDS)
+else ! WITH_BHYVE
+EXTRA_DIST += bhyvexml2argvtest.c
+endif ! WITH_BHYVE
bhyvexml2argvdata should also be in EXTRA_DIST
+
networkxml2xmltest_SOURCES = \
networkxml2xmltest.c \
testutils.c testutils.h
+++ b/tests/bhyvexml2argvmock.c
@@ -0,0 +1,49 @@
+#include <config.h>
+
+#include "util/virstring.h"
+#include "util/virnetdev.h"
+#include "util/virnetdevtap.h"
These should work without the 'util/' too.
+#include "internal.h"
+
+#define VIR_FROM_THIS VIR_FROM_BHYVE
+
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
new file mode 100644
index 0000000..a6ad033
--- /dev/null
+++ b/tests/bhyvexml2argvtest.c
@@ -0,0 +1,155 @@
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "datatypes.h"
+#include "bhyve/bhyve_utils.h"
+#include "bhyve/bhyve_command.h"
+
+#include "testutils.h"
Only config.h and testutils.h are needed without the bhyve driver.
Other than that, looks good to me.
Jan