Added new tests to check cgconfigparser with the new options.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 .../permissions_default4.conf                      |   48 ++++++++++++++++++++
 tests/tools/cgconfigparser/permissions             |   36 +++++++++++++++
 2 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 
tests/tools/cgconfigparser/cgconfigparser_conf_files/permissions_default4.conf

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
index 0000000..97d36f9
--- /dev/null
+++ 
b/tests/tools/cgconfigparser/cgconfigparser_conf_files/permissions_default4.conf
@@ -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";
+       }
+}
diff --git a/tests/tools/cgconfigparser/permissions 
b/tests/tools/cgconfigparser/permissions
index 0f02e02..f404f34 100755
--- a/tests/tools/cgconfigparser/permissions
+++ b/tests/tools/cgconfigparser/permissions
@@ -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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to