summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2015-05-11 12:15:23 +1000
committerDavid Hows <howsdav@gmail.com>2015-05-11 12:41:50 +1000
commit12b1d560248386e825c7deac40aac0c3cce48158 (patch)
treee0181935a0ea28f320515fde9246f34ef25383f2
parenteb6ce904ba35459f717a70bc43c7db43b9a781a8 (diff)
downloadmongo-12b1d560248386e825c7deac40aac0c3cce48158.tar.gz
Change all testutils functions to return nothing
-rw-r--r--test/checkpoint/test_checkpoint.c3
-rw-r--r--test/fops/t.c3
-rw-r--r--test/huge/huge.c5
-rw-r--r--test/thread/t.c3
-rw-r--r--test/utility/test_util.i22
5 files changed, 18 insertions, 18 deletions
diff --git a/test/checkpoint/test_checkpoint.c b/test/checkpoint/test_checkpoint.c
index 593438dcf97..75ab75863ba 100644
--- a/test/checkpoint/test_checkpoint.c
+++ b/test/checkpoint/test_checkpoint.c
@@ -130,8 +130,7 @@ main(int argc, char *argv[])
/* Clean up on signal. */
(void)signal(SIGINT, onint);
- if ((ret = testutil_work_dir_from_path(g.home, 512, working_dir)) != 0)
- testutil_die(ret, "provided directory name is too long");
+ testutil_work_dir_from_path(g.home, 512, working_dir);
printf("%s: process %" PRIu64 "\n", g.progname, (uint64_t)getpid());
for (cnt = 1; (runs == 0 || cnt <= runs) && g.status == 0; ++cnt) {
diff --git a/test/fops/t.c b/test/fops/t.c
index 4ae1b99aec2..08989e25f90 100644
--- a/test/fops/t.c
+++ b/test/fops/t.c
@@ -119,8 +119,7 @@ main(int argc, char *argv[])
if (argc != 0)
return (usage());
- if ((ret = testutil_work_dir_from_path(home, 512, working_dir)) != 0)
- testutil_die(ret, "provided directory name is too long");
+ testutil_work_dir_from_path(home, 512, working_dir);
/* Clean up on signal. */
(void)signal(SIGINT, onint);
diff --git a/test/huge/huge.c b/test/huge/huge.c
index d47c37b1e7c..c99c2c69e26 100644
--- a/test/huge/huge.c
+++ b/test/huge/huge.c
@@ -1,4 +1,4 @@
-/*-
+ /*-
* Public Domain 2014-2015 MongoDB, Inc.
* Public Domain 2008-2014 WiredTiger, Inc.
*
@@ -200,8 +200,7 @@ main(int argc, char *argv[])
if (argc != 0)
usage();
- if ((ret = testutil_work_dir_from_path(home, 512, working_dir)) != 0)
- testutil_die(ret, "provided directory name is too long");
+ testutil_work_dir_from_path(home, 512, working_dir);
/* Allocate a buffer to use. */
len = small ? ((size_t)SMALL_MAX) : ((size_t)4 * GIGABYTE);
diff --git a/test/thread/t.c b/test/thread/t.c
index baeaa26c69f..8cd637ec605 100644
--- a/test/thread/t.c
+++ b/test/thread/t.c
@@ -143,8 +143,7 @@ main(int argc, char *argv[])
if (argc != 0)
return (usage());
- if ((ret = testutil_work_dir_from_path(home, 512, working_dir)) != 0)
- testutil_die(ret, "provided directory name is too long");
+ testutil_work_dir_from_path(home, 512, working_dir);
if (vary_nops && !multiple_files) {
fprintf(stderr,
diff --git a/test/utility/test_util.i b/test/utility/test_util.i
index 90917fc9f49..c6970bec790 100644
--- a/test/utility/test_util.i
+++ b/test/utility/test_util.i
@@ -68,30 +68,34 @@ testutil_die(int e, const char *fmt, ...)
* Takes a buffer, its size and the intended work directory.
* Creates the full intended work directory in buffer.
*/
-static inline int
+static inline void
testutil_work_dir_from_path(char *buffer, size_t inputSize, char *dir)
{
/* If no directory is provided, use the default. */
if (dir == NULL) {
if (inputSize < sizeof(DEFAULT_DIR))
- return (1);
+ testutil_die(ENOMEM,
+ "Not enough memory in buffer for directory %s%c%s",
+ dir, DIR_DELIM, DEFAULT_DIR);
+
snprintf(buffer, inputSize, DEFAULT_DIR);
- return (0);
+ return;
}
/* Additional bytes for the directory and WT_TEST. */
- if (inputSize < strlen(dir) + sizeof(DEFAULT_DIR))
- return (1);
+ if (inputSize < strlen(dir) + sizeof(DEFAULT_DIR) + sizeof(DIR_DELIM))
+ testutil_die(ENOMEM,
+ "Not enough memory in buffer for directory %s%c%s",
+ dir, DIR_DELIM, DEFAULT_DIR);
snprintf(buffer, inputSize, "%s%c%s", dir, DIR_DELIM, DEFAULT_DIR);
- return (0);
}
/*
* testutil_clean_work_dir --
* Remove any existing work directories, can optionally fail on error
*/
-static inline int
+static inline void
testutil_clean_work_dir(char *dir)
{
size_t inputSize;
@@ -104,9 +108,9 @@ testutil_clean_work_dir(char *dir)
testutil_die(ENOMEM, "Failed to allocate memory");
snprintf(buffer, inputSize, "%s%s", RM_COMMAND, dir);
- ret = system(buffer);
+ if ((ret = system(buffer)) != 0)
+ testutil_die(ret, "System call to remove directory failed");
free(buffer);
- return (ret);
}
/*