diff options
Diffstat (limited to 'testcases/kernel/controllers')
9 files changed, 28 insertions, 17 deletions
diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh index 0cfa0c17e..567178e3f 100755 --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh @@ -165,8 +165,7 @@ setup() mount -t cgroup -o cpuset cpuset "$CPUSET" 2> /dev/null if [ $? -ne 0 ]; then cleanup - tst_brkm TFAIL "Could not mount cgroup filesystem with"\ - " cpuset on $CPUSET..Exiting test" + tst_brkm TCONF "Could not mount cgroup filesystem with cpuset on $CPUSET" fi CHILDREN_VALUE="`cat $CLONE_CHILDREN`" diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh index a5757309f..bedc48110 100755 --- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh +++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh @@ -190,21 +190,27 @@ do_test() ROD_SILENT mkdir ${root_cpuset_dir}/testdir # Creat an exclusive cpuset. - echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive} - [ $? -ne 0 ] && tst_brk TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed" + if ! echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}; then + tst_res TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed" + return + fi cpu_exclusive_tmp=$(cat ${root_cpuset_dir}/testdir/${cpu_exclusive}) if [ "${cpu_exclusive_tmp}" != "1" ]; then - tst_brk TFAIL "${cpu_exclusive} is '${cpu_exclusive_tmp}', expected '1'" + tst_res TFAIL "${cpu_exclusive} is '${cpu_exclusive_tmp}', expected '1'" + return fi # This may trigger the kernel crash - echo 0 > ${root_cpuset_dir}/testdir/${cpus} - [ $? -ne 0 ] && tst_brk TFAIL "'echo 0 > ${root_cpuset_dir}/testdir/${cpus}' failed" + if ! echo 0 > ${root_cpuset_dir}/testdir/${cpus}; then + tst_res TFAIL "'echo 0 > ${root_cpuset_dir}/testdir/${cpus}' failed" + return + fi cpus_value=$(cat ${root_cpuset_dir}/testdir/${cpus}) if [ "${cpus_value}" != "0" ]; then - tst_brk TFAIL "${cpus} is '${cpus_value}', expected '0'" + tst_res TFAIL "${cpus} is '${cpus_value}', expected '0'" + return fi tst_res TPASS "Bug is not reproducible" diff --git a/testcases/kernel/controllers/freezer/vfork.c b/testcases/kernel/controllers/freezer/vfork.c index 0b25e90c2..9f4359bf8 100644 --- a/testcases/kernel/controllers/freezer/vfork.c +++ b/testcases/kernel/controllers/freezer/vfork.c @@ -29,6 +29,7 @@ * until vfork returns. This can delay delivery of signals to the parent * process, even delay or stop system suspend. */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -39,9 +40,8 @@ #include <sys/types.h> #include <sys/wait.h> #include <sys/socket.h> +#include <sys/ptrace.h> #include "test.h" -#include "config.h" -#include "../../syscalls/ptrace/ptrace.h" #define str_expand(s) str(s) #define str(s) #s diff --git a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh index 9bcc01258..3b7311422 100755 --- a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh +++ b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh @@ -33,8 +33,8 @@ test_subgroup() fi echo $MEMCG_PROCESS_PID > tasks - signal_memcg_process $MEM_TO_ALLOC - check_mem_stat "rss" $MEM_TO_ALLOC + signal_memcg_process $MIN_CHARGED + check_mem_stat "rss" $MIN_CHARGED $MEM_TO_ALLOC cd subgroup echo $MEMCG_PROCESS_PID > tasks @@ -66,5 +66,6 @@ test3() # Allocate memory bigger than per-cpu kernel memory MEM_TO_ALLOC=$((PAGESIZES * 2)) +MIN_CHARGED=$((2 * (PAGESIZES - 1))) tst_run diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c index 1656176b6..0d93abd9e 100644 --- a/testcases/kernel/controllers/memcg/memcontrol02.c +++ b/testcases/kernel/controllers/memcg/memcontrol02.c @@ -134,7 +134,7 @@ static struct tst_test test = { .tcnt = 2, .test = test_memcg_current, .mount_device = 1, - .dev_min_size = 256, + .dev_min_size = 300, .mntpoint = TMPDIR, .all_filesystems = 1, .forks_child = 1, diff --git a/testcases/kernel/controllers/memcg/memcontrol03.c b/testcases/kernel/controllers/memcg/memcontrol03.c index bc726f395..9c6c808e0 100644 --- a/testcases/kernel/controllers/memcg/memcontrol03.c +++ b/testcases/kernel/controllers/memcg/memcontrol03.c @@ -239,7 +239,6 @@ static struct tst_test test = { .cleanup = cleanup, .test_all = test_memcg_min, .mount_device = 1, - .dev_min_size = 256, .mntpoint = TMPDIR, .all_filesystems = 1, .skip_filesystems = (const char *const[]){ diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c b/testcases/kernel/controllers/memcg/memcontrol04.c index c963a1cd8..32a0b9fd4 100644 --- a/testcases/kernel/controllers/memcg/memcontrol04.c +++ b/testcases/kernel/controllers/memcg/memcontrol04.c @@ -232,7 +232,6 @@ static struct tst_test test = { .cleanup = cleanup, .test_all = test_memcg_low, .mount_device = 1, - .dev_min_size = 256, .mntpoint = TMPDIR, .all_filesystems = 1, .skip_filesystems = (const char *const[]){ diff --git a/testcases/kernel/controllers/memcg/memcontrol_common.h b/testcases/kernel/controllers/memcg/memcontrol_common.h index adb6fafb3..a3bd243f5 100644 --- a/testcases/kernel/controllers/memcg/memcontrol_common.h +++ b/testcases/kernel/controllers/memcg/memcontrol_common.h @@ -1,5 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 +#ifndef MEMCONTROL_COMMON_H__ +#define MEMCONTROL_COMMON_H__ + #include <stdlib.h> #include <stdio.h> @@ -45,3 +48,5 @@ static inline void alloc_anon(const size_t size) free(buf); } + +#endif /* MEMCONTROL_COMMON_H__ */ diff --git a/testcases/kernel/controllers/memcg/regression/memcg_test_3.c b/testcases/kernel/controllers/memcg/regression/memcg_test_3.c index f29c2bea5..31b1b5a83 100644 --- a/testcases/kernel/controllers/memcg/regression/memcg_test_3.c +++ b/testcases/kernel/controllers/memcg/regression/memcg_test_3.c @@ -21,6 +21,7 @@ static volatile int sigcounter; static struct tst_cg_group *test_cg; +static pid_t ppid; static void sighandler(int sig LTP_ATTRIBUTE_UNUSED) { @@ -29,8 +30,8 @@ static void sighandler(int sig LTP_ATTRIBUTE_UNUSED) static void do_child(void) { - while (1) - SAFE_KILL(getppid(), SIGUSR1); + while (getppid() == ppid) + SAFE_KILL(ppid, SIGUSR1); exit(0); } @@ -40,6 +41,7 @@ static void do_test(void) pid_t cpid; SAFE_SIGNAL(SIGUSR1, sighandler); + ppid = getpid(); cpid = SAFE_FORK(); if (cpid == 0) |