[lxc-devel] [PATCH] use busybox instead of ubuntu to test as it's much more lightweight, also wait containers to enter desired state

S.Çağlar Onur caglar at 10ur.org
Fri Sep 13 18:41:48 UTC 2013


Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
---
 src/tests/concurrent.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/tests/concurrent.c b/src/tests/concurrent.c
index 41c171b..7faf34c 100644
--- a/src/tests/concurrent.c
+++ b/src/tests/concurrent.c
@@ -40,7 +40,7 @@ void * concurrent(void *arguments) {
     args->return_code = 1;
     if (strcmp(args->mode, "create") == 0) {
         if (!c->is_defined(c)) {
-            if (!c->create(c, "ubuntu", NULL, NULL, 1, NULL)) {
+            if (!c->create(c, "busybox", NULL, NULL, 1, NULL)) {
                 fprintf(stderr, "Creating the container (%s) failed...\n", name);
                 goto out;
             }
@@ -52,6 +52,10 @@ void * concurrent(void *arguments) {
                 fprintf(stderr, "Starting the container (%s) failed...\n", name);
                 goto out;
             }
+            if (!c->wait(c, "RUNNING", -1)) {
+                fprintf(stderr, "Waiting the container (%s) to start failed...\n", name);
+                goto out;
+            }
         }
     } else if(strcmp(args->mode, "stop") == 0) {
         if (c->is_defined(c) && c->is_running(c)) {
@@ -59,6 +63,10 @@ void * concurrent(void *arguments) {
                 fprintf(stderr, "Stopping the container (%s) failed...\n", name);
                 goto out;
             }
+            if (!c->wait(c, "STOPPED", -1)) {
+                fprintf(stderr, "Waiting the container (%s) to stop failed...\n", name);
+                goto out;
+            }
         }
     } else if(strcmp(args->mode, "destroy") == 0) {
         if (c->is_defined(c) && !c->is_running(c)) {
-- 
1.8.1.2





More information about the lxc-devel mailing list