Message ID | 20221123150104.2378876-1-lkml@jv-coder.de |
---|---|
State | Accepted |
Headers | show |
Series | memcg_conctrol_test: fix if CONFIG_SWAP=n | expand |
On Wed, Nov 23, 2022 at 11:01 PM Joerg Vehlow <lkml@jv-coder.de> wrote: > From: Joerg Vehlow <joerg.vehlow@aox.de> > > This allows the test to run successfully on systems without swap enabled > It restores the behaviour of the test before > a77b65bbe ("controllers: Update memcg_control_test to newer test lib and > cgroup lib") > > Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de> > Reviewed-by: Li Wang <liwang@redhat.com> --- > .../kernel/controllers/memcg/control/memcg_control_test.sh | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git > a/testcases/kernel/controllers/memcg/control/memcg_control_test.sh > b/testcases/kernel/controllers/memcg/control/memcg_control_test.sh > index 093d50c2a..941d918fc 100644 > --- a/testcases/kernel/controllers/memcg/control/memcg_control_test.sh > +++ b/testcases/kernel/controllers/memcg/control/memcg_control_test.sh > @@ -47,7 +47,11 @@ test1() > tst_res TINFO "Test #1: Checking if the memory usage limit imposed > by the topmost group is enforced" > > ROD echo "$ACTIVE_MEM_LIMIT" \> "$test_dir/$memory_limit" > - ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit" > + > + # If the kernel is built without swap, the $memsw_memory_limit > file is missing > + if [ -e "$test_dir/$memsw_memory_limit" ]; then > + ROD echo "$TOT_MEM_LIMIT" \> > "$test_dir/$memsw_memory_limit" > + fi > > KILLED_CNT=0 > test_proc_kill > -- > 2.25.1 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp > >
diff --git a/testcases/kernel/controllers/memcg/control/memcg_control_test.sh b/testcases/kernel/controllers/memcg/control/memcg_control_test.sh index 093d50c2a..941d918fc 100644 --- a/testcases/kernel/controllers/memcg/control/memcg_control_test.sh +++ b/testcases/kernel/controllers/memcg/control/memcg_control_test.sh @@ -47,7 +47,11 @@ test1() tst_res TINFO "Test #1: Checking if the memory usage limit imposed by the topmost group is enforced" ROD echo "$ACTIVE_MEM_LIMIT" \> "$test_dir/$memory_limit" - ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit" + + # If the kernel is built without swap, the $memsw_memory_limit file is missing + if [ -e "$test_dir/$memsw_memory_limit" ]; then + ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit" + fi KILLED_CNT=0 test_proc_kill