Commit 12101424 authored by Michal Koutný's avatar Michal Koutný Committed by Tejun Heo

selftests: cgroup: Minor code reorganizations

No functional change intended, these small changes are merged into one
commit and they serve as a preparation for an upcoming new testcase.
Signed-off-by: default avatarMichal Koutný <mkoutny@suse.com>
Reviewed-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 0a67b847
...@@ -5222,6 +5222,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git ...@@ -5222,6 +5222,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
F: Documentation/admin-guide/cgroup-v1/cpusets.rst F: Documentation/admin-guide/cgroup-v1/cpusets.rst
F: include/linux/cpuset.h F: include/linux/cpuset.h
F: kernel/cgroup/cpuset.c F: kernel/cgroup/cpuset.c
F: tools/testing/selftests/cgroup/test_cpuset_prs.sh
CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
M: Johannes Weiner <hannes@cmpxchg.org> M: Johannes Weiner <hannes@cmpxchg.org>
......
...@@ -286,6 +286,8 @@ int cg_destroy(const char *cgroup) ...@@ -286,6 +286,8 @@ int cg_destroy(const char *cgroup)
{ {
int ret; int ret;
if (!cgroup)
return 0;
retry: retry:
ret = rmdir(cgroup); ret = rmdir(cgroup);
if (ret && errno == EBUSY) { if (ret && errno == EBUSY) {
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#define USEC_PER_SEC 1000000L #define USEC_PER_SEC 1000000L
#define NSEC_PER_SEC 1000000000L #define NSEC_PER_SEC 1000000000L
#define TEST_UID 65534 /* usually nobody, any !root is fine */
/* /*
* Checks if two given values differ by less than err% of their sum. * Checks if two given values differ by less than err% of their sum.
*/ */
......
...@@ -683,7 +683,7 @@ static int test_cgcore_thread_migration(const char *root) ...@@ -683,7 +683,7 @@ static int test_cgcore_thread_migration(const char *root)
*/ */
static int test_cgcore_lesser_euid_open(const char *root) static int test_cgcore_lesser_euid_open(const char *root)
{ {
const uid_t test_euid = 65534; /* usually nobody, any !root is fine */ const uid_t test_euid = TEST_UID;
int ret = KSFT_FAIL; int ret = KSFT_FAIL;
char *cg_test_a = NULL, *cg_test_b = NULL; char *cg_test_a = NULL, *cg_test_b = NULL;
char *cg_test_a_procs = NULL, *cg_test_b_procs = NULL; char *cg_test_a_procs = NULL, *cg_test_b_procs = NULL;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
skip_test() { skip_test() {
echo "$1" echo "$1"
echo "Test SKIPPED" echo "Test SKIPPED"
exit 0 exit 4 # ksft_skip
} }
[[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!" [[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment