[PATCH 15/15] test: check that task_diag can dump all thread of one process

From: Andrey Vagin
Date: Mon Apr 11 2016 - 19:36:40 EST


Signed-off-by: Andrey Vagin <avagin@xxxxxxxxxx>
---
tools/testing/selftests/task_diag/_run.sh | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/task_diag/_run.sh b/tools/testing/selftests/task_diag/_run.sh
index 559f02a..d2e8544 100755
--- a/tools/testing/selftests/task_diag/_run.sh
+++ b/tools/testing/selftests/task_diag/_run.sh
@@ -10,11 +10,15 @@ nchildren=`./task_diag_all children --pid 1 | grep 'pid.*tgid.*ppid.*comm fork$'

./task_diag_all one --pid 1 --cred

+( exec -a fork_thread ./fork 1 1234 )
+pid=`pidof fork_thread`
+ntaskthreads=`./task_diag_all thread --maps --cred --smaps --pid $pid | grep 'pid.*tgid.*ppid.*comm' | wc -l`
killall -9 fork

[ "$nthreads" -eq 10000 ] &&
[ "$nprocesses" -eq 1000 ] &&
[ "$nchildren" -eq 1000 ] &&
+[ "$ntaskthreads" -eq 1234 ] &&
true || {
echo "Unexpected number of tasks $nthreads:$nprocesses" 1>&2
exit 1
--
2.5.5