cpuacct.sh: Fix tst_get_free_pids failure detection
PATCH 1/1 cpuacct.sh: Fix tst_get_free_pids failure detection
local tasksmax=$(tst_get_free_pids) is successful, even tst_get_free_pids fails. Assignment needs to be separated from declaration to get tst_get_free_pids exit code. Similar fix to 87a82a62c ("lib/tst_test.sh: fix ROD_SILENT command return status check")
It fixes error:
tst_pid.c:79: TINFO: Cannot read session user limits from '/sys/fs/cgroup/user.slice/user-0.slice/pids.max' tst_pid.c:83: TBROK: Expected 1 conversions got 0 FILE '/sys/fs/cgroup/pids/user.slice/user-0.slice/pids.max' /opt/ltp/testcases/bin/cpuacct.sh: line 77: [: -le: unary operator expected
Signed-off-by Petr Vorel <[email protected]>
--- testcases/kernel/controllers/cpuacct/cpuacct.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
testcases/kernel/controllers/cpuacct/cpuacct.sh +4 -2
@@ -71,8 +71,10 @@ check_free_memory() check_limits() { local tasksneeded=$((max * nbprocess)) - local tasksmax=$(tst_get_free_pids) - test $? -eq 0 || return 0 + local tasksmax + + tasksmax=$(tst_get_free_pids) + [ $? -eq 0 ] || return 0 if [ $tasksmax -le $tasksneeded ]; then tst_brk TCONF "limit of tasks is too low (approximate need $tasksneeded, limit $tasksmax)"
Signature · 5 lines
2.33.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
FYI merged.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp