]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup: Fix test cases to use CPU controller if available
authorDhaval Giani <dhaval@linux.vnet.ibm.com>
Wed, 2 Jul 2008 09:08:37 +0000 (09:08 +0000)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Wed, 2 Jul 2008 09:08:37 +0000 (09:08 +0000)
The test cases used the memory controller. This is not a good idea
since most distro kernels don't enable it by default. For the moment
I'm setting it to use CPU if memory is not found, but in the longer
term I am planning to set it to use CPU first and then memory.

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

tests/libcgrouptest01.c

index 80d8951c564b7f7216a5457f465ea9940fad4fd2..e144e6c66e6a7ede2369019cfcf332de3672bd6c 100644 (file)
@@ -240,8 +240,16 @@ int main(int argc, char *argv[])
                retval = set_controller(MEMORY, controller_name, control_file);
                strncpy(val_string, "40960000", sizeof(val_string));
 
-               if (retval)
-                       fprintf(stderr, "Setting controller failled\n");
+               if (retval) {
+                       retval = set_controller(CPU, controller_name,
+                                                               control_file);
+                       strncpy(val_string, "2048", sizeof(val_string));
+                       if (retval) {
+                               fprintf(stderr, "Failed to set any controllers "
+                                       "Tests dependent on this structure will"
+                                       " fail\n");
+                       }
+               }
 
                cgroup1 = new_cgroup(group, controller_name,
                                                 control_file, STRING);