From: Daniel Lezcano Date: Thu, 22 Oct 2009 13:33:40 +0000 (+0200) Subject: remove test directory X-Git-Tag: lxc_0_6_4~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92d385229be040cf034ac6efd9405b7bdfe06a3e;p=thirdparty%2Flxc.git remove test directory These tests are not relevant now. It would be better to write some real test cases with some script using the lxc cli in order to check non regression. I remove these annoying tests I have to port each time a function prototype is changed. Signed-off-by: Daniel Lezcano --- diff --git a/Makefile.am b/Makefile.am index 343e93a0f..3933d2a95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,8 +2,8 @@ ACLOCAL_AMFLAGS = -I config -SUBDIRS = src test etc scripts doc -DIST_SUBDIRS = config src test etc scripts doc +SUBDIRS = src etc scripts doc +DIST_SUBDIRS = config src etc scripts doc EXTRA_DIST = autogen.sh lxc.spec CONTRIBUTING MAINTAINERS ChangeLog pcdatadir = $(datadir)/pkgconfig diff --git a/configure.ac b/configure.ac index f79e1f07b..3e68ed638 100644 --- a/configure.ac +++ b/configure.ac @@ -50,9 +50,6 @@ LXC_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1) LXC_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2) LXC_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3) -AC_ARG_ENABLE(test, [ --enable-test compile test program [default=no]],, enable_test=no) -AM_CONDITIONAL(ENABLE_TEST, test x$enable_test = xyes) - AC_SUBST(LXC_MAJOR_VERSION) AC_SUBST(LXC_MINOR_VERSION) AC_SUBST(LXC_MICRO_VERSION) @@ -103,8 +100,6 @@ AC_CONFIG_FILES([ etc/lxc-phys.conf etc/lxc-veth.conf etc/lxc-complex-config - - test/Makefile ]) AC_CONFIG_COMMANDS([default],[[]],[[]]) AC_OUTPUT diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index e84ab128d..000000000 --- a/test/Makefile.am +++ /dev/null @@ -1,97 +0,0 @@ -if ENABLE_TEST - -AM_LDFLAGS = -lutil - -INCLUDES= -I$(top_srcdir)/src - -noinst_PROGRAMS = \ - tst_list \ - confile \ - conf \ - movedev \ - dev \ - forward \ - proxy \ - veth \ - macvlan \ - ipv4_add \ - ipv6_add \ - \ - lxc_create \ - lxc_destroy \ - lxc_start \ - lxc_stop \ - lxc_low_monitor \ - lxc_state - -tst_list_SOURCES = tst_list.c -tst_list_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -confile_SOURCES = confile.c -confile_LDADD = \ - $(top_builddir)/src/lxc/conf.o \ - $(top_builddir)/src/lxc/confile.o \ - $(top_builddir)/src/lxc/liblxc.la - -conf_SOURCES = conf.c -conf_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -movedev_SOURCES = movedev.c -movedev_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -dev_SOURCES = dev.c -dev_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -forward_SOURCES = forward.c -forward_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -proxy_SOURCES = proxy.c -proxy_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -veth_SOURCES = veth.c -veth_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -macvlan_SOURCES = macvlan.c -macvlan_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -ipv4_add_SOURCES = ipv4_add.c -ipv4_add_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -ipv6_add_SOURCES = ipv6_add.c -ipv6_add_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_create_SOURCES = lxc_create.c -lxc_create_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_destroy_SOURCES = lxc_destroy.c -lxc_destroy_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_start_SOURCES = lxc_start.c -lxc_start_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_stop_SOURCES = lxc_stop.c -lxc_stop_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_low_monitor_SOURCES = lxc_low_monitor.c -lxc_low_monitor_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -lxc_state_SOURCES = lxc_state.c -lxc_state_LDADD = \ - $(top_builddir)/src/lxc/liblxc.la - -endif diff --git a/test/conf.c b/test/conf.c deleted file mode 100644 index 1ba500362..000000000 --- a/test/conf.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include -#include - -/* - * I want to setup a container with a veth attached on a bridge, - * and have them up - */ - -int main(int argc, char *argv[]) -{ -/* struct network network = { */ -/* .net = init_list(&network.net), */ -/* .netdev = init_list(&network.netdev), */ -/* }; */ - -/* struct veth veth = { */ -/* .link = "veth1", */ -/* .peer = "veth2", */ -/* .bridge = "br0", */ -/* }; */ - -/* struct net net = { */ -/* .type = VETH, */ -/* }; */ - -/* net.veth = veth; */ - -/* struct netdev lo = { */ -/* .ifname = "lo", */ -/* .flags = IFF_UP, */ -/* .ipv4 = init_list(&lo.ipv4), */ -/* .ipv6 = init_list(&lo.ipv6), */ -/* }; */ - -/* struct netdev veth1 = { */ -/* .ifname = "veth1", */ -/* .flags = IFF_UP, */ -/* .ipv4 = init_list(&veth1.ipv4), */ -/* .ipv6 = init_list(&veth1.ipv6), */ -/* }; */ - -/* struct netdev veth2 = { */ -/* .ifname = "veth2", */ -/* .flags = IFF_UP, */ -/* .netns = 1, */ -/* .ipv4 = init_list(&veth2.ipv4), */ -/* .ipv6 = init_list(&veth2.ipv6), */ -/* }; */ - -/* struct netdev br0 = { */ -/* .ifname = "br0", */ -/* .ipv4 = init_list(&br0.ipv4), */ -/* .ipv6 = init_list(&br0.ipv6), */ -/* }; */ - -/* list_add(&network.netdev, &lo.list); */ -/* list_add(&network.netdev, &veth1.list); */ -/* list_add(&network.netdev, &veth2.list); */ -/* list_add(&network.netdev, &br0.list); */ -/* list_add(&network.net, &net.list); */ - -/* struct lxc_conf lxc_conf = { */ -/* .network = &network, */ -/* .mounts = init_list(&lxc_conf.mounts), */ -/* }; */ - -/* if (lxc_configure("foo", &lxc_conf)) { */ -/* fprintf(stderr, "failed to configure\n"); */ -/* return 1; */ -/* } */ - - return 0; -} diff --git a/test/confile.c b/test/confile.c deleted file mode 100644 index f44d303d2..000000000 --- a/test/confile.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -static void usage(const char *cmd) -{ - fprintf(stderr, "%s -n \n", cmd); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - char *file = NULL, *name = NULL; - struct lxc_conf lxc_conf; - int opt; - - while ((opt = getopt(argc, argv, "n:f:")) != -1) { - switch (opt) { - case 'f': - file = optarg; - break; - case 'n': - name = optarg; - break; - } - } - - if (!file || !name) - usage(argv[0]); - - if (lxc_conf_init(&lxc_conf)) { - fprintf(stderr, "failed to initialize configuration structure\n"); - return 1; - } - - if (lxc_config_read(file, &lxc_conf)) { - fprintf(stderr, "failed to read configuration\n"); - return 1; - } - - if (lxc_create(name, file)) { - fprintf(stderr, "failed to create <%s>\n", name); - return 1; - } - - return 0; -} diff --git a/test/dev.c b/test/dev.c deleted file mode 100644 index b19af4420..000000000 --- a/test/dev.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s -i -d -f \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *flag = NULL; - int opt, destroy = 0, ret = -EINVAL; - - while ((opt = getopt(argc, argv, "i:f:d")) != -1) { - switch (opt) { - case 'i': - ifname = optarg; - break; - case 'f': - flag = optarg; - break; - case 'd': - destroy = 1; - break; - } - } - - if (!ifname || (!flag && !destroy)) { - usage(argv[0]); - return 1; - } - - if (destroy) - ret = lxc_device_delete(ifname); - else if (!strcmp(flag, "up")) - ret = lxc_device_up(ifname); - else if (!strcmp(flag, "down")) - ret = lxc_device_down(ifname); - - if (ret) { - fprintf(stderr, "failed to set %s: %s\n", - ifname, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/forward.c b/test/forward.c deleted file mode 100644 index 1628d1a5f..000000000 --- a/test/forward.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include - -void usage(const char *cmd) -{ - fprintf(stderr, "%s -i -f \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *flag = NULL; - int opt, ret, family = AF_INET; - - while ((opt = getopt(argc, argv, "6i:f:")) != -1) { - switch (opt) { - case 'i': - ifname = optarg; - break; - case 'f': - flag = optarg; - break; - case '6': - family = AF_INET6; - break; - } - } - - if (!ifname || !flag) { - usage(argv[0]); - return 1; - } - - if (!strcmp(flag, "on")) - ret = lxc_ip_forward_on(ifname, family); - else if (!strcmp(flag, "off")) - ret = lxc_ip_forward_off(ifname, family); - else { - usage(argv[0]); - return 1; - } - - if (ret) { - fprintf(stderr, "failed for %s: %s\n", - ifname, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/ipv4_add.c b/test/ipv4_add.c deleted file mode 100644 index 84046d213..000000000 --- a/test/ipv4_add.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s -i -a \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *addr = NULL; - int opt, ret = -EINVAL; - - while ((opt = getopt(argc, argv, "i:a:")) != -1) { - switch (opt) { - case 'a': - addr = optarg; - break; - case 'i': - ifname = optarg; - break; - } - } - - if (!addr || !ifname) { - usage(argv[0]); - return 1; - } - - ret = lxc_ip_addr_add(ifname, addr, 24, NULL); - if (ret) { - fprintf(stderr, "failed to set %s: %s\n", - ifname, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/ipv6_add.c b/test/ipv6_add.c deleted file mode 100644 index 5e7582a1c..000000000 --- a/test/ipv6_add.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s -i -a \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *addr = NULL; - struct in6_addr in6; - int opt, ret = -EINVAL; - - while ((opt = getopt(argc, argv, "i:a:")) != -1) { - switch (opt) { - case 'a': - addr = optarg; - break; - case 'i': - ifname = optarg; - break; - } - } - - if (!addr || !ifname) { - usage(argv[0]); - return 1; - } - - if (inet_pton(AF_INET6, addr, &in6)) { - perror("inet_pton"); - return 1; - } - - ret = lxc_ip_addr_add(AF_INET6, if_nametoindex(ifname), - &in6, 64); - if (ret) { - fprintf(stderr, "failed to set %s: %s\n", - ifname, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/lxc_create.c b/test/lxc_create.c deleted file mode 100644 index 50ab12144..000000000 --- a/test/lxc_create.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static void usage(const char *cmd) -{ - fprintf(stderr, "%s -n \n", cmd); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - const char *name = NULL; - int opt; - - struct lxc_conf lxc_conf; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - } - - if (!name) - usage(argv[0]); - - lxc_conf_init(&lxc_conf); - - if (lxc_create(name, NULL)) { - fprintf(stderr, "failed to create the container %s\n", name); - return 1; - } - - return 0; -} diff --git a/test/lxc_destroy.c b/test/lxc_destroy.c deleted file mode 100644 index a15ec02f9..000000000 --- a/test/lxc_destroy.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include - -#include - -static void usage(const char *cmd) -{ - fprintf(stderr, "%s -n \n", cmd); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - const char *name = NULL; - int opt; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - } - - if (!name) - usage(argv[0]); - - if (lxc_destroy(name)) { - fprintf(stderr, "failed to destroy %s\n", name); - return 1; - } - - return 0; -} diff --git a/test/lxc_low_monitor.c b/test/lxc_low_monitor.c deleted file mode 100644 index 318be2538..000000000 --- a/test/lxc_low_monitor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s \n", basename(cmd)); - fprintf(stderr, "\t -n : name of the container\n"); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - char opt; - char *name = NULL; - int fd; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - } - - if (!name) - usage(argv[0]); - - fd = lxc_monitor_open(); - if (fd < 0) { - fprintf(stderr, "failed to open monitor\n"); - return -1; - } - - for (;;) { - struct lxc_msg msg; - lxc_monitor_read(fd, &msg); - if (msg.type == lxc_msg_state) { - printf("received changing state '%s'\n", lxc_state2str(msg.value)); - } - } -} diff --git a/test/lxc_start.c b/test/lxc_start.c deleted file mode 100644 index 4499ff16f..000000000 --- a/test/lxc_start.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s \n", basename(cmd)); - fprintf(stderr, "\t -n : name of the container\n"); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - char opt; - char *name = NULL; - char **args; - int nbargs = 0; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - - nbargs++; - } - - if (!name || !argv[optind] || !strlen(argv[optind])) - usage(argv[0]); - - args = &argv[optind]; - argc -= nbargs; - - if (lxc_start(name, args)) { - fprintf(stderr, "failed to start %s\n", name); - return 1; - } - - return 0; -} diff --git a/test/lxc_state.c b/test/lxc_state.c deleted file mode 100644 index 017cdcc43..000000000 --- a/test/lxc_state.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s \n", basename(cmd)); - fprintf(stderr, "\t -n : name of the container\n"); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - char opt; - char *name = NULL; - int state; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - } - - if (!name) - usage(argv[0]); - - state = lxc_state(name); - if (state < 0) { - fprintf(stderr, "failed to retrieve the state of %s\n", name); - return 1; - } - - printf("container has the state to %d - %s\n", - state, lxc_state2str(state)); - - - return 0; -} diff --git a/test/lxc_stop.c b/test/lxc_stop.c deleted file mode 100644 index 44bbd0f1b..000000000 --- a/test/lxc_stop.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include - -#include - -void usage(char *cmd) -{ - fprintf(stderr, "%s \n", basename(cmd)); - fprintf(stderr, "\t -n : name of the container\n"); - _exit(1); -} - -int main(int argc, char *argv[]) -{ - char opt; - char *name = NULL; - - while ((opt = getopt(argc, argv, "n:")) != -1) { - switch (opt) { - case 'n': - name = optarg; - break; - } - } - - if (!name) - usage(argv[0]); - - if (lxc_stop(name)) { - fprintf(stderr, "failed to stop %s\n", name); - return 1; - } - - return 0; -} diff --git a/test/macvlan.c b/test/macvlan.c deleted file mode 100644 index aad50d8f3..000000000 --- a/test/macvlan.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include - -void usage(const char *cmd) -{ - fprintf(stderr, "%s -i -p \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *peer = NULL; - int opt, ret = -EINVAL; - - while ((opt = getopt(argc, argv, "i:p:")) != -1) { - switch (opt) { - case 'i': - ifname = optarg; - break; - case 'p': - peer = optarg; - break; - } - } - - if (!ifname || !peer) { - usage(argv[0]); - return 1; - } - - ret = lxc_macvlan_create(ifname, peer); - if (ret) { - fprintf(stderr, "failed to set %s/%s: %s\n", - ifname, peer, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/movedev.c b/test/movedev.c deleted file mode 100644 index 1c4d9c353..000000000 --- a/test/movedev.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include - -#include - -void usage(const char *cmd) -{ - fprintf(stderr, "%s -i -p \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL; - pid_t pid = -1; - int opt; - - while ((opt = getopt(argc, argv, "p:i:")) != -1) { - switch (opt) { - case 'p': - pid = atoi(optarg); - break; - case 'i': - ifname = optarg; - break; - } - } - - if (!ifname || pid == -1) { - usage(argv[0]); - return 1; - } - - if (lxc_device_move(ifname, pid)) { - fprintf(stderr, "failed to move %s\n", ifname); - return 1; - } - - return 0; -} diff --git a/test/proxy.c b/test/proxy.c deleted file mode 100644 index 97ed88678..000000000 --- a/test/proxy.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include - -void usage(const char *cmd) -{ - fprintf(stderr, "%s -i -f \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *flag = NULL; - int opt, ret, family = AF_INET; - - while ((opt = getopt(argc, argv, "6i:f:")) != -1) { - switch (opt) { - case 'i': - ifname = optarg; - break; - case 'f': - flag = optarg; - break; - case '6': - family = AF_INET6; - break; - } - } - - if (!ifname || !flag) { - usage(argv[0]); - return 1; - } - - if (!strcmp(flag, "on")) - ret = lxc_neigh_proxy_on(ifname, family); - else if (!strcmp(flag, "off")) - ret = lxc_neigh_proxy_off(ifname, family); - else { - usage(argv[0]); - return 1; - } - - if (ret) { - fprintf(stderr, "failed for %s: %s\n", - ifname, strerror(-ret)); - return 1; - } - - return 0; -} diff --git a/test/tst_list.c b/test/tst_list.c deleted file mode 100644 index 8b8816bc2..000000000 --- a/test/tst_list.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - struct lxc_list *iterator; - struct lxc_list head = lxc_init_list(&head); - struct lxc_list l1 = lxc_init_list(&l1); - struct lxc_list l2 = lxc_init_list(&l2); - struct lxc_list l3 = lxc_init_list(&l3); - struct lxc_list l4 = lxc_init_list(&l4); - - struct dummy { - int a; - }; - - struct dummy *elem; - struct dummy d1 = { .a = 1 }; - struct dummy d2 = { .a = 2 }; - struct dummy d3 = { .a = 3 }; - struct dummy d4 = { .a = 4 }; - - if (!lxc_list_empty(&head)) { - fprintf(stderr, "expected empty list\n"); - return -1; - } - - l1.elem = &d1; - l2.elem = &d2; - l3.elem = &d3; - l4.elem = &d4; - - lxc_list_add(&head, &l1); - lxc_list_add(&head, &l2); - lxc_list_add(&head, &l3); - lxc_list_add(&head, &l4); - - lxc_list_for_each(iterator, &head) { - elem = iterator->elem; - printf("elem has %d\n", elem->a); - } - - lxc_list_del(&l3); - - lxc_list_for_each(iterator, &head) { - elem = iterator->elem; - printf("elem has %d\n", elem->a); - } - - lxc_list_del(&l1); - lxc_list_del(&l2); - lxc_list_del(&l4); - - if (!lxc_list_empty(&head)) { - fprintf(stderr, "expected empty list\n"); - return -1; - } - - lxc_list_for_each(iterator, &head) { - fprintf(stderr, "should not loop\n"); - return -1; - } - - return 0; -} diff --git a/test/veth.c b/test/veth.c deleted file mode 100644 index a47c62f32..000000000 --- a/test/veth.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include - -#include - -void usage(const char *cmd) -{ - fprintf(stderr, "%s -i -p \n", cmd); -} - -int main(int argc, char *argv[]) -{ - char *ifname = NULL, *peer = NULL; - int opt, ret = -EINVAL; - - while ((opt = getopt(argc, argv, "i:p:")) != -1) { - switch (opt) { - case 'i': - ifname = optarg; - break; - case 'p': - peer = optarg; - break; - } - } - - if (!ifname || !peer) { - usage(argv[0]); - return 1; - } - - ret = lxc_veth_create(ifname, peer); - if (ret) { - fprintf(stderr, "failed to set %s/%s: %s\n", - ifname, peer, strerror(-ret)); - return 1; - } - - return 0; -}