[lxc-devel] [PATCH 1/2] fix cgpath test
Stéphane Graber
stgraber at ubuntu.com
Wed Oct 30 13:53:08 UTC 2013
On Tue, Oct 29, 2013 at 04:46:16PM -0400, Dwight Engen wrote:
> Commit 1ea59ad28 sets memory.use_hierarchy, which means that this test
> cannot use memory.swappiness as its dummy cgroup item to set/unset since
> writing to it with use_hierarchy set gets -EINVAL. Change test to use
> memory.soft_limit_in_bytes instead.
>
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/tests/cgpath.c | 25 ++++++++-----------------
> 1 file changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/src/tests/cgpath.c b/src/tests/cgpath.c
> index 26a79c3..13986cf 100644
> --- a/src/tests/cgpath.c
> +++ b/src/tests/cgpath.c
> @@ -74,8 +74,8 @@ static int test_running_container(const char *lxcpath,
> goto err3;
> }
>
> - /* test get/set value using memory.swappiness file */
> - ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
> + /* test get/set value using memory.soft_limit_in_bytes file */
> + ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
> c->name, c->config_path);
> if (ret < 0) {
> TSTERR("lxc_cgroup_get failed");
> @@ -83,39 +83,30 @@ static int test_running_container(const char *lxcpath,
> }
> strcpy(value_save, value);
>
> - ret = lxc_cgroup_set("memory.swappiness", "100", c->name, c->config_path);
> + ret = lxc_cgroup_set("memory.soft_limit_in_bytes", "512M", c->name, c->config_path);
> if (ret < 0) {
> - TSTERR("lxc_cgroup_set_bypath failed");
> + TSTERR("lxc_cgroup_set failed %d %d", ret, errno);
> + getchar();
> goto err3;
> }
> - ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
> + ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
> c->name, c->config_path);
> if (ret < 0) {
> TSTERR("lxc_cgroup_get failed");
> goto err3;
> }
> - if (strcmp(value, "100\n")) {
> + if (strcmp(value, "536870912\n")) {
> TSTERR("lxc_cgroup_set_bypath failed to set value >%s<", value);
> goto err3;
> }
>
> /* restore original value */
> - ret = lxc_cgroup_set("memory.swappiness", value_save,
> + ret = lxc_cgroup_set("memory.soft_limit_in_bytes", value_save,
> c->name, c->config_path);
> if (ret < 0) {
> TSTERR("lxc_cgroup_set failed");
> goto err3;
> }
> - ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
> - c->name, c->config_path);
> - if (ret < 0) {
> - TSTERR("lxc_cgroup_get failed");
> - goto err3;
> - }
> - if (strcmp(value, value_save)) {
> - TSTERR("lxc_cgroup_set failed to set value >%s<", value);
> - goto err3;
> - }
>
> cgabspath = lxc_cgroup_path_get("freezer", c->name, c->config_path);
> if (!cgabspath) {
> --
> 1.8.3.1
>
>
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/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: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131030/b0fd8a73/attachment.pgp>
More information about the lxc-devel
mailing list