]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Fixed tests for cgclear -e
authorJan Safranek <jsafrane@redhat.com>
Fri, 9 Dec 2011 14:04:17 +0000 (15:04 +0100)
committerJan Safranek <jsafrane@redhat.com>
Fri, 16 Dec 2011 12:51:40 +0000 (13:51 +0100)
Previous patch fixed exit code of cgclear -e, but I forgot to update the
tests. Here is a fix.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
tests/tools/cgconfigparser/cgclear_config_multi
tests/tools/cgconfigparser/cgclear_config_one

index 765830d01068ddaf592c7e0105bd03f6b8b00a78..964c61d321f9129eaf84fa9a83e56eba623df5ea 100755 (executable)
@@ -44,7 +44,12 @@ grep 1/2/3 <$TMP/groups.log >/dev/null \
 $TOOLSDIR/cgclear -e -l `prepare_config cgclear/cgclear_config_multi_3.conf` \
        -l `prepare_config cgclear/cgclear_config_multi_2.conf` \
        -l `prepare_config cgclear/cgclear_config_multi_1.conf` \
-       && die "STEP2: cgclear should fail!"
+       || die "STEP2: cgclear failed"
+
+# check that cpu,cpuacct:/1/2 still exists
+$TOOLSDIR/lscgroup > $TMP/groups.log
+grep 1/2 <$TMP/groups.log >/dev/null \
+       || die "STEP2: cannot find group '1/2 after cgclear"
 
 $TOOLSDIR/cgclear
 
index de43bd3dbb4e77a694f3fb35794683695a246ebb..e673917ae1507817b88e5d5171ef09729c2ea810 100755 (executable)
@@ -80,9 +80,12 @@ grep first <$TMP/groups.log >/dev/null \
 $TOOLSDIR/cgclassify -g cpu:first $PID \
        || die "STEP4: cgclassify failed"
 
-# try to clear it - cgclear should fail
+# try to clear it - cgclear should not fail and the group should survive
 $TOOLSDIR/cgclear -e -l `prepare_config cgclear/cgclear_config_one.conf` \
-       && die "STEP4: cgclear did not fail!"
+       || die "STEP4: cgclear failed"
+$TOOLSDIR/lscgroup > $TMP/groups2.log
+grep first <$TMP/groups2.log >/dev/null \
+       || die "STEP4: cannot find group 'first' after cgclear"
 
 # cpu:first should survive
 $TOOLSDIR/lscgroup > $TMP/groups.log
@@ -113,9 +116,12 @@ grep first <$TMP/groups.log >/dev/null \
 $TOOLSDIR/cgcreate -g cpu:first/evil \
        || die "STEP5: cgcreate failed"
 
-# try to clear it - cgclear should fail
+# try to clear it - cgclear should not fail, the group should survive
 $TOOLSDIR/cgclear -e -l `prepare_config cgclear/cgclear_config_one.conf` \
-       && die "STEP5: cgclear did not fail!"
+       || die "STEP5: cgclear failed"
+$TOOLSDIR/lscgroup > $TMP/groups2.log
+grep first <$TMP/groups2.log >/dev/null \
+       || die "STEP5: cannot find group 'first' after clear"
 
 # cpu:first/evil should survive
 $TOOLSDIR/lscgroup > $TMP/groups.log