controllers/pids: Add new testcases
PATCH v5 1/1 controllers/pids: Add new testcases
Created new testcases to test the pids controller which is used to stop any new tasks from being fork()'d after a certain limit is reached.
Signed-off-by Cedric Hnyda <[email protected]>
--- runtest/controllers | 22 +++ testcases/kernel/controllers/pids/.gitignore | 2 + testcases/kernel/controllers/pids/Makefile | 28 ++++ testcases/kernel/controllers/pids/pids.sh | 186 +++++++++++++++++++++++++ testcases/kernel/controllers/pids/pids_task1.c | 60 ++++++++ testcases/kernel/controllers/pids/pids_task2.c | 25 ++++ 6 files changed, 323 insertions(+) create mode 100644 testcases/kernel/controllers/pids/.gitignore create mode 100644 testcases/kernel/controllers/pids/Makefile create mode 100644 testcases/kernel/controllers/pids/pids.sh create mode 100644 testcases/kernel/controllers/pids/pids_task1.c create mode 100644 testcases/kernel/controllers/pids/pids_task2.c
runtest/controllers +22 -0
@@ -277,3 +277,25 @@ cpuset_memory_spread cpuset_memory_spread_testset.sh cpuset_regression_test cpuset_regression_test.sh cgroup_xattr cgroup_xattr + +pids_1_1 pids.sh 1 1 +pids_1_2 pids.sh 1 2 +pids_1_10 pids.sh 1 10 +pids_1_50 pids.sh 1 50 +pids_1_100 pids.sh 1 100 +pids_2_1 pids.sh 2 1 +pids_2_2 pids.sh 2 2 +pids_2_10 pids.sh 2 10 +pids_2_50 pids.sh 2 50 +pids_2_100 pids.sh 2 100 +pids_3_1 pids.sh 3 1 +pids_3_2 pids.sh 3 2 +pids_3_10 pids.sh 3 10 +pids_3_50 pids.sh 3 50 +pids_3_100 pids.sh 3 100 +pids_4_1 pids.sh 4 1 +pids_4_2 pids.sh 4 2 +pids_4_10 pids.sh 4 10 +pids_4_50 pids.sh 4 50 +pids_4_100 pids.sh 4 100 +pids_5_1 pids.sh 5 1
testcases/kernel/controllers/pids/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +/pids_task1 +/pids_task2
testcases/kernel/controllers/pids/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +# +# Copyright (C) 2015, SUSE +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Author: Cedric Hnyda <[email protected]> +# + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk +include $(abs_srcdir)/../Makefile.inc + +INSTALL_TARGETS := *.sh + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/controllers/pids/pids.sh new file +186 -0
186 lines not on this page · raw message
testcases/kernel/controllers/pids/pids_task1.c new file +60 -0
60 lines not on this page · raw message
testcases/kernel/controllers/pids/pids_task2.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (c) 2015 Cedric Hnyda <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <unistd.h> + +int main (void ) +{ +pause (); +return 0 ; +}
Signature · 1 line
2.1.4
PATCH v5 1/1 controllers/pids: Add new testcases
Hi,
testcases/kernel/controllers/pids/pids.sh line 41
Quoted 10 lines · Cedric Hnyda
Created new testcases to test the pids controller which is used to stop any new tasks from being fork()'d after a certain limit is reached.
testcases/kernel/controllers/pids/pids.sh new file +5
-0+ +usage() +{ + echo "usage: ./pids01 caseno max" + tst_resm TFAIL "invalid parameters"
The messages could be merged into one, no need to print two:
tst_resm TFAIL "invalid parameters, usage: ..."
testcases/kernel/controllers/pids/pids.sh line 93
Quoted 11 lines
testcases/kernel/controllers/pids/pids.sh new file +11
-0+ +start_pids_tasks2() +{ + nb=$1 + for i in `seq 1 $nb`; do + pids_task2 & + echo $! > $testpath/tasks + done + + if [ $(cat "$testpath/tasks" | wc -l) -ne $nb ]; then + tst_resm TBROK "..."
Please make it more informative :)
Thanks,
Alexey