[lxc-devel] [PATCH 1/1] lxc: tests: use busybox template rather than ubuntu
Stéphane Graber
stgraber at ubuntu.com
Thu Mar 13 00:14:08 UTC 2014
On Wed, Mar 12, 2014 at 06:48:15PM -0500, Serge Hallyn wrote:
> to speed up tests where it doesn't matter
>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/tests/clonetest.c | 2 +-
> src/tests/createtest.c | 2 +-
> src/tests/destroytest.c | 8 ++++----
> src/tests/get_item.c | 2 +-
> src/tests/saveconfig.c | 8 ++++----
> src/tests/shutdowntest.c | 4 ++--
> src/tests/startone.c | 12 ++++++------
> 7 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/src/tests/clonetest.c b/src/tests/clonetest.c
> index efd673e..814706d 100644
> --- a/src/tests/clonetest.c
> +++ b/src/tests/clonetest.c
> @@ -53,7 +53,7 @@ int main(int argc, char *argv[])
> goto out;
> }
> c->save_config(c, NULL);
> - if (!c->createl(c, "ubuntu", NULL, NULL, 0, NULL)) {
> + if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
> fprintf(stderr, "%d: failed to create a container\n", __LINE__);
> goto out;
> }
> diff --git a/src/tests/createtest.c b/src/tests/createtest.c
> index 597dff5..955a851 100644
> --- a/src/tests/createtest.c
> +++ b/src/tests/createtest.c
> @@ -50,7 +50,7 @@ int main(int argc, char *argv[])
> }
> c->set_config_item(c, "lxc.network.link", "lxcbr0");
> c->set_config_item(c, "lxc.network.flags", "up");
> - if (!c->createl(c, "ubuntu", NULL, NULL, 0, "-r", "trusty", NULL)) {
> + if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
> fprintf(stderr, "%d: failed to create a trusty container\n", __LINE__);
> goto out;
> }
> diff --git a/src/tests/destroytest.c b/src/tests/destroytest.c
> index 4d05119..4bb6aae 100644
> --- a/src/tests/destroytest.c
> +++ b/src/tests/destroytest.c
> @@ -28,7 +28,7 @@
>
> #define MYNAME "lxctest1"
>
> -static int create_ubuntu(void)
> +static int create_container(void)
> {
> int status, ret;
> pid_t pid = fork();
> @@ -38,7 +38,7 @@ static int create_ubuntu(void)
> return -1;
> }
> if (pid == 0) {
> - ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-n", MYNAME, NULL);
> + ret = execlp("lxc-create", "lxc-create", "-t", "busybox", "-n", MYNAME, NULL);
> // Should not return
> perror("execl");
> exit(1);
> @@ -76,8 +76,8 @@ int main(int argc, char *argv[])
> goto out;
> }
>
> - if (create_ubuntu()) {
> - fprintf(stderr, "%d: failed to create a ubuntu container\n", __LINE__);
> + if (create_container()) {
> + fprintf(stderr, "%d: failed to create a container\n", __LINE__);
> goto out;
> }
>
> diff --git a/src/tests/get_item.c b/src/tests/get_item.c
> index 518dbd1..d9c5aef 100644
> --- a/src/tests/get_item.c
> +++ b/src/tests/get_item.c
> @@ -171,7 +171,7 @@ int main(int argc, char *argv[])
> ret = 1;
> goto out;
> }
> - if (!c->createl(c, "ubuntu", NULL, NULL, 0, "-r", "trusty", NULL)) {
> + if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
> fprintf(stderr, "%d: failed to create a trusty container\n", __LINE__);
> ret = 1;
> goto out;
> diff --git a/src/tests/saveconfig.c b/src/tests/saveconfig.c
> index e87c74d..de2fa82 100644
> --- a/src/tests/saveconfig.c
> +++ b/src/tests/saveconfig.c
> @@ -28,7 +28,7 @@
>
> #define MYNAME "lxctest1"
>
> -static int create_ubuntu(void)
> +static int create_container(void)
> {
> int status, ret;
> pid_t pid = fork();
> @@ -38,7 +38,7 @@ static int create_ubuntu(void)
> return -1;
> }
> if (pid == 0) {
> - ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-n", MYNAME, NULL);
> + ret = execlp("lxc-create", "lxc-create", "-t", "busybox", "-n", MYNAME, NULL);
> // Should not return
> perror("execl");
> exit(1);
> @@ -76,8 +76,8 @@ int main(int argc, char *argv[])
> goto out;
> }
>
> - if (create_ubuntu()) {
> - fprintf(stderr, "%d: failed to create a ubuntu container\n", __LINE__);
> + if (create_container()) {
> + fprintf(stderr, "%d: failed to create a container\n", __LINE__);
> goto out;
> }
>
> diff --git a/src/tests/shutdowntest.c b/src/tests/shutdowntest.c
> index 53fe8c6..2450221 100644
> --- a/src/tests/shutdowntest.c
> +++ b/src/tests/shutdowntest.c
> @@ -51,8 +51,8 @@ int main(int argc, char *argv[])
> }
> c->set_config_item(c, "lxc.network.link", "lxcbr0");
> c->set_config_item(c, "lxc.network.flags", "up");
> - if (!c->createl(c, "ubuntu", NULL, NULL, 0, "-r", "trusty", NULL)) {
> - fprintf(stderr, "%d: failed to create a trusty container\n", __LINE__);
> + if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
> + fprintf(stderr, "%d: failed to create a container\n", __LINE__);
> goto out;
> }
>
> diff --git a/src/tests/startone.c b/src/tests/startone.c
> index b46fc98..d2879f6 100644
> --- a/src/tests/startone.c
> +++ b/src/tests/startone.c
> @@ -29,7 +29,7 @@
>
> #define MYNAME "lxctest1"
>
> -static int destroy_ubuntu(void)
> +static int destroy_container(void)
> {
> int status, ret;
> pid_t pid = fork();
> @@ -61,7 +61,7 @@ again:
> return WEXITSTATUS(status);
> }
>
> -static int create_ubuntu(void)
> +static int create_container(void)
> {
> int status, ret;
> pid_t pid = fork();
> @@ -71,7 +71,7 @@ static int create_ubuntu(void)
> return -1;
> }
> if (pid == 0) {
> - ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-n", MYNAME, NULL);
> + ret = execlp("lxc-create", "lxc-create", "-t", "busybox", "-n", MYNAME, NULL);
> // Should not return
> perror("execl");
> exit(1);
> @@ -116,9 +116,9 @@ int main(int argc, char *argv[])
> goto out;
> }
>
> - ret = create_ubuntu();
> + ret = create_container();
> if (ret) {
> - fprintf(stderr, "%d: failed to create a ubuntu container\n", __LINE__);
> + fprintf(stderr, "%d: failed to create a container\n", __LINE__);
> goto out;
> }
>
> @@ -251,7 +251,7 @@ ok:
> out:
> if (c) {
> c->stop(c);
> - destroy_ubuntu();
> + destroy_container();
> }
> lxc_container_put(c);
> exit(ret);
> --
> 1.9.0
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140312/881a9d75/attachment.pgp>
More information about the lxc-devel
mailing list