diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:02:54 +0000 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:02:54 +0000 |
commit | 5058d87a7e7fea00564b1b5cadbb75b0634a5857 (patch) | |
tree | 41641695b972b939a87ee9d2d237720bfd508431 /tests/libcgrouptest01.c | |
parent | 764a147fae9ab82b15c2ed94b5b510c3879f2530 (diff) | |
download | libcg-5058d87a7e7fea00564b1b5cadbb75b0634a5857.tar.gz libcg-5058d87a7e7fea00564b1b5cadbb75b0634a5857.tar.xz libcg-5058d87a7e7fea00564b1b5cadbb75b0634a5857.zip |
libcgroup Test: libcgrouptest-multimnt-sanitycheck
Hi
The following patch adds the sanity check in c file for multiple mount case.
The parameter passed to the function decides whether the check is for single
mount or multiple mount.
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@246 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests/libcgrouptest01.c')
-rw-r--r-- | tests/libcgrouptest01.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 2139ffa..7cd70c4 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) case FS_MOUNTED: /* Do a sanity check if cgroup fs is mounted */ - if (check_fsmounted()) { + if (check_fsmounted(0)) { printf("Sanity check fails. cgroup fs not mounted\n"); printf("Exiting without running this set of tests\n"); exit(1); @@ -397,6 +397,14 @@ int main(int argc, char *argv[]) break; case FS_MULTI_MOUNTED: + + /* Do a sanity check if cgroup fs is multi mounted */ + if (check_fsmounted(1)) { + printf("Sanity check fails. cgroup fs not multi mounted\n"); + printf("Exiting without running this set of tests\n"); + exit(1); + } + /* * Test01: call apis and check return values * Exp outcome: @@ -862,8 +870,9 @@ struct cgroup *new_cgroup(char *group, char *controller_name, return newcgroup; } -int check_fsmounted() +int check_fsmounted(int multimnt) { + int count = 0; struct mntent *entry, *tmp_entry; /* Need a better mechanism to decide memory allocation size here */ char entry_buffer[FILENAME_MAX * 4]; @@ -882,8 +891,16 @@ int check_fsmounted() } while ((entry = getmntent_r(proc_file, tmp_entry, entry_buffer, FILENAME_MAX*4)) != NULL) { if (!strncmp(entry->mnt_type, "cgroup", strlen("cgroup"))) { - printf("sanity check pass.... %s\n", entry->mnt_type); - return 0; + count++; + if (multimnt) { + if (count >= 2) { + printf("sanity check pass.... %s\n", entry->mnt_type); + return 0; + } + } else { + printf("sanity check pass.... %s\n", entry->mnt_type); + return 0; + } } } return 1; |