linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Shi <alex.shi@linux.alibaba.com>
To: alex.shi@linux.alibaba.com
Cc: Shuah Khan <shuah@kernel.org>, Roman Gushchin <guro@fb.com>,
	Tejun Heo <tj@kernel.org>,
	Mike Rapoport <rppt@linux.vnet.ibm.com>,
	Jay Kamat <jgkamat@fb.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Claudio Zumbo <claudioz@fb.com>, Claudio <claudiozumbo@gmail.com>
Subject: [PATCH 2/3] kselftest/cgroup: fix unexcepted testing failure on test_core
Date: Wed, 15 May 2019 17:07:03 +0800	[thread overview]
Message-ID: <20190515090704.56929-2-alex.shi@linux.alibaba.com> (raw)
In-Reply-To: <20190515090704.56929-1-alex.shi@linux.alibaba.com>

The cgroup testing relys on the root cgroup's subtree_control setting,
If the 'memory' controller isn't set, some test cases will be failed
as following:

$sudo  ./test_core
not ok 1 test_cgcore_internal_process_constraint
ok 2 test_cgcore_top_down_constraint_enable
not ok 3 test_cgcore_top_down_constraint_disable
...

To correct this unexcepted failure, this patch write the 'memory' to
subtree_control of root to get a right result.

Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Claudio Zumbo <claudioz@fb.com>
Cc: Claudio <claudiozumbo@gmail.com>
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 tools/testing/selftests/cgroup/test_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c
index be59f9c34ea2..b1a570d7c557 100644
--- a/tools/testing/selftests/cgroup/test_core.c
+++ b/tools/testing/selftests/cgroup/test_core.c
@@ -376,6 +376,11 @@ int main(int argc, char *argv[])
 
 	if (cg_find_unified_root(root, sizeof(root)))
 		ksft_exit_skip("cgroup v2 isn't mounted\n");
+
+	if (cg_read_strstr(root, "cgroup.subtree_control", "memory"))
+	    if (cg_write(root, "cgroup.subtree_control", "+memory"))
+		ksft_exit_skip("Failed to set root memory controller\n");
+
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		switch (tests[i].fn(root)) {
 		case KSFT_PASS:
-- 
2.19.1.856.g8858448bb


  reply	other threads:[~2019-05-15  9:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15  9:07 [PATCH 1/3] kselftest/cgroup: fix unexcepted testing failure on test_memcontrol Alex Shi
2019-05-15  9:07 ` Alex Shi [this message]
2019-05-15  9:07 ` [PATCH 3/3] kselftest/cgroup: fix incorrect test_core skip Alex Shi
     [not found] ` <20190517172930.GA5525@tower.DHCP.thefacebook.com>
2019-05-20  2:02   ` [PATCH 1/3] kselftest/cgroup: fix unexcepted testing failure on test_memcontrol Alex Shi
2019-05-20  3:14   ` Alex Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190515090704.56929-2-alex.shi@linux.alibaba.com \
    --to=alex.shi@linux.alibaba.com \
    --cc=claudioz@fb.com \
    --cc=claudiozumbo@gmail.com \
    --cc=guro@fb.com \
    --cc=jgkamat@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).