summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/utility/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/test/utility/misc.c')
-rw-r--r--src/third_party/wiredtiger/test/utility/misc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c
index 90d50ffd453..eeb6b1d5cbb 100644
--- a/src/third_party/wiredtiger/test/utility/misc.c
+++ b/src/third_party/wiredtiger/test/utility/misc.c
@@ -358,6 +358,22 @@ testutil_print_command_line(int argc, char *const *argv)
printf("\n");
}
+/*
+ * testutil_wiredtiger_open --
+ * Call wiredtiger_open with the tiered storage configuration if enabled.
+ */
+void
+testutil_wiredtiger_open(TEST_OPTS *opts, const char *config, WT_EVENT_HANDLER *event_handler,
+ WT_CONNECTION **connectionp, bool rerun)
+{
+ char buf[1024];
+
+ testutil_check(__wt_snprintf(buf, sizeof(buf), "%s%s%s%s", config,
+ (rerun ? TESTUTIL_ENV_CONFIG_REC : ""), (opts->compat ? TESTUTIL_ENV_CONFIG_COMPAT : ""),
+ (opts->tiered_storage ? TESTUTIL_ENV_CONFIG_TIERED_EXT TESTUTIL_ENV_CONFIG_TIERED : "")));
+ testutil_check(wiredtiger_open(NULL, event_handler, buf, connectionp));
+}
+
#ifndef _WIN32
/*
* testutil_sleep_wait --
@@ -387,6 +403,19 @@ testutil_sleep_wait(uint32_t seconds, pid_t pid)
#endif
/*
+ * testutil_time_us --
+ * Return the number of microseconds since the epoch.
+ */
+uint64_t
+testutil_time_us(WT_SESSION *session)
+{
+ struct timespec ts;
+
+ __wt_epoch((WT_SESSION_IMPL *)session, &ts);
+ return ((uint64_t)ts.tv_sec * WT_MILLION + (uint64_t)ts.tv_nsec / WT_THOUSAND);
+}
+
+/*
* dcalloc --
* Call calloc, dying on failure.
*/