]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup Test: change test call
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:10:21 +0000 (15:10 +0000)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:10:21 +0000 (15:10 +0000)
Hi,
The api cgroup_modify_cgroup(cgroup1) had to be called before
cgroup_modify_cgroup(cgroup2). This patch does that.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@254 4f4bb910-9a46-0410-90c8-c897d4f1cd53

tests/libcgrouptest01.c

index 85bcdd1c533d9695a796e766de9e81157a6ba212..2aa881e192450b58cf650dab81222503f4b795a9 100644 (file)
@@ -286,7 +286,27 @@ int main(int argc, char *argv[])
                strncpy(extra, "\n", SIZE);
 
                /*
-                * Create another valid cgroup structure
+                * Test07: modify cgroup with the same cgroup
+                * Exp outcome: zero return value. No change.
+                */
+               strncpy(extra, " Called with same cgroup argument\n", SIZE);
+
+               strncpy(path_control_file, mountpoint, sizeof(mountpoint));
+               strncat(path_control_file, "/group1", sizeof("/group1"));
+               strncat(path_control_file, "/", sizeof("/"));
+               strncat(path_control_file, control_file, sizeof(control_file));
+
+               retval = cgroup_modify_cgroup(cgroup1);
+               /* Check if the values are changed */
+               if (!retval && !group_modified(path_control_file, STRING))
+                       message(++i, PASS, "modify_cgroup()", retval, extra);
+               else
+                       message(++i, FAIL, "modify_cgroup()", retval, extra);
+
+               strncpy(extra, "\n", SIZE);
+
+               /*
+                * Create another valid cgroup structure with same group
                 * Exp outcome: no error. 0 return value
                 */
                strncpy(group, "group1", sizeof(group));
@@ -300,7 +320,7 @@ int main(int argc, char *argv[])
                                                 control_file, STRING);
 
                /*
-                * Test07: modify cgroup
+                * Test08: modify cgroup with this new cgroup
                 * Exp outcome: zero return value
                 */
                strncpy(path_control_file, mountpoint, sizeof(mountpoint));
@@ -315,19 +335,6 @@ int main(int argc, char *argv[])
                else
                        message(++i, FAIL, "modify_cgroup()", retval, extra);
 
-               /*
-                * Test08: modify cgroup with the same cgroup
-                * Exp outcome: zero return value
-                */
-
-               retval = cgroup_modify_cgroup(cgroup1);
-               /* Check if the values are changed */
-               if (!retval && !group_modified(path_control_file, STRING))
-                       message(++i, PASS, "modify_cgroup()", retval, extra);
-               else
-                       message(++i, FAIL, "modify_cgroup()", retval, extra);
-
-
                /*
                 * Test09: modify cgroup with the null cgroup
                 * Exp outcome: zero return value.