From: Filippo Giunchedi Date: Sun, 7 Jun 2009 19:48:45 +0000 (+0200) Subject: test/: update API usage X-Git-Tag: lxc_0_6_3~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e610d7f1de2bfb8dcc4118419294cda2ee60004;p=thirdparty%2Flxc.git test/: update API usage Hi, I've been playing with lxc, though with --enable-test the test/ directory doesn't compile, the following patch ought to fix this. I've not tested tests throughly but seems straightforward enough. Update the API usage in test/ as to make tests compile Signed-off-by: Daniel Lezcano --- diff --git a/test/Makefile.am b/test/Makefile.am index bbc47e961..b91686944 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,5 +1,7 @@ if ENABLE_TEST +AM_LDFLAGS = -lutil + INCLUDES= -I$(top_srcdir)/src noinst_PROGRAMS = \ @@ -29,7 +31,8 @@ tst_list_LDADD = \ confile_SOURCES = confile.c confile_LDADD = \ - $(top_builddir)/src/lxc/lxc_config.o \ + $(top_builddir)/src/lxc/conf.o \ + $(top_builddir)/src/lxc/confile.o \ $(top_builddir)/src/lxc/liblxc.la conf_SOURCES = conf.c @@ -96,4 +99,4 @@ lxc_state_SOURCES = lxc_state.c lxc_state_LDADD = \ $(top_builddir)/src/lxc/liblxc.la -endif \ No newline at end of file +endif diff --git a/test/conf.c b/test/conf.c index 441e3413c..1ba500362 100644 --- a/test/conf.c +++ b/test/conf.c @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include /* * I want to setup a container with a veth attached on a bridge, diff --git a/test/confile.c b/test/confile.c index af82bf99d..10bed6419 100644 --- a/test/confile.c +++ b/test/confile.c @@ -31,7 +31,8 @@ #include #include -#include +#include +#include static void usage(const char *cmd) { @@ -59,7 +60,7 @@ int main(int argc, char *argv[]) if (!file || !name) usage(argv[0]); - if (lxc_config_init(&lxc_conf)) { + if (lxc_conf_init(&lxc_conf)) { fprintf(stderr, "failed to initialize configuration structure\n"); return 1; } diff --git a/test/dev.c b/test/dev.c index 82752369c..b19af4420 100644 --- a/test/dev.c +++ b/test/dev.c @@ -60,11 +60,11 @@ int main(int argc, char *argv[]) } if (destroy) - ret = device_delete(ifname); + ret = lxc_device_delete(ifname); else if (!strcmp(flag, "up")) - ret = device_up(ifname); + ret = lxc_device_up(ifname); else if (!strcmp(flag, "down")) - ret = device_down(ifname); + ret = lxc_device_down(ifname); if (ret) { fprintf(stderr, "failed to set %s: %s\n", diff --git a/test/forward.c b/test/forward.c index 81fead528..1628d1a5f 100644 --- a/test/forward.c +++ b/test/forward.c @@ -59,9 +59,9 @@ int main(int argc, char *argv[]) } if (!strcmp(flag, "on")) - ret = ip_forward_on(ifname, family); + ret = lxc_ip_forward_on(ifname, family); else if (!strcmp(flag, "off")) - ret = ip_forward_off(ifname, family); + ret = lxc_ip_forward_off(ifname, family); else { usage(argv[0]); return 1; diff --git a/test/ipv4_add.c b/test/ipv4_add.c index bcd0cf9d4..84046d213 100644 --- a/test/ipv4_add.c +++ b/test/ipv4_add.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; } - ret = ip_addr_add(ifname, addr, 24, NULL); + ret = lxc_ip_addr_add(ifname, addr, 24, NULL); if (ret) { fprintf(stderr, "failed to set %s: %s\n", ifname, strerror(-ret)); diff --git a/test/ipv6_add.c b/test/ipv6_add.c index 20fc098c9..13de06fc2 100644 --- a/test/ipv6_add.c +++ b/test/ipv6_add.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; } - ret = ip6_addr_add(ifname, addr, 64, NULL); + ret = lxc_ip6_addr_add(ifname, addr, 64, NULL); if (ret) { fprintf(stderr, "failed to set %s: %s\n", ifname, strerror(-ret)); diff --git a/test/lxc_low_monitor.c b/test/lxc_low_monitor.c index 02267d5ac..318be2538 100644 --- a/test/lxc_low_monitor.c +++ b/test/lxc_low_monitor.c @@ -51,15 +51,17 @@ int main(int argc, char *argv[]) if (!name) usage(argv[0]); - fd = lxc_monitor_open(name); + fd = lxc_monitor_open(); if (fd < 0) { fprintf(stderr, "failed to open monitor\n"); return -1; } for (;;) { - lxc_state_t state; - lxc_monitor_read(fd, &state); - printf("received changing state '%s'\n", lxc_state2str(state)); + 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/macvlan.c b/test/macvlan.c index 4401d4f36..aad50d8f3 100644 --- a/test/macvlan.c +++ b/test/macvlan.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; } - ret = macvlan_create(ifname, peer); + ret = lxc_macvlan_create(ifname, peer); if (ret) { fprintf(stderr, "failed to set %s/%s: %s\n", ifname, peer, strerror(-ret)); diff --git a/test/movedev.c b/test/movedev.c index 592434a12..1c4d9c353 100644 --- a/test/movedev.c +++ b/test/movedev.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; } - if (device_move(ifname, pid)) { + if (lxc_device_move(ifname, pid)) { fprintf(stderr, "failed to move %s\n", ifname); return 1; } diff --git a/test/proxy.c b/test/proxy.c index f82f492c2..97ed88678 100644 --- a/test/proxy.c +++ b/test/proxy.c @@ -59,9 +59,9 @@ int main(int argc, char *argv[]) } if (!strcmp(flag, "on")) - ret = neigh_proxy_on(ifname, family); + ret = lxc_neigh_proxy_on(ifname, family); else if (!strcmp(flag, "off")) - ret = neigh_proxy_off(ifname, family); + ret = lxc_neigh_proxy_off(ifname, family); else { usage(argv[0]); return 1; diff --git a/test/tst_list.c b/test/tst_list.c index 933b692bb..8b8816bc2 100644 --- a/test/tst_list.c +++ b/test/tst_list.c @@ -1,6 +1,6 @@ #include #include -#include +#include int main(int argc, char *argv[]) { diff --git a/test/veth.c b/test/veth.c index 58a784c4d..a47c62f32 100644 --- a/test/veth.c +++ b/test/veth.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; } - ret = veth_create(ifname, peer); + ret = lxc_veth_create(ifname, peer); if (ret) { fprintf(stderr, "failed to set %s/%s: %s\n", ifname, peer, strerror(-ret));