
From: Eduardo Lima (Etrunko) <eblima@br.ibm.com> This is the first step trying to comply with make distcheck. Those files don't even compile for quite some time, I wonder if they are used by anyone. Signed-off-by: Eduardo Lima (Etrunko) <eblima@br.ibm.com> --- configure.ac | 2 - libxkutil/Makefile.am | 1 - libxkutil/tests/Makefile.am | 10 -- libxkutil/tests/infostore.c | 80 ----------- libxkutil/tests/xml_devices.c | 293 ----------------------------------------- libxkutil/tests/xml_dominfo.c | 73 ---------- libxkutil/tests/xml_tag.c | 95 ------------- libxkutil/tests/xmlgen.c | 58 -------- src/Makefile.am | 1 - src/tests/Makefile.am | 6 - src/tests/test_link.sh | 17 --- 11 files changed, 0 insertions(+), 636 deletions(-) delete mode 100644 libxkutil/tests/Makefile.am delete mode 100644 libxkutil/tests/infostore.c delete mode 100644 libxkutil/tests/xml_devices.c delete mode 100644 libxkutil/tests/xml_dominfo.c delete mode 100644 libxkutil/tests/xml_tag.c delete mode 100644 libxkutil/tests/xmlgen.c delete mode 100644 src/tests/Makefile.am delete mode 100644 src/tests/test_link.sh diff --git a/configure.ac b/configure.ac index 3a7bcff..a1dc3ca 100644 --- a/configure.ac +++ b/configure.ac @@ -141,9 +141,7 @@ AC_CONFIG_FILES([ base_schema/install_base_schema.sh base_schema/Makefile libxkutil/Makefile - libxkutil/tests/Makefile src/Makefile - src/tests/Makefile doc/Makefile Makefile ]) diff --git a/libxkutil/Makefile.am b/libxkutil/Makefile.am index f6abce5..f1adc03 100644 --- a/libxkutil/Makefile.am +++ b/libxkutil/Makefile.am @@ -1,5 +1,4 @@ # Copyright IBM Corp. 2007 -SUBDIRS = tests AM_CFLAGS = $(CFLAGS_STRICT) \ -DLIBVIRTCIM_CONF=\"@sysconfdir@/@PACKAGE@.conf\" diff --git a/libxkutil/tests/Makefile.am b/libxkutil/tests/Makefile.am deleted file mode 100644 index 7c0cdc6..0000000 --- a/libxkutil/tests/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright IBM Corp. 2007 -TESTS = xml_tag.test xml_devices.test xmlgen.test xml_dominfo.test infostore.test - -CFLAGS += -g - -%.test: %.c - $(CC) -o $@ $^ $(CFLAGS) -lvirt `xml2-config --libs` -L../.libs -lxkutil - -clean-local: - rm -f *.test diff --git a/libxkutil/tests/infostore.c b/libxkutil/tests/infostore.c deleted file mode 100644 index df625bb..0000000 --- a/libxkutil/tests/infostore.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright IBM Corp. 2008 - * - * Authors: - * Dan Smith <danms@us.ibm.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <stdio.h> -#include <inttypes.h> - -#include <libvirt/libvirt.h> - -#include "../infostore.h" - -int main(int argc, char **argv) -{ - struct infostore_ctx *ctx = NULL; - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - - if (argc != 2) { - printf("Usage: %s <domain>\n", argv[0]); - return 1; - } - - conn = virConnectOpen(NULL); - if (conn == NULL) { - printf("Unable to open connection\n"); - goto out; - } - - dom = virDomainLookupByName(conn, argv[1]); - if (dom == NULL) { - printf("Unable to lookup domain `%s'\n", argv[1]); - goto out; - } - - ctx = infostore_open(dom); - if (ctx == NULL) { - printf("Unable to open infostore for `%s'\n", argv[1]); - goto out; - } - - printf("Foo: %" PRIu64 "\n", infostore_get_u64(ctx, "foo")); - - infostore_set_u64(ctx, "foo", 321); - infostore_set_u64(ctx, "bar", 987); - printf("Should be (null): %s\n", infostore_get_str(ctx, "baz")); - - out: - infostore_close(ctx); - virDomainFree(dom); - virConnectClose(conn); - - return 0; -} - -/* - * Local Variables: - * mode: C - * c-set-style: "K&R" - * tab-width: 8 - * c-basic-offset: 8 - * indent-tabs-mode: nil - * End: - */ diff --git a/libxkutil/tests/xml_devices.c b/libxkutil/tests/xml_devices.c deleted file mode 100644 index 08b9f04..0000000 --- a/libxkutil/tests/xml_devices.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright IBM Corp. 2007 - * - * Authors: - * Dan Smith <danms@us.ibm.com> - * Zhengang Li <lizg@cn.ibm.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <stdio.h> - -#include "../device_parsing.h" -#include "../device_parsing.c" - -#define STREQ(x, y) (strcmp(x, y) == 0) - -static void print_disk(struct disk_device *dev) -{ - fprintf(stderr, - "type: %s\n" - "device: %s\n" - "driver: %s\n" - "source: %s\n" - "vdev: %s\n", - dev->type, dev->device, dev->driver, - dev->source, dev->virtual_dev); -} - -static void print_net(struct net_device *dev) -{ - fprintf(stderr, - "type: %s\n" - "mac: %s\n", - dev->type, dev->mac); -} - -static void print_dev(struct virt_device *dev) -{ - if (dev->type == VIRT_DEV_DISK) - print_disk(&dev->dev.disk); - else if (dev->type == VIRT_DEV_NET) - print_net(&dev->dev.net); - else - printf("ERROR: Unknown device type %i\n", dev->type); -} - -int main(int argc, char **argv) -{ - struct virt_device *devs; - int count; - char *conf1 = - "<domain type='xen' id='0'>\n" - " <name>sles10foo</name>\n" - " <uuid>7c42b545ffc4eb4441d1be3936516de3</uuid>\n" - " <bootloader>/usr/lib/xen/boot/domUloader.py</bootloader>\n" - " <os>\n" - " <type>linux</type>\n" - " <kernel>/var/lib/xen/tmp/kernel.0F29se</kernel>\n" - " <initrd>/var/lib/xen/tmp/ramdisk.qGK5v5</initrd>\n" - " <cmdline>TERM=xterm </cmdline>\n" - " </os>\n" - " <memory>524288</memory>\n" - " <vcpu>1</vcpu>\n" - " <on_poweroff>destroy</on_poweroff>\n" - " <on_reboot>restart</on_reboot>\n" - " <on_crash>destroy</on_crash>\n" - " <devices>\n" - " <interface type='ethernet'>\n" - " <mac address='00:16:3e:62:d1:bd'/>\n" - " </interface>\n" - " <disk type='file' device='disk'>\n" - " <driver name='file'/>\n" - " <source file='/var/lib/xen/images/sles10/disk0'/>\n" - " <target dev='xvda'/>\n" - " </disk>\n" - " <graphics type='vnc' port='-1'/>\n" - " </devices>\n" - "</domain>\n"; - char *conf2 = - "<domain type='xen' id='0'>\n" - " <name>sles10foo</name>\n" - " <uuid>7c42b545ffc4eb4441d1be3936516de3</uuid>\n" - " <bootloader>/usr/lib/xen/boot/domUloader.py</bootloader>\n" - " <os>\n" - " <type>linux</type>\n" - " <kernel>/var/lib/xen/tmp/kernel.0F29se</kernel>\n" - " <initrd>/var/lib/xen/tmp/ramdisk.qGK5v5</initrd>\n" - " <cmdline>TERM=xterm </cmdline>\n" - " </os>\n" - " <memory>524288</memory>\n" - " <vcpu>1</vcpu>\n" - " <on_poweroff>destroy</on_poweroff>\n" - " <on_reboot>restart</on_reboot>\n" - " <on_crash>destroy</on_crash>\n" - " <devices>\n" - " <disk type='file' device='disk'>\n" - " <driver name='file'/>\n" - " <source file='/var/lib/xen/images/foo/bar'/>\n" - " <target dev='xvdb'/>\n" - " </disk>\n" - " <interface type='ethernet'>\n" - " <mac address='00:16:3e:62:d1:bd'/>\n" - " </interface>\n" - " <interface type='ethernet'>\n" - " <mac address='00:11:22:33:44:55'/>\n" - " </interface>\n" - " <disk type='file' device='disk'>\n" - " <driver name='file'/>\n" - " <source file='/var/lib/xen/images/sles10/disk0'/>\n" - " <target dev='xvda'/>\n" - " </disk>\n" - " <graphics type='vnc' port='-1'/>\n" - " </devices>\n" - "</domain>\n"; - char *conf3 = "snarf"; - char *conf4 = - "<domain type='xen' id='0'>\n" - " <devices>\n" - " <disk type='file' device='disk'>\n" - " <driver name='file'/>\n" - " <target dev='xvdb'/>\n" - " </disk>\n" - " <interface type='ethernet'>\n" - " <mac address='00:16:3e:62:d1:bd'/>\n" - " </interface>\n" - " <interface type='ethernet'>\n" - " </interface>\n" - " <disk type='file' device='disk'>\n" - " <driver name='file'/>\n" - " <source file='/disk0'/>\n" - " <target dev='xvda'/>\n" - " </disk>\n" - " <graphics type='vnc' port='-1'/>\n" - " </devices>\n" - "</domain>\n"; - - count = parse_devices(conf1, &devs, VIRT_DEV_DISK); - if (count != 1) { - fprintf(stderr, "Failed to find disk in config\n"); - return 1; - } - - if (! (STREQ(devs->dev.disk.type, "file") && - STREQ(devs->dev.disk.device, "disk") && - STREQ(devs->dev.disk.driver, "file") && - STREQ(devs->dev.disk.source, "/var/lib/xen/images/sles10/disk0") && - STREQ(devs->dev.disk.virtual_dev, "xvda"))) { - fprintf(stderr, "Failed to validate domain contents:\n"); - print_dev(devs); - return 1; - } - - cleanup_virt_device(devs); - free(devs); - - count = parse_devices(conf2, &devs, VIRT_DEV_DISK); - if (count != 2) { - fprintf(stderr, "Failed to find both disks in config\n"); - return 1; - } - - if (! (STREQ(devs[0].dev.disk.type, "file") && - STREQ(devs[0].dev.disk.device, "disk") && - STREQ(devs[0].dev.disk.driver, "file") && - STREQ(devs[0].dev.disk.source, "/var/lib/xen/images/foo/bar") && - STREQ(devs[0].dev.disk.virtual_dev, "xvdb"))) { - fprintf(stderr, "Failed to validate domain contents:\n"); - print_dev(&devs[0]); - return 1; - } - - if (! (STREQ(devs[1].dev.disk.type, "file") && - STREQ(devs[1].dev.disk.device, "disk") && - STREQ(devs[1].dev.disk.driver, "file") && - STREQ(devs[1].dev.disk.source, "/var/lib/xen/images/sles10/disk0") && - STREQ(devs[1].dev.disk.virtual_dev, "xvda"))) { - fprintf(stderr, "Failed to validate domain contents:\n"); - print_dev(&devs[1]); - return 1; - } - - cleanup_virt_devices(&devs, count); - free(devs); - - count = parse_devices(conf4, &devs, VIRT_DEV_DISK); - if (count != 1) { - fprintf(stderr, "Failed to bypass non-valid disk node.%d\n", count); - return 1; - } - - if (! (STREQ(devs[0].dev.disk.type, "file") && - STREQ(devs[0].dev.disk.device, "disk") && - STREQ(devs[0].dev.disk.driver, "file") && - STREQ(devs[0].dev.disk.source, "/disk0") && - STREQ(devs[0].dev.disk.virtual_dev, "xvda"))) { - fprintf(stderr, "Failed to validate valide disk info:\n"); - print_dev(&devs[0]); - return 1; - } - - cleanup_virt_devices(&devs, count); - free(devs); - - count = parse_devices(conf3, &devs, VIRT_DEV_DISK); - if ((count != 0) || (devs != NULL)) { - fprintf(stderr, "Failed to fail on bad config string\n"); - return 1; - } - - - count = parse_devices(conf1, &devs, VIRT_DEV_NET); - if (count != 1) { - fprintf(stderr, "Failed to find interface in config\n"); - return 1; - } - - if (! (STREQ(devs->dev.net.type, "ethernet") && - STREQ(devs->dev.net.mac, "00:16:3e:62:d1:bd"))) { - fprintf(stderr, "Failed to validate interface config:\n"); - print_dev(devs); - } - - cleanup_virt_device(devs); - free(devs); - - count = parse_devices(conf2, &devs, VIRT_DEV_NET); - if (count != 2) { - fprintf(stderr, "Failed to find both interfaces in config\n"); - return 1; - } - - if (! (STREQ(devs[0].dev.net.type, "ethernet") && - STREQ(devs[0].dev.net.mac, "00:16:3e:62:d1:bd"))) { - fprintf(stderr, "Failed to validate interface config:\n"); - print_dev(&devs[0]); - return 1; - } - - if (! (STREQ(devs[1].dev.net.type, "ethernet") && - STREQ(devs[1].dev.net.mac, "00:11:22:33:44:55"))) { - fprintf(stderr, "Failed to validate interface config:\n"); - print_dev(&devs[1]); - return 1; - } - - cleanup_virt_devices(&devs, count); - free(devs); - - count = parse_devices(conf4, &devs, VIRT_DEV_NET); - if (count !=1) { - fprintf(stderr, "Failed to bypass non-valid interface info.\n"); - return 1; - } - - if (! (STREQ(devs[0].dev.net.type, "ethernet") && - STREQ(devs[0].dev.net.mac, "00:16:3e:62:d1:bd"))) { - fprintf(stderr, "Failed to validate interface config:\n"); - print_dev(&devs[0]); - return 1; - } - cleanup_virt_devices(&devs, count); - free(devs); - - count = parse_devices(conf3, &devs, VIRT_DEV_NET); - if ((count != 0) || (devs != NULL)) { - fprintf(stderr, "Failed to fail on bad config string\n"); - return 1; - } - - return 0; -} - -/* - * Local Variables: - * mode: C - * c-set-style: "K&R" - * tab-width: 8 - * c-basic-offset: 8 - * indent-tabs-mode: nil - * End: - */ diff --git a/libxkutil/tests/xml_dominfo.c b/libxkutil/tests/xml_dominfo.c deleted file mode 100644 index eb39a84..0000000 --- a/libxkutil/tests/xml_dominfo.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright IBM Corp. 2007 - * - * Authors: - * Dan Smith <danms@us.ibm.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "../device_parsing.h" -#include "../device_parsing.c" - -const char *xml = -"<domain type='xen' id='2'>" -" <name>pv1</name>" -" <uuid>a3be4e7c539a3fb734648b11819bd9c3</uuid>" -" <bootloader>/usr/lib/xen/boot/domUloader.py</bootloader>" -" <bootloader_args>--entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen</bootloader_args>" -" <os>" -" <type>linux</type>" -" <kernel>/var/lib/xen/tmp/kernel.5ihM-L</kernel>" -" <initrd>/var/lib/xen/tmp/ramdisk.G2vsaq</initrd>" -" <cmdline>TERM=xterm </cmdline>" -" </os>" -" <memory>524288</memory>" -" <vcpu>1</vcpu>" -" <on_poweroff>destroy</on_poweroff>" -" <on_reboot>restart</on_reboot>" -" <on_crash>destroy</on_crash>" -" <devices>" -" <interface type='bridge'>" -" <mac address='00:16:3e:3a:83:91'/>" -" <script path='vif-bridge'/>" -" </interface>" -" <disk type='file' device='disk'>" -" <driver name='file'/>" -" <source file='/var/lib/xen/images/pv1/disk0'/>" -" <target dev='xvda'/>" -" </disk>" -" <input type='mouse' bus='xen'/>" -" <graphics type='vnc' port='5900'/>" -" <console tty='/dev/pts/3'/>" -" </devices>" - "</domain>"; - - -int main(int argc, char **argv) -{ - struct domain dom; - struct domain *domptr = &dom; - - _get_dominfo(xml, &dom); - - printf("Name: %s\n" - "UUID: %s\n" - "Bootloader: %s\n", - dom.name, dom.uuid, dom.bootloader); - - //cleanup_dominfo(& - - return 0; -} diff --git a/libxkutil/tests/xml_tag.c b/libxkutil/tests/xml_tag.c deleted file mode 100644 index af37371..0000000 --- a/libxkutil/tests/xml_tag.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright IBM Corp. 2007 - * - * Authors: - * Dan Smith <danms@us.ibm.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <stdio.h> - -#include "../device_parsing.c" - -int main(int argc, char **argv) -{ - char *tag1 = "<disk type='file' device='disk'>"; - char *tag2 = "<source file='/path/to/foo'>"; - char *tag3 = "<devices>"; - char *val; - - val = get_tag_attr(tag1, "type"); - if (!val || (strcmp(val, "file") != 0)) { - fprintf(stderr, "Failed to extract tag `type': %s\n", val); - return 1; - } - - free(val); - - val = get_tag_attr(tag1, "device"); - if (!val || (strcmp(val, "disk") != 0)) { - fprintf(stderr, "Failed to extract tag `device': %s\n", val); - return 1; - } - - free(val); - - val = get_tag_attr(tag2, "file"); - if (!val || (strcmp(val, "/path/to/foo") != 0)) { - fprintf(stderr, "Failed to extract tag `file': %s\n", val); - return 1; - } - - free(val); - - val = get_tag_attr(tag2, "foo"); - if (val) { - fprintf(stderr, "Got value for invalid tag `foo': %s\n", val); - return 1; - } - - val = get_tag_attr(tag3, "bar"); - if (val) { - fprintf(stderr, "Got value for invalid tag `bar': %s\n", val); - return 1; - } - - val = get_tag_name(tag1); - if (!val || (strcmp(val, "disk") != 0)) { - fprintf(stderr, "Got tag `%s' instead of `disk'\n", val); - //return 1; - } - - free(val); - - val = get_tag_name(tag3); - if (!val || (strcmp(val, "devices") != 0)) { - fprintf(stderr, "Got tag `%s' instead of `devices'\n", val); - return 1; - } - - free(val); - - return 0; -} - -/* - * Local Variables: - * mode: C - * c-set-style: "K&R" - * tab-width: 8 - * c-basic-offset: 8 - * indent-tabs-mode: nil - * End: - */ diff --git a/libxkutil/tests/xmlgen.c b/libxkutil/tests/xmlgen.c deleted file mode 100644 index 2d3b2e2..0000000 --- a/libxkutil/tests/xmlgen.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright IBM Corp. 2007 - * - * Authors: - * Dan Smith <danms@us.ibm.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <stdio.h> - -#define TEST - -#include "../xmlgen.h" -#include "../xmlgen.c" - -int main(int argc, char **argv) -{ - char *tmp; - struct kv test = {"bar", "baz"}; - - tmp = tagify("foo", "bar", NULL, 0); - if (strcmp(tmp, "<foo>bar</foo>") != 0) { - fprintf(stderr, "Failed to tagify: %s\n", tmp); - return 1; - } - - free(tmp); - - tmp = tagify("foo", NULL, &test, 1); - if (strcmp(tmp, "<foo bar='baz'/>") != 0) { - fprintf(stderr, "Failed tagify with attr: %s\n", tmp); - return 1; - } - - free(tmp); - - tmp = tagify("foo", "bar", &test, 1); - if (strcmp(tmp, "<foo bar='baz'>bar</foo>") != 0) { - fprintf(stderr, "Failed to tagify with attr/content: %s\n", tmp); - return 1; - } - - free(tmp); - - return 0; -} diff --git a/src/Makefile.am b/src/Makefile.am index e4e8aa1..c28dc9a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,4 @@ # Copyright IBM Corp. 2007 -SUBDIRS = tests noinst_HEADERS = profiles.h svpc_types.h \ Virt_ComputerSystem.h \ diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am deleted file mode 100644 index 8225afb..0000000 --- a/src/tests/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright IBM Corp. 2007 -TESTS = test_link.test - -%.test: %.sh - cp $< $@ - chmod +x $@ \ No newline at end of file diff --git a/src/tests/test_link.sh b/src/tests/test_link.sh deleted file mode 100644 index 78a0c03..0000000 --- a/src/tests/test_link.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -test_lib() { - LD_BIND_NOW=y LD_PRELOAD=$1 /bin/true 2>&1 - - if [ $? = 0 ]; then - echo Link of $(basename $lib) tested OK - return 0 - else - echo Link of $(basename $lib) FAILED - return 1 - fi -} - -for lib in ../.libs/*.so; do - (test_lib $lib) || exit 255 -done -- 1.7.4.4