]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Added tests for cgconfigparser witg -f, -d, -a and -t options.
authorJan Safranek <jsafrane@redhat.com>
Wed, 30 Nov 2011 14:42:58 +0000 (15:42 +0100)
committerJan Safranek <jsafrane@redhat.com>
Tue, 6 Dec 2011 09:42:15 +0000 (10:42 +0100)
Added new tests to check cgconfigparser with the new options.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
tests/tools/cgconfigparser/cgconfigparser_conf_files/permissions_default4.conf [new file with mode: 0644]
tests/tools/cgconfigparser/permissions

diff --git a/tests/tools/cgconfigparser/cgconfigparser_conf_files/permissions_default4.conf b/tests/tools/cgconfigparser/cgconfigparser_conf_files/permissions_default4.conf
new file mode 100644 (file)
index 0000000..97d36f9
--- /dev/null
@@ -0,0 +1,48 @@
+mount {
+       cpu = /TMP/cgroups/cpu;
+       cpuacct = /TMP/cgroups/cpu;
+}
+
+# inherit default
+group daemons/www {
+       cpu {
+               cpu.shares = "1000";
+       }
+}
+
+#override default
+group daemons/ftp {
+       perm {
+               task {
+                       uid = root;
+                       gid = root;
+                       fperm = 274;
+               }
+               admin {
+                       uid = root;
+                       gid = root;
+                       dperm = 742;
+                       fperm = 427;
+               }
+       }
+       cpu {
+               cpu.shares = "500";
+       }
+}
+
+# override some default
+group daemons/ssh {
+       perm {
+               task {
+                       uid = root;
+                       fperm = 274;
+               }
+               admin {
+                       uid = root;
+                       fperm = 427;
+               }
+       }
+       cpu {
+               cpu.shares = "500";
+       }
+}
index 0f02e024a8a38468ec372175190d4e2c33258df5..f404f3404dcf56b7d3d1f11f89fc9f381de5baa3 100755 (executable)
@@ -101,5 +101,41 @@ check_perm "STEP4" "/$TMP/cgroups/cpu/daemons/ssh/tasks" 264 root nobody
 
 $TOOLSDIR/cgclear || die "cgclear failed"
 
+# STEP5: config file without default section, but with -a -t params
+$TOOLSDIR/cgconfigparser -l `prepare_config $CONFDIR/permissions_default4.conf` -t nobody:nobody -a nobody:nobody -d 757 -f 757 || \
+    die "STEP5: cgconfigparser -l $CONFDIR/permissions_default4.conf failed"
+
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/www" 757 nobody nobody
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/www/cpu.shares" 646 nobody nobody
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/www/tasks" 646 nobody nobody
+
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ftp" 742 root root
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ftp/cpu.shares" 426 root root
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ftp/tasks" 264 root root
+
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ssh" 757 root nobody
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ssh/cpu.shares" 426 root nobody
+check_perm "STEP5" "/$TMP/cgroups/cpu/daemons/ssh/tasks" 264 root nobody
+
+$TOOLSDIR/cgclear || die "cgclear failed"
+
+# STEP6: config file without default section, but with -a -t params and sticky bit
+$TOOLSDIR/cgconfigparser -l `prepare_config $CONFDIR/permissions_default4.conf` -t nobody:nobody -a nobody:nobody -d 2757 -f 7757 || \
+    die "STEP6: cgconfigparser -l $CONFDIR/permissions_default4.conf failed"
+
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/www" 2757 nobody nobody
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/www/cpu.shares" 7646 nobody nobody
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/www/tasks" 7646 nobody nobody
+
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ftp" 742 root root
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ftp/cpu.shares" 426 root root
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ftp/tasks" 264 root root
+
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ssh" 2757 root nobody
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ssh/cpu.shares" 426 root nobody
+check_perm "STEP6" "/$TMP/cgroups/cpu/daemons/ssh/tasks" 264 root nobody
+
+$TOOLSDIR/cgclear || die "cgclear failed"
+
 cleanup
 exit 0