]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lua: fix return value of attach() method
authorDwight Engen <dwight.engen@oracle.com>
Mon, 17 Nov 2014 17:33:38 +0000 (12:33 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 24 Nov 2014 21:13:58 +0000 (16:13 -0500)
Add simple test case for attach() method. Add assert for return value
from create() method which also returns a boolean.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lua-lxc/core.c
src/lua-lxc/test/apitest.lua

index 87341285b51d8200ca43db4f83f9cf8371d999af..2e073d8290b9ab12e1583b12ce9e9d7d55728738 100644 (file)
@@ -397,7 +397,7 @@ static int container_attach(lua_State *L)
        return 1;
     }
 
-    lua_pushboolean(L, !!(c->attach_run_wait(c, NULL, argv[0], (const char**)argv)));
+    lua_pushboolean(L, !(c->attach_run_wait(c, NULL, argv[0], (const char**)argv)));
     return 1;
 }
 
index f299b6ac1512c0793bc11fdbaeb2b5307a03259d..8da4336ffe6a7578d56f76b0bf1a23b9159c4485 100755 (executable)
@@ -119,7 +119,7 @@ function test_container_create()
        end
     end
     log(0, "%-20s %s", "Creating rootfs using:", optarg["t"])
-    container:create(optarg["t"])
+    assert(container:create(optarg["t"]) == true)
     assert(container:defined() == true)
     assert(container:name() == optarg["n"])
 end
@@ -206,6 +206,12 @@ function test_container_in_cfglist(should_find)
     end
 end
 
+function test_container_attach()
+    log(0, "Test attach...")
+    assert(container:running() == true)
+    assert(container:attach("/bin/ps") == true)
+end
+
 function test_container_cgroup()
     log(0, "Test get/set cgroup items...")
 
@@ -330,6 +336,7 @@ test_config_network(0)
 test_container_start()
 test_container_started()
 
+test_container_attach()
 test_container_cgroup()
 test_container_cmd()