summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/cppsuite/test_harness/util
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-10-19 16:54:52 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-19 06:15:05 +0000
commit546487a45ad9cf22b3e03f71e1d640beeb8e988c (patch)
treed7f2b7d87646fbf1aaa65ba829d67b1fa4c9a68f /src/third_party/wiredtiger/test/cppsuite/test_harness/util
parente7aaf52d138c60e6b9fb7a3566c48469c4bfd3dc (diff)
downloadmongo-546487a45ad9cf22b3e03f71e1d640beeb8e988c.tar.gz
Import wiredtiger: c45301668c5fd6856fffe99a1ed766e23977c517 from branch mongodb-4.4
ref: e8bf2e5fcb..c45301668c for: 4.4.11 WT-5009 Migrate remaining wiredtiger-perf-lsm tests to Evergreen WT-5743 Rewrite cells when the transaction ids are cleared for VLCS WT-5939 Fix naming conflict resulting in "cannot remove directory" error in test_config06 (OSX only) WT-6077 Add new stats to track compact progress WT-7250 Fix the test to perform explicit eviction instead of relying on low cache size WT-7494 Add Python test to trigger update restore eviction during recovery WT-7885 Ensure WiredTiger testing uses tcmalloc where possible WT-8026 Run PPC/zSeries/macOS mainline builds less frequently in Evergreen WT-8067 Fix the code that ensures to insert the newest history store value as full update WT-8116 Fix issues related to inheritance in the cpp testing framework WT-8147 Detect invalid syntax in cppsuite configs WT-8168 Fix unused variables in search near cpp tests WT-8199 Make s_all accept Python PEP8 compliant line breaks WT-8203 Fix the layering violation in accessing the page WT-8204 Fix possible race condition in "wt7989_compact_checkpoint" CSuite test WT-8214 Only publish the docs from the WiredTiger develop Evergreen project WT-8225 Fix data race in zstd get context WT-8226 Fix largest_key failed to consider prepared update
Diffstat (limited to 'src/third_party/wiredtiger/test/cppsuite/test_harness/util')
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cxx46
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h56
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h6
3 files changed, 105 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cxx
new file mode 100644
index 00000000000..39a8fede916
--- /dev/null
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cxx
@@ -0,0 +1,46 @@
+/*-
+ * Public Domain 2014-present MongoDB, Inc.
+ * Public Domain 2008-2014 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <iostream>
+#include <utility>
+
+#include "../connection_manager.h"
+#include "scoped_connection.h"
+
+namespace test_harness {
+
+scoped_connection::scoped_connection(const std::string &db_conn_config, const std::string &home)
+{
+ connection_manager::instance().create(db_conn_config, home);
+}
+
+scoped_connection::~scoped_connection()
+{
+ connection_manager::instance().close();
+}
+
+} // namespace test_harness
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h
new file mode 100644
index 00000000000..6e999b6db54
--- /dev/null
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h
@@ -0,0 +1,56 @@
+/*-
+ * Public Domain 2014-present MongoDB, Inc.
+ * Public Domain 2008-2014 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef SCOPED_CONNECTION_H
+#define SCOPED_CONNECTION_H
+
+/* Following definitions are required in order to use printing format specifiers in C++. */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+
+extern "C" {
+#include "test_util.h"
+}
+
+#include "../connection_manager.h"
+
+namespace test_harness {
+
+class scoped_connection {
+ public:
+ explicit scoped_connection(
+ const std::string &db_conn_config, const std::string &home = DEFAULT_DIR);
+ ~scoped_connection();
+};
+
+} // namespace test_harness
+#endif
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h
index edb38e3e22c..71fc24f6c26 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h
@@ -45,12 +45,12 @@ namespace test_harness {
class scoped_cursor {
public:
scoped_cursor() = default;
- scoped_cursor(WT_SESSION *session, const char *uri, const char *cfg);
+ explicit scoped_cursor(WT_SESSION *session, const char *uri, const char *cfg);
/* Moving is ok but copying is not. */
scoped_cursor(scoped_cursor &&other);
- virtual ~scoped_cursor();
+ ~scoped_cursor();
scoped_cursor &operator=(scoped_cursor &&other);
scoped_cursor(const scoped_cursor &) = delete;
@@ -72,7 +72,7 @@ class scoped_session {
scoped_session() = default;
explicit scoped_session(WT_CONNECTION *conn);
- virtual ~scoped_session();
+ ~scoped_session();
/* Moving is ok but copying is not. */
scoped_session(scoped_session &&other);