From a707f2a2709cee0dc9ca4d4a053d292c8c29f913 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 30 Nov 2011 15:42:58 +0100 Subject: [PATCH] tests: Added tests for cgconfigparser witg -f, -d, -a and -t options. Added new tests to check cgconfigparser with the new options. Signed-off-by: Jan Safranek --- .../permissions_default4.conf | 48 +++++++++++++++++++ tests/tools/cgconfigparser/permissions | 36 ++++++++++++++ 2 files changed, 84 insertions(+) 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 00000000..97d36f94 --- /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 0f02e024..f404f340 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 -- 2.47.2