From 53aed66c758cc2309ed5b2a0bb3151ff7278310f Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Wed, 2 Jul 2008 09:08:37 +0000 Subject: [PATCH] libcgroup: Fix test cases to use CPU controller if available 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 Acked-by: Sudhir Kumar git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@97 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- tests/libcgrouptest01.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 80d8951c..e144e6c6 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -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); -- 2.47.2