summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/utility/misc.c
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2017-06-29 11:38:10 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-06-29 11:40:58 +1000
commit690302a49b61d5be3f4dcc285921eb362648055c (patch)
treed0bac8380e27a4ed7a38b9c82fc2996af87b2845 /src/third_party/wiredtiger/test/utility/misc.c
parenta72d5e357fc0e8b31e705cba539762cd79093773 (diff)
downloadmongo-690302a49b61d5be3f4dcc285921eb362648055c.tar.gz
Import wiredtiger: ff10db881161bbd1bc23e40ac385ff0de18f68ff from branch mongodb-3.6
ref: f59321a372..ff10db8811 for: 3.5.10 WT-1939 Improve error handling in example code WT-3181 Add support for MongoDB timestamps WT-3342 Create a new WiredTiger 2.9.2 release WT-3363 Add test case to detect when drops may be blocked by checkpoints WT-3373 Access violation due to a bug in internal page splitting WT-3385 Coverity 1376471: __wt_txn_parse_timestamp() memory overrun WT-3391 Create a WiredTiger 2.9.3 release. WT-3392 Coverity analysis complaints WT-3393 Missing barrier when a WT_UPDATE structure is appended to list. Also manually update wiredtiger_config.h pre-generated files in MongoDB source tree
Diffstat (limited to 'src/third_party/wiredtiger/test/utility/misc.c')
-rw-r--r--src/third_party/wiredtiger/test/utility/misc.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c
index e119fef47f1..cb0e8ed29ff 100644
--- a/src/third_party/wiredtiger/test/utility/misc.c
+++ b/src/third_party/wiredtiger/test/utility/misc.c
@@ -128,7 +128,7 @@ testutil_clean_work_dir(const char *dir)
* Delete the existing work directory, then create a new one.
*/
void
-testutil_make_work_dir(char *dir)
+testutil_make_work_dir(const char *dir)
{
size_t len;
int ret;
@@ -166,20 +166,22 @@ testutil_cleanup(TEST_OPTS *opts)
}
/*
- * testutil_enable_long_tests --
- * Return if TESTUTIL_ENABLE_LONG_TESTS is set.
+ * testutil_is_flag_set --
+ * Return if an environment variable flag is set.
*/
bool
-testutil_enable_long_tests(void)
+testutil_is_flag_set(const char *flag)
{
const char *res;
bool enable_long_tests;
- if (__wt_getenv(NULL,
- "TESTUTIL_ENABLE_LONG_TESTS", &res) == WT_NOTFOUND)
+ if (__wt_getenv(NULL, flag, &res) == WT_NOTFOUND)
return (false);
- /* Accept anything other than "TESTUTIL_ENABLE_LONG_TESTS=0". */
+ /*
+ * This is a boolean test. So if the environment variable is set to any
+ * value other than 0, we return success.
+ */
enable_long_tests = res[0] != '0';
free((void *)res);
@@ -256,3 +258,26 @@ dstrndup(const char *str, size_t len)
memcpy(p, str, len);
return (p);
}
+
+/*
+ * example_setup --
+ * Set the program name, create a home directory for the example programs.
+ */
+const char *
+example_setup(int argc, char * const *argv)
+{
+ const char *home;
+
+ (void)argc; /* Unused variable */
+
+ (void)testutil_set_progname(argv);
+
+ /*
+ * Create a clean test directory for this run of the test program if the
+ * environment variable isn't already set (as is done by make check).
+ */
+ if ((home = getenv("WIREDTIGER_HOME")) == NULL)
+ home = "WT_HOME";
+ testutil_make_work_dir(home);
+ return (home);
+}