All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] cpuacct.sh: Fix tst_get_free_pids failure detection
@ 2021-09-20 13:42 Petr Vorel
  2021-09-21  7:39 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2021-09-20 13:42 UTC (permalink / raw)
  To: ltp

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 <pvorel@suse.cz>
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh
index 3002d0a8a..ca881988f 100755
--- a/testcases/kernel/controllers/cpuacct/cpuacct.sh
+++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh
@@ -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)"
-- 
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH 1/1] cpuacct.sh: Fix tst_get_free_pids failure detection
  2021-09-20 13:42 [LTP] [PATCH 1/1] cpuacct.sh: Fix tst_get_free_pids failure detection Petr Vorel
@ 2021-09-21  7:39 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2021-09-21  7:39 UTC (permalink / raw)
  To: ltp

Hi,

FYI merged.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-21  7:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 13:42 [LTP] [PATCH 1/1] cpuacct.sh: Fix tst_get_free_pids failure detection Petr Vorel
2021-09-21  7:39 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.