diff options
author | David Gibson <dgibson@sneetch.ozlabs.ibm.com> | 2006-02-27 18:25:07 +1100 |
---|---|---|
committer | David Gibson <dgibson@sneetch.ozlabs.ibm.com> | 2006-02-27 18:25:07 +1100 |
commit | 40afbad6b7ac0ef5a12e2f5e9465aac673dd1496 (patch) | |
tree | da9a49ebb9be8b1b4ca357da707e205fe06e2ad1 /tests/testutils.c | |
parent | db7b0a038477f9f9c86dc489c45ea01cc475b8ed (diff) | |
download | libhugetlbfs-40afbad6b7ac0ef5a12e2f5e9465aac673dd1496.tar.gz |
Cleanup and bugfixing of stress tests
A whole bunch of fixes to the stress tests. This makes them more robust
(don't fail when they shouldn't), more selective (do fail when they should),
produces more helpful diagnostics when they do fail, makes them more quiest
when verbosity is not explicitly requested and makes the coding style closer
to that of the functional test cases.
Particularly notable, I've fixed a serious bug in mmap-cow introduced when I
first imported the stress tests - it wasn't actually triggering any COWs
at all.
Diffstat (limited to 'tests/testutils.c')
-rw-r--r-- | tests/testutils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testutils.c b/tests/testutils.c index e0cdae3..7cfd29c 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -23,8 +23,11 @@ #include <stdlib.h> #include <limits.h> #include <string.h> +#include <errno.h> #include <signal.h> #include <sys/vfs.h> +#include <sys/ipc.h> +#include <sys/shm.h> #include "hugetests.h" @@ -141,3 +144,15 @@ int test_addr_huge(void *p) return (sb.f_type == HUGETLBFS_MAGIC); } + +int remove_shmid(int shmid) +{ + if (shmid > 0) { + if (shmctl(shmid, IPC_RMID, NULL) != 0) { + ERROR("shmctl(%x, IPC_RMID) failed (%s)\n", + shmid, strerror(errno)); + return -1; + } + } + return 0; +} |