lxc: tests: use busybox template rather than ubuntu

to speed up tests where it doesn't matter

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Serge Hallyn 2014-03-12 18:48:15 -05:00 committed by Stéphane Graber
parent 395d87ff23
commit 787c3ebec6
7 changed files with 19 additions and 19 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);