Skip to contentSkip to conversation

cgroup_fj: renamed arguments because the previous ones were not clear.

PATCH In review Cedric Hnyda 2 participants 2 messages Sep 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup_fj: renamed arguments because the previous ones were not clear.

---
 .../controllers/cgroup_fj/cgroup_fj_function.sh    |  45 ++-
 .../controllers/cgroup_fj/cgroup_fj_stress.sh      |  58 ++--
 .../controllers/cgroup_fj/cgroup_fj_testcases.sh   | 362 ++++++++++-----------
 .../controllers/cgroup_fj/cgroup_fj_utility.sh     |  58 ++--
 4 files changed, 249 insertions(+), 274 deletions(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh +22 -23
index 9bfaeb7..673a942 100755
@@ -32,7 +32,6 @@ remove_operation=$7
 notify_on_release=$8
 release_agent_echo=$9
 
-subsystem_str="";
 remount_use_str="";
 noprefix_use_str="";
 release_agent_para_str="";
@@ -55,24 +54,24 @@ usage()
 	echo "                          -subgroup_exist -attach_operation -remove_operation"
 	echo "                          -notify_on_release -release_agent_echo"
 	echo "    subsystem's usable number"
-	echo "      1: debug"
-	echo "      2: cpuset"
-	echo "      3: ns"
-	echo "      4: cpu"
-	echo "      5: cpuacct"
-	echo "      6: memory"
-	echo "      7: all"
-	echo "      8: (none)"
-	echo "      9: debug,debug"
-	echo "      10: (nonexistent subsystem), e.g. abc"
-	echo "      11: freezer"
-	echo "      12: devices"
+	echo "      debug"
+	echo "      cpuset"
+	echo "      ns"
+	echo "      cpu"
+	echo "      cpuacct"
+	echo "      memory"
+	echo "      all"
+	echo "      none: (none)"
+	echo "      debug,debug: debug,debug"
+	echo "      nonexistent: (nonexistent subsystem), e.g. abc"
+	echo "      freezer: freezer"
+	echo "      devices: devices"
 	echo "    remount_use's usable number"
-	echo "      1: do not use remount in "-o"'s parameter"
-	echo "      2: use it"
+	echo "      yes: do not use remount in "-o"'s parameter"
+	echo "      no: use it"
 	echo "    noprefix_use's usable number"
-	echo "      1: do not use noprefix in "-o"'s parameter"
-	echo "      2: use it. only cpuset available"
+	echo "      yes: do not use noprefix in "-o"'s parameter"
+	echo "      no: use it. only cpuset available"
 	echo "    release_agent_para's usable number"
 	echo "      1: don't use release_agent_para= in "-o"'s parameter"
 	echo "      2: empty after "=""
@@ -83,8 +82,8 @@ usage()
 	echo "      7: nonexistent command"
 	echo "      8: no-permission command"
 	echo "    subgroup_exist's usable number"
-	echo "      1: subgroup will been created"
-	echo "      2: subgroup will not been created"
+	echo "      yes: subgroup will been created"
+	echo "      no: subgroup will not been created"
 	echo "    attach_operation's usable number"
 	echo "      1: attach nothing"
 	echo "      2: attach one process by echo"
@@ -114,7 +113,7 @@ usage()
 	echo "      5: command in other directory"
 	echo "      6: nonexistent command"
 	echo "      7: no-permission command"
-	echo "example: ./cgroup_fj_function.sh 1 1 1 1 1 1 1 1 1"
+	echo "example: ./cgroup_fj_function.sh debug yes yes 1 yes 1 1 1 1"
 	echo "  will use "debug" to test, will not use option "remount","noprefix","release_agent""
 	echo "  in in "-o"'s parameter, will create some subgroup, will not attach/remove any process"
 	echo "  will echo 0 to notify_on_release and will not echo anything to release_agent"
@@ -157,10 +156,10 @@ mkdir_subgroup;
 
 # cpuset.cpus and cpuset.mems should be specified with suitable value
 # before attaching operation if subsystem is cpuset
-if [ $subsystem -eq 2 ] || [ $subsystem -eq 7 ] || [ $subsystem -eq 8 ] ; then
+if [ "$subsystem" == "cpuset" ] || [ "$subsystem" == "all" ] || [ $subsystem == "none" ] ; then
 	exist=`grep -w cpuset /proc/cgroups | cut -f1`;
 	if [ "$exist" != "" ]; then
-		if [ $noprefix_use -eq 2 ]; then
+		if [ "$noprefix_use" == "no" ]; then
 			do_echo 1 1 `cat /dev/cgroup/cpus` /dev/cgroup/subgroup_1/cpus;
 			do_echo 1 1 `cat /dev/cgroup/mems` /dev/cgroup/subgroup_1/mems;
 		else
@@ -234,7 +233,7 @@ sleep 1
 
 # pid could not be echoed from subgroup if subsystem is ( or include ) ns,
 # so we kill them here
-if [ $subsystem -eq 3 ] || [ $subsystem -eq 7 ] || [ $subsystem -eq 8 ] ; then
+if [ "$subsystem" == "ns" ] || [ "$subsystem" == "all" ] || [ $subsystem == "none" ] ; then
 	do_kill 1 1 9 $pid
 	do_kill 1 1 9 $pid2
 # removing operation
testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh +23 -35

136 lines not on this page · raw message

testcases/kernel/controllers/cgroup_fj/cgroup_fj_testcases.sh +181 -181

369 lines not on this page · raw message

testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh +23 -35

118 lines not on this page · raw message

Signature · 8 lines
2.1.4


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh get_subgroup_path2() · line 135

Quoted 9 lines

case $mount_times in
-"1" )
+"1"|"100")

testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh +0 -3
 	mount_times=1
 	;;
-"2" )
-	mount_times=100
-	;;
 *  )

Hmm, after the change the mount_times is always set to 1 (forget to remove mount_times=1?).

Also we may only want to check that the parameter is a numeric so that we can tune the test parameters later (and for other parameters that can be tuned such as number of subgroup as well).

The portable way to do that seems to be case statement:

case $mount_times in

	''|*[!0-9]*) usage;;
	*) ;;

esac

Otherwise the patch looks good.

Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list