summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlison Felizzi <alison.felizzi@mongodb.com>2021-10-28 04:09:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-28 04:36:15 +0000
commit4c614c274bc33aa13feed6c1226073e96cf296d3 (patch)
treea2aadfa81b978872fbda5cb62fc3b38b579ce9b1 /src
parent0f72368afebe2bf8e1c66dbfa40c9451572fb86e (diff)
downloadmongo-4c614c274bc33aa13feed6c1226073e96cf296d3.tar.gz
Import wiredtiger: fafdde779d6825b00810b164f123f64b5559bf00 from branch mongodb-master
ref: 0a66a61b2f..fafdde779d for: 5.2.0 WT-8196 Add warning options to the cppsuite files
Diffstat (limited to 'src')
-rw-r--r--src/third_party/wiredtiger/bench/workgen/Makefile.am4
-rw-r--r--src/third_party/wiredtiger/build_posix/aclocal/strict.m452
-rw-r--r--src/third_party/wiredtiger/build_posix/configure.ac.in5
-rw-r--r--src/third_party/wiredtiger/cmake/helpers.cmake6
-rw-r--r--src/third_party/wiredtiger/cmake/strict/cl_strict.cmake21
-rw-r--r--src/third_party/wiredtiger/cmake/strict/clang_strict.cmake62
-rw-r--r--src/third_party/wiredtiger/cmake/strict/clangxx_strict.cmake18
-rw-r--r--src/third_party/wiredtiger/cmake/strict/clxx_strict.cmake18
-rw-r--r--src/third_party/wiredtiger/cmake/strict/gcc_strict.cmake90
-rw-r--r--src/third_party/wiredtiger/cmake/strict/gxx_strict.cmake17
-rw-r--r--src/third_party/wiredtiger/cmake/strict/strict_flags_helpers.cmake236
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/Makefile.am1
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cxx2
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/test.cxx2
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cxx4
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cxx82
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h82
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h2
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cxx19
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h6
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cxx4
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cxx9
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cxx31
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h51
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cxx4
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cxx6
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cxx11
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cxx10
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cxx2
-rwxr-xr-xsrc/third_party/wiredtiger/test/cppsuite/tests/run.cxx8
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cxx4
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cxx7
-rw-r--r--src/third_party/wiredtiger/test/ctest_helpers.cmake15
34 files changed, 607 insertions, 286 deletions
diff --git a/src/third_party/wiredtiger/bench/workgen/Makefile.am b/src/third_party/wiredtiger/bench/workgen/Makefile.am
index 61512d65319..e635a746d6b 100644
--- a/src/third_party/wiredtiger/bench/workgen/Makefile.am
+++ b/src/third_party/wiredtiger/bench/workgen/Makefile.am
@@ -1,5 +1,7 @@
+# FIX-ME-WT-8263: Remove the next line to keep the flags defined in configure.ac.in
+AM_CXXFLAGS =
AM_CPPFLAGS = -I$(top_builddir)
-AM_CPPFLAGS += -I$(top_srcdir)/src/include
+AM_CPPFLAGS +=-I$(top_srcdir)/src/include
AM_CPPFLAGS +=-I$(top_srcdir)/test/utility
PYSRC = $(top_srcdir)/bench/workgen
diff --git a/src/third_party/wiredtiger/build_posix/aclocal/strict.m4 b/src/third_party/wiredtiger/build_posix/aclocal/strict.m4
index 545ca02a451..af1947818dd 100644
--- a/src/third_party/wiredtiger/build_posix/aclocal/strict.m4
+++ b/src/third_party/wiredtiger/build_posix/aclocal/strict.m4
@@ -3,31 +3,21 @@
# GCC warnings.
AC_DEFUN([AM_GCC_WARNINGS], [
- w="$w -Wall -Wextra -Werror"
- w="$w -Waggregate-return"
- w="$w -Wbad-function-cast"
+ # List of common C/CXX flags.
w="$w -Wcast-align"
- w="$w -Wdeclaration-after-statement"
w="$w -Wdouble-promotion"
+ w="$w -Werror"
w="$w -Wfloat-equal"
w="$w -Wformat-nonliteral"
w="$w -Wformat-security"
w="$w -Wformat=2"
w="$w -Winit-self"
- w="$w -Wjump-misses-init"
w="$w -Wmissing-declarations"
w="$w -Wmissing-field-initializers"
- w="$w -Wmissing-prototypes"
- w="$w -Wnested-externs"
- w="$w -Wold-style-definition"
w="$w -Wpacked"
w="$w -Wpointer-arith"
- w="$w -Wpointer-sign"
w="$w -Wredundant-decls"
- w="$w -Wshadow"
- w="$w -Wsign-conversion"
- w="$w -Wstrict-prototypes"
w="$w -Wswitch-enum"
w="$w -Wundef"
w="$w -Wuninitialized"
@@ -72,8 +62,6 @@ AC_DEFUN([AM_GCC_WARNINGS], [
if test $gcc5 -eq 1; then
w="$w -Wformat-signedness"
- w="$w -Wjump-misses-init"
- w="$w -Wredundant-decls"
w="$w -Wunused-macros"
w="$w -Wvariadic-macros"
fi
@@ -94,13 +82,35 @@ AC_DEFUN([AM_GCC_WARNINGS], [
w="$w -Wmultistatement-macros"
fi
- wt_cv_strict_warnings="$w"
+ w_c="$w"
+ w_cxx="$w"
+
+ # FIX-ME-WT-8247: Add those flags to the common ones if we want them for the compilation of the c++ files too.
+ w_c="$w_c -Waggregate-return"
+ w_c="$w_c -Wall"
+ w_c="$w_c -Wextra"
+ w_c="$w_c -Wshadow"
+ w_c="$w_c -Wsign-conversion"
+
+ # Specific C flags.
+ w_c="$w_c -Wbad-function-cast"
+ w_c="$w_c -Wdeclaration-after-statement"
+ w_c="$w_c -Wjump-misses-init"
+ w_c="$w_c -Wmissing-prototypes"
+ w_c="$w_c -Wnested-externs"
+ w_c="$w_c -Wold-style-definition"
+ w_c="$w_c -Wpointer-sign"
+ w_c="$w_c -Wstrict-prototypes"
+
+ wt_c_strict_warnings="$w_c"
+ wt_cxx_strict_warnings="$w_cxx"
])
# Clang warnings.
AC_DEFUN([AM_CLANG_WARNINGS], [
- w="-Weverything -Werror"
+ # List of common C/CXX flags.
+ w="$w -Werror"
w="$w -Wno-cast-align"
w="$w -Wno-documentation-unknown-command"
w="$w -Wno-format-nonliteral"
@@ -146,5 +156,13 @@ AC_DEFUN([AM_CLANG_WARNINGS], [
# Ignore unrecognized options.
w="$w -Wno-unknown-warning-option"
- wt_cv_strict_warnings="$w"
+ w_c="$w"
+ w_cxx="$w"
+
+ # Specific C flags.
+ # The -Weverything flag is not recommended, we only keep it for C files as it was already enabled.
+ w_c="$w_c -Weverything"
+
+ wt_c_strict_warnings="$w_c"
+ wt_cxx_strict_warnings="$w_cxx"
])
diff --git a/src/third_party/wiredtiger/build_posix/configure.ac.in b/src/third_party/wiredtiger/build_posix/configure.ac.in
index 6681e0e5650..c4b63ef92e5 100644
--- a/src/third_party/wiredtiger/build_posix/configure.ac.in
+++ b/src/third_party/wiredtiger/build_posix/configure.ac.in
@@ -139,7 +139,8 @@ if test "$wt_cv_enable_strict" = "yes"; then
[--enable-strict does not support "$wt_cv_cc_version".]);;
esac
- AM_CFLAGS="$AM_CFLAGS $wt_cv_strict_warnings"
+ AM_CFLAGS="$AM_CFLAGS $wt_c_strict_warnings"
+ AM_CXXFLAGS="$AM_CXXFLAGS $wt_cxx_strict_warnings"
fi
# Python API
@@ -237,7 +238,9 @@ fi
AC_DEFINE_UNQUOTED(WT_BUFFER_ALIGNMENT_DEFAULT, $BUFFER_ALIGNMENT,
[Default alignment of buffers used for I/O])
+# Export the C and CXX flags.
AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CXXFLAGS)
# Warn that diagnostic builds should not be used in production
if test "$wt_cv_enable_diagnostic" = "yes"; then
diff --git a/src/third_party/wiredtiger/cmake/helpers.cmake b/src/third_party/wiredtiger/cmake/helpers.cmake
index f3019627b8e..bec3477d45e 100644
--- a/src/third_party/wiredtiger/cmake/helpers.cmake
+++ b/src/third_party/wiredtiger/cmake/helpers.cmake
@@ -376,7 +376,7 @@ function(config_include config_name description)
set(${config_name} OFF CACHE INTERNAL "" FORCE)
set(${config_name}_DISABLED ON CACHE INTERNAL "" FORCE)
endif()
- # Set an internal cahce variable with the CPP include statement. We can use this when building out our config header.
+ # Set an internal cache variable with the CPP include statement. We can use this when building out our config header.
if (${${config_name}})
set(${config_name}_DECL "#include <${CONFIG_INCLUDE_FILE}>" CACHE INTERNAL "")
endif()
@@ -554,7 +554,7 @@ endfunction()
# assert_type_size(type size)
# Wrapper function around 'test_type_size' that additionally asserts whether the given types meets an expected size.
# Throws a fatal error if the type is not found or doesn't equal the expected size.
-# type - eame of the type to test.
+# type - name of the type to test.
# size - expected size of the type.
# EXTRA_INCLUDES - extra/optional include files to access the given type e.g. a custom typedef in an include header.
function(assert_type_size type size)
@@ -582,7 +582,7 @@ function(assert_type_size type size)
message(FATAL_ERROR "Type assertion failed: ${type} does not exists")
endif()
- if((NOT ${size} EQUAL 0) AND (NOT ${output_type_size} EQUAL ${size}))
+ if((NOT ${size} EQUAL 0) AND (NOT ${output_type_size} EQUAL ${size}))
# Type does not meet size assertion.
message(FATAL_ERROR "Type assertion failed: ${type} does not equal size ${size}")
endif()
diff --git a/src/third_party/wiredtiger/cmake/strict/cl_strict.cmake b/src/third_party/wiredtiger/cmake/strict/cl_strict.cmake
index 625bf9e88d5..12607dd64e9 100644
--- a/src/third_party/wiredtiger/cmake/strict/cl_strict.cmake
+++ b/src/third_party/wiredtiger/cmake/strict/cl_strict.cmake
@@ -6,16 +6,13 @@
# See the file LICENSE for redistribution information.
#
-# Warning level 3.
-list(APPEND win_c_flags "/WX")
-# Ignore warning about mismatched const qualifiers.
-list(APPEND win_c_flags "/wd4090")
-# Ignore deprecated functions.
-list(APPEND win_c_flags "/wd4996")
-# Complain about unreferenced format parameter.
-list(APPEND win_c_flags "/we4100")
-# Enable security check.
-list(APPEND win_c_flags "/GS")
+include(cmake/strict/strict_flags_helpers.cmake)
-# Set our base compiler flags that can be used by the rest of our build.
-set(COMPILER_DIAGNOSTIC_FLAGS "${COMPILER_DIAGNOSTIC_FLAGS};${win_c_flags}" CACHE INTERNAL "" FORCE)
+# Get common CL flags.
+set(cl_flags)
+get_cl_base_flags(cl_flags C)
+
+# Specific C flags:
+
+# Set our common compiler flags that can be used by the rest of our build.
+set(COMPILER_DIAGNOSTIC_C_FLAGS ${cl_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/clang_strict.cmake b/src/third_party/wiredtiger/cmake/strict/clang_strict.cmake
index f87c988fe02..676f9483405 100644
--- a/src/third_party/wiredtiger/cmake/strict/clang_strict.cmake
+++ b/src/third_party/wiredtiger/cmake/strict/clang_strict.cmake
@@ -6,60 +6,14 @@
# See the file LICENSE for redistribution information.
#
-list(APPEND clang_base_c_flags "-Weverything")
-list(APPEND clang_base_c_flags "-Werror")
-list(APPEND clang_base_c_flags "-Wno-cast-align")
-list(APPEND clang_base_c_flags "-Wno-documentation-unknown-command")
-list(APPEND clang_base_c_flags "-Wno-format-nonliteral")
-list(APPEND clang_base_c_flags "-Wno-packed")
-list(APPEND clang_base_c_flags "-Wno-padded")
-list(APPEND clang_base_c_flags "-Wno-reserved-id-macro")
-list(APPEND clang_base_c_flags "-Wno-zero-length-array")
+include(cmake/strict/strict_flags_helpers.cmake)
-# We should turn on cast-qual, but not as a fatal error: see WT-2690.
-# For now, turn it off.
-list(APPEND clang_base_c_flags "-Wno-cast-qual")
+# Get common CLANG flags.
+set(clang_flags)
+get_clang_base_flags(clang_flags C)
-# Turn off clang thread-safety-analysis, it doesn't like some of the
-# code patterns in WiredTiger.
-list(APPEND clang_base_c_flags "-Wno-thread-safety-analysis")
+# Specific C flags:
+list(APPEND clang_flags "-Weverything")
-# On Centos 7.3.1611, system header files aren't compatible with
-# -Wdisabled-macro-expansion.
-list(APPEND clang_base_c_flags "-Wno-disabled-macro-expansion")
-
-# We occasionally use an extra semicolon to indicate an empty loop or
-# conditional body.
-list(APPEND clang_base_c_flags "-Wno-extra-semi-stmt")
-
-# Ignore unrecognized options.
-list(APPEND clang_base_c_flags "-Wno-unknown-warning-option")
-
-if(WT_DARWIN AND (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.1))
- # Apple clang has its own numbering system, and older OS X
- # releases need some special love. Turn off some flags for
- # Apple's clang 4.1:
- # Apple clang version 4.1
- # ((tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
- list(APPEND clang_base_c_flags "-Wno-attributes")
- list(APPEND clang_base_c_flags "-Wno-pedantic")
- list(APPEND clang_base_c_flags "-Wno-unused-command-line-argument")
-endif()
-
-if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
- # Clang 10+ has added additional on-by-default diagnostics that isn't
- # compatible with some of the code patterns in WiredTiger.
- list(APPEND clang_base_c_flags "-Wno-implicit-fallthrough")
- list(APPEND clang_base_c_flags "-Wno-implicit-int-float-conversion")
-endif()
-
-if(WT_DARWIN AND NOT CMAKE_CROSSCOMPILING)
- # If we are not cross-compiling, we can safely disable this diagnostic.
- # Its incompatible with strict diagnostics when including external
- # libraries that are not in the default linker path
- # e.g. linking zlib/snappy/... from /usr/local/.
- list(APPEND clang_base_c_flags "-Wno-poison-system-directories")
-endif()
-
-# Set our base clang flags to ensure it propogates to the rest of our build.
-set(COMPILER_DIAGNOSTIC_FLAGS "${COMPILER_DIAGNOSTIC_FLAGS};${clang_base_c_flags}" CACHE INTERNAL "" FORCE)
+# Set our common compiler flags that can be used by the rest of our build.
+set(COMPILER_DIAGNOSTIC_C_FLAGS ${clang_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/clangxx_strict.cmake b/src/third_party/wiredtiger/cmake/strict/clangxx_strict.cmake
new file mode 100644
index 00000000000..3533c55cdb1
--- /dev/null
+++ b/src/third_party/wiredtiger/cmake/strict/clangxx_strict.cmake
@@ -0,0 +1,18 @@
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+# All rights reserved.
+#
+# See the file LICENSE for redistribution information.
+#
+
+include(cmake/strict/strict_flags_helpers.cmake)
+
+# Get common CLANG flags.
+set(clangxx_flags)
+get_clang_base_flags(clangxx_flags CXX)
+
+# Specific CXX flags:
+
+# Set our common compiler flags that can be used by the rest of our build.
+set(COMPILER_DIAGNOSTIC_CXX_FLAGS ${clangxx_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/clxx_strict.cmake b/src/third_party/wiredtiger/cmake/strict/clxx_strict.cmake
new file mode 100644
index 00000000000..af799922c7c
--- /dev/null
+++ b/src/third_party/wiredtiger/cmake/strict/clxx_strict.cmake
@@ -0,0 +1,18 @@
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+# All rights reserved.
+#
+# See the file LICENSE for redistribution information.
+#
+
+include(cmake/strict/strict_flags_helpers.cmake)
+
+# Get common CL flags.
+set(clxx_flags)
+get_cl_base_flags(clxx_flags CXX)
+
+# Specific CXX flags:
+
+# Set our common compiler flags that can be used by the rest of our build.
+set(COMPILER_DIAGNOSTIC_CXX_FLAGS ${clxx_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/gcc_strict.cmake b/src/third_party/wiredtiger/cmake/strict/gcc_strict.cmake
index 420a4457676..d15e065cc91 100644
--- a/src/third_party/wiredtiger/cmake/strict/gcc_strict.cmake
+++ b/src/third_party/wiredtiger/cmake/strict/gcc_strict.cmake
@@ -6,74 +6,28 @@
# See the file LICENSE for redistribution information.
#
-list(APPEND gcc_base_c_flags "-Wall")
-list(APPEND gcc_base_c_flags "-Wextra")
-list(APPEND gcc_base_c_flags "-Werror")
-list(APPEND gcc_base_c_flags "-Waggregate-return")
-list(APPEND gcc_base_c_flags "-Wbad-function-cast")
-list(APPEND gcc_base_c_flags "-Wcast-align")
-list(APPEND gcc_base_c_flags "-Wdeclaration-after-statement")
-list(APPEND gcc_base_c_flags "-Wdouble-promotion")
-list(APPEND gcc_base_c_flags "-Wfloat-equal")
-list(APPEND gcc_base_c_flags "-Wformat-nonliteral")
-list(APPEND gcc_base_c_flags "-Wformat-security")
-list(APPEND gcc_base_c_flags "-Wformat=2")
-list(APPEND gcc_base_c_flags "-Winit-self")
-list(APPEND gcc_base_c_flags "-Wjump-misses-init")
-list(APPEND gcc_base_c_flags "-Wmissing-declarations")
-list(APPEND gcc_base_c_flags "-Wmissing-field-initializers")
-list(APPEND gcc_base_c_flags "-Wmissing-prototypes")
-list(APPEND gcc_base_c_flags "-Wnested-externs")
-list(APPEND gcc_base_c_flags "-Wold-style-definition")
-list(APPEND gcc_base_c_flags "-Wpacked")
-list(APPEND gcc_base_c_flags "-Wpointer-arith")
-list(APPEND gcc_base_c_flags "-Wpointer-sign")
-list(APPEND gcc_base_c_flags "-Wredundant-decls")
-list(APPEND gcc_base_c_flags "-Wshadow")
-list(APPEND gcc_base_c_flags "-Wsign-conversion")
-list(APPEND gcc_base_c_flags "-Wstrict-prototypes")
-list(APPEND gcc_base_c_flags "-Wswitch-enum")
-list(APPEND gcc_base_c_flags "-Wundef")
-list(APPEND gcc_base_c_flags "-Wuninitialized")
-list(APPEND gcc_base_c_flags "-Wunreachable-code")
-list(APPEND gcc_base_c_flags "-Wunused")
-list(APPEND gcc_base_c_flags "-Wwrite-strings")
+include(cmake/strict/strict_flags_helpers.cmake)
-# Non-fatal informational warnings.
-# We don't turn on the unsafe-loop-optimizations warning after gcc7,
-# it's too noisy to tolerate. Regardless, don't fail even when it's
-# configured.
-list(APPEND gcc_base_c_flags "-Wno-error=unsafe-loop-optimizations")
-if(${CMAKE_C_COMPILER_VERSION} VERSION_EQUAL 4.7)
- list(APPEND gcc_base_c_flags "-Wno-c11-extensions")
- list(APPEND gcc_base_c_flags "-Wunsafe-loop-optimizations")
-elseif(${CMAKE_C_COMPILER_VERSION} VERSION_EQUAL 5)
- list(APPEND gcc_base_c_flags "-Wunsafe-loop-optimizations")
-endif()
+# Get common GNU flags.
+set(gcc_flags)
+get_gnu_base_flags(gcc_flags C)
-if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 5)
- list(APPEND gcc_base_c_flags "-Wformat-signedness")
- list(APPEND gcc_base_c_flags "-Wjump-misses-init")
- list(APPEND gcc_base_c_flags "-Wredundant-decls")
- list(APPEND gcc_base_c_flags "-Wunused-macros")
- list(APPEND gcc_base_c_flags "-Wvariadic-macros")
-endif()
-if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 6)
- list(APPEND gcc_base_c_flags "-Wduplicated-cond")
- list(APPEND gcc_base_c_flags "-Wlogical-op")
- list(APPEND gcc_base_c_flags "-Wunused-const-variable=2")
-endif()
-if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 7)
- list(APPEND gcc_base_c_flags "-Walloca")
- list(APPEND gcc_base_c_flags "-Walloc-zero")
- list(APPEND gcc_base_c_flags "-Wduplicated-branches")
- list(APPEND gcc_base_c_flags "-Wformat-overflow=2")
- list(APPEND gcc_base_c_flags "-Wformat-truncation=2")
- list(APPEND gcc_base_c_flags "-Wrestrict")
-endif()
-if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 8)
- list(APPEND gcc_base_c_flags "-Wmultistatement-macros")
-endif()
+# FIX-ME-WT-8247: Add those flags to the common GNU flags if we want them for the compilation of the
+# c++ files too.
+list(APPEND gcc_flags "-Waggregate-return")
+list(APPEND gcc_flags "-Wall")
+list(APPEND gcc_flags "-Wextra")
+list(APPEND gcc_flags "-Wshadow")
+list(APPEND gcc_flags "-Wsign-conversion")
-# Set our base gcc flags to ensure it propogates to the rest of our build.
-set(COMPILER_DIAGNOSTIC_FLAGS "${COMPILER_DIAGNOSTIC_FLAGS};${gcc_base_c_flags}" CACHE INTERNAL "" FORCE)
+# Specific C flags:
+list(APPEND gcc_flags "-Wbad-function-cast")
+list(APPEND gcc_flags "-Wdeclaration-after-statement")
+list(APPEND gcc_flags "-Wjump-misses-init")
+list(APPEND gcc_flags "-Wmissing-prototypes")
+list(APPEND gcc_flags "-Wnested-externs")
+list(APPEND gcc_flags "-Wold-style-definition")
+list(APPEND gcc_flags "-Wpointer-sign")
+list(APPEND gcc_flags "-Wstrict-prototypes")
+
+set(COMPILER_DIAGNOSTIC_C_FLAGS ${gcc_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/gxx_strict.cmake b/src/third_party/wiredtiger/cmake/strict/gxx_strict.cmake
new file mode 100644
index 00000000000..81d205a3b88
--- /dev/null
+++ b/src/third_party/wiredtiger/cmake/strict/gxx_strict.cmake
@@ -0,0 +1,17 @@
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+# All rights reserved.
+#
+# See the file LICENSE for redistribution information.
+#
+
+include(cmake/strict/strict_flags_helpers.cmake)
+
+# Get common GNU flags.
+set(gxx_flags)
+get_gnu_base_flags(gxx_flags CXX)
+
+# Specific CXX flags:
+
+set(COMPILER_DIAGNOSTIC_CXX_FLAGS ${gxx_flags})
diff --git a/src/third_party/wiredtiger/cmake/strict/strict_flags_helpers.cmake b/src/third_party/wiredtiger/cmake/strict/strict_flags_helpers.cmake
new file mode 100644
index 00000000000..8abfe950416
--- /dev/null
+++ b/src/third_party/wiredtiger/cmake/strict/strict_flags_helpers.cmake
@@ -0,0 +1,236 @@
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+# All rights reserved.
+#
+# See the file LICENSE for redistribution information
+#
+
+# get_gnu_base_flags(flags)
+# Helper function that generates a set of common GNU flags for a given language.
+# flags - list of flags.
+function(get_gnu_base_flags flags)
+ cmake_parse_arguments(
+ PARSE_ARGV
+ 1
+ "GNU_FLAGS"
+ "CXX;C"
+ ""
+ ""
+ )
+
+ if (NOT "${GNU_FLAGS_UNPARSED_ARGUMENTS}" STREQUAL "")
+ message(FATAL_ERROR "Unknown arguments to get_gnu_base_flags: ${GNU_FLAGS_UNPARSED_ARGUMENTS}")
+ endif()
+
+ set(cmake_compiler_version)
+
+ if(${GNU_FLAGS_C} AND ${GNU_FLAGS_CXX})
+ message(FATAL_ERROR "Only one language is accepted")
+ elseif(GNU_FLAGS_C)
+ set(cmake_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif(GNU_FLAGS_CXX)
+ set(cmake_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ else()
+ message(FATAL_ERROR "No language passed")
+ endif()
+
+ set(gnu_flags)
+
+ list(APPEND gnu_flags "-Wcast-align")
+ list(APPEND gnu_flags "-Wdouble-promotion")
+ list(APPEND gnu_flags "-Werror")
+ list(APPEND gnu_flags "-Wfloat-equal")
+ list(APPEND gnu_flags "-Wformat-nonliteral")
+ list(APPEND gnu_flags "-Wformat-security")
+ list(APPEND gnu_flags "-Wformat=2")
+ list(APPEND gnu_flags "-Winit-self")
+ list(APPEND gnu_flags "-Wmissing-declarations")
+ list(APPEND gnu_flags "-Wmissing-field-initializers")
+ list(APPEND gnu_flags "-Wpacked")
+ list(APPEND gnu_flags "-Wpointer-arith")
+ list(APPEND gnu_flags "-Wredundant-decls")
+ list(APPEND gnu_flags "-Wswitch-enum")
+ list(APPEND gnu_flags "-Wundef")
+ list(APPEND gnu_flags "-Wuninitialized")
+ list(APPEND gnu_flags "-Wunreachable-code")
+ list(APPEND gnu_flags "-Wunused")
+ list(APPEND gnu_flags "-Wwrite-strings")
+
+ # Non-fatal informational warnings.
+ # We don't turn on the unsafe-loop-optimizations warning after gcc7,
+ # it's too noisy to tolerate. Regardless, don't fail even when it's
+ # configured.
+ list(APPEND gnu_flags "-Wno-error=unsafe-loop-optimizations")
+
+ # Create a function to return the base flags!
+ # We cannot return a value, pass in a parent variable, the function will set it.
+ if(${cmake_compiler_version} VERSION_EQUAL 4.7)
+ list(APPEND gnu_flags "-Wno-c11-extensions")
+ list(APPEND gnu_flags "-Wunsafe-loop-optimizations")
+ elseif(${cmake_compiler_version} VERSION_EQUAL 5)
+ list(APPEND gnu_flags "-Wunsafe-loop-optimizations")
+ elseif(${cmake_compiler_version} VERSION_EQUAL 6)
+ list(APPEND gnu_flags "-Wunsafe-loop-optimizations")
+ endif()
+
+ if(${cmake_compiler_version} VERSION_GREATER_EQUAL 5)
+ list(APPEND gnu_flags "-Wformat-signedness")
+ list(APPEND gnu_flags "-Wunused-macros")
+ list(APPEND gnu_flags "-Wvariadic-macros")
+ endif()
+ if(${cmake_compiler_version} VERSION_GREATER_EQUAL 6)
+ list(APPEND gnu_flags "-Wduplicated-cond")
+ list(APPEND gnu_flags "-Wlogical-op")
+ list(APPEND gnu_flags "-Wunused-const-variable=2")
+ endif()
+ if(${cmake_compiler_version} VERSION_GREATER_EQUAL 7)
+ list(APPEND gnu_flags "-Walloca")
+ list(APPEND gnu_flags "-Walloc-zero")
+ list(APPEND gnu_flags "-Wduplicated-branches")
+ list(APPEND gnu_flags "-Wformat-overflow=2")
+ list(APPEND gnu_flags "-Wformat-truncation=2")
+ list(APPEND gnu_flags "-Wrestrict")
+ endif()
+ if(${cmake_compiler_version} VERSION_GREATER_EQUAL 8)
+ list(APPEND gnu_flags "-Wmultistatement-macros")
+ endif()
+
+ set(${flags} ${gnu_flags} PARENT_SCOPE)
+
+endfunction()
+
+# get_clang_base_flags(flags)
+# Helper function that generates a set of common CLANG flags for a given language.
+# flags - list of flags.
+function(get_clang_base_flags flags)
+ cmake_parse_arguments(
+ PARSE_ARGV
+ 1
+ "CLANG_FLAGS"
+ "CXX;C"
+ ""
+ ""
+ )
+
+ if (NOT "${CLANG_FLAGS_UNPARSED_ARGUMENTS}" STREQUAL "")
+ message(FATAL_ERROR "Unknown arguments to get_clang_base_flags: ${CLANG_FLAGS_UNPARSED_ARGUMENTS}")
+ endif()
+
+ set(cmake_compiler_version)
+
+ if(${CLANG_FLAGS_C} AND ${CLANG_FLAGS_CXX})
+ message(FATAL_ERROR "Only one language is accepted")
+ elseif(CLANG_FLAGS_C)
+ set(cmake_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif(CLANG_FLAGS_CXX)
+ set(cmake_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ else()
+ message(FATAL_ERROR "No language passed")
+ endif()
+
+ set(clang_flags)
+
+ list(APPEND clang_flags "-Werror")
+ list(APPEND clang_flags "-Wno-cast-align")
+ list(APPEND clang_flags "-Wno-documentation-unknown-command")
+ list(APPEND clang_flags "-Wno-format-nonliteral")
+ list(APPEND clang_flags "-Wno-packed")
+ list(APPEND clang_flags "-Wno-padded")
+ list(APPEND clang_flags "-Wno-reserved-id-macro")
+ list(APPEND clang_flags "-Wno-zero-length-array")
+
+ # We should turn on cast-qual, but not as a fatal error: see WT-2690.
+ # For now, turn it off.
+ list(APPEND clang_flags "-Wno-cast-qual")
+
+ # Turn off clang thread-safety-analysis, it doesn't like some of the
+ # code patterns in WiredTiger.
+ list(APPEND clang_flags "-Wno-thread-safety-analysis")
+
+ # On Centos 7.3.1611, system header files aren't compatible with
+ # -Wdisabled-macro-expansion.
+ list(APPEND clang_flags "-Wno-disabled-macro-expansion")
+
+ # We occasionally use an extra semicolon to indicate an empty loop or
+ # conditional body.
+ list(APPEND clang_flags "-Wno-extra-semi-stmt")
+
+ # Ignore unrecognized options.
+ list(APPEND clang_flags "-Wno-unknown-warning-option")
+
+ if(WT_DARWIN AND NOT CMAKE_CROSSCOMPILING)
+ # If we are not cross-compiling, we can safely disable this diagnostic.
+ # Its incompatible with strict diagnostics when including external
+ # libraries that are not in the default linker path
+ # e.g. linking zlib/snappy/... from /usr/local/.
+ list(APPEND clang_flags "-Wno-poison-system-directories")
+ endif()
+
+ if(WT_DARWIN AND (${cmake_compiler_version} VERSION_EQUAL 4.1))
+ # Apple clang has its own numbering system, and older OS X
+ # releases need some special love. Turn off some flags for
+ # Apple's clang 4.1:
+ # Apple clang version 4.1
+ # ((tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
+ list(APPEND clang_flags "-Wno-attributes")
+ list(APPEND clang_flags "-Wno-pedantic")
+ list(APPEND clang_flags "-Wno-unused-command-line-argument")
+ endif()
+
+ if(${cmake_compiler_version} VERSION_GREATER_EQUAL 10)
+ # Clang 10+ has added additional on-by-default diagnostics that isn't
+ # compatible with some of the code patterns in WiredTiger.
+ list(APPEND clang_flags "-Wno-implicit-fallthrough")
+ list(APPEND clang_flags "-Wno-implicit-int-float-conversion")
+ endif()
+
+ set(${flags} ${clang_flags} PARENT_SCOPE)
+
+endfunction()
+
+# get_cl_base_flags(flags)
+# Helper function that generates a set of common CL flags for a given language.
+# flags - list of flags.
+function(get_cl_base_flags flags)
+ cmake_parse_arguments(
+ PARSE_ARGV
+ 1
+ "CL_FLAGS"
+ "CXX;C"
+ ""
+ ""
+ )
+
+ if (NOT "${CL_FLAGS_UNPARSED_ARGUMENTS}" STREQUAL "")
+ message(FATAL_ERROR "Unknown arguments to get_cl_base_flags: ${CL_FLAGS_UNPARSED_ARGUMENTS}")
+ endif()
+
+ set(cmake_compiler_version)
+
+ if(${CL_FLAGS_C} AND ${CL_FLAGS_CXX})
+ message(FATAL_ERROR "Only one language is accepted")
+ elseif(CL_FLAGS_C)
+ set(cmake_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif(CL_FLAGS_CXX)
+ set(cmake_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ else()
+ message(FATAL_ERROR "No language passed")
+ endif()
+
+ set(cl_flags)
+
+ # Warning level 3.
+ list(APPEND cl_flags "/WX")
+ # Ignore warning about mismatched const qualifiers.
+ list(APPEND cl_flags "/wd4090")
+ # Ignore deprecated functions.
+ list(APPEND cl_flags "/wd4996")
+ # Complain about unreferenced format parameter.
+ list(APPEND cl_flags "/we4100")
+ # Enable security check.
+ list(APPEND cl_flags "/GS")
+
+ set(${flags} ${cl_flags} PARENT_SCOPE)
+
+endfunction()
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 7925c787626..11bc6d2d893 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "0a66a61b2ff6a0f1eb6780164e8918934bffe61d"
+ "commit": "fafdde779d6825b00810b164f123f64b5559bf00"
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/Makefile.am b/src/third_party/wiredtiger/test/cppsuite/Makefile.am
index 8221f882014..31c9e0797a9 100644
--- a/src/third_party/wiredtiger/test/cppsuite/Makefile.am
+++ b/src/third_party/wiredtiger/test/cppsuite/Makefile.am
@@ -14,6 +14,7 @@ noinst_PROGRAMS=
test_harness = test_harness/core/component.cxx \
test_harness/core/configuration.cxx \
test_harness/core/throttle.cxx \
+ test_harness/util/api_const.cxx \
test_harness/util/logger.cxx \
test_harness/util/scoped_connection.cxx \
test_harness/util/scoped_types.cxx \
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cxx
index b607f8a821d..05d6976ec4b 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cxx
@@ -30,7 +30,7 @@
#include "test_harness/util/api_const.h"
namespace test_harness {
-component::component(const std::string &name, configuration *config) : _name(name), _config(config)
+component::component(const std::string &name, configuration *config) : _config(config), _name(name)
{
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cxx
index 06d01460ad4..774fcba7e6d 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cxx
@@ -107,7 +107,7 @@ test::run()
statistics_config = _config->get_subconfig(STATISTICS_CONFIG);
statistics_type = statistics_config->get_string(TYPE);
statistics_logging = statistics_config->get_bool(ENABLE_LOGGING);
- db_create_config += statistics_logging ? "," + std::string(STATISTICS_LOG) : "";
+ db_create_config += statistics_logging ? "," + STATISTICS_LOG : "";
db_create_config += ",statistics=(" + statistics_type + ")";
/* Don't forget to delete. */
delete statistics_config;
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cxx
index 3b7d2d312aa..33ad4b80bac 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cxx
@@ -84,7 +84,7 @@ timestamp_manager::do_work()
if ((latest_ts_s - _stable_ts) > _stable_lag) {
log_msg = "Timestamp_manager: Stable timestamp expired.";
_stable_ts = latest_ts_s;
- config += std::string(STABLE_TS) + "=" + decimal_to_hex(_stable_ts);
+ config += STABLE_TS + "=" + decimal_to_hex(_stable_ts);
}
/*
@@ -101,7 +101,7 @@ timestamp_manager::do_work()
new_oldest_ts = _stable_ts - _oldest_lag;
if (!config.empty())
config += ",";
- config += std::string(OLDEST_TS) + "=" + decimal_to_hex(new_oldest_ts);
+ config += OLDEST_TS + "=" + decimal_to_hex(new_oldest_ts);
}
if (!log_msg.empty())
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cxx
new file mode 100644
index 00000000000..469885c280c
--- /dev/null
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cxx
@@ -0,0 +1,82 @@
+/*-
+ * 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 "api_const.h"
+
+/* Define all constants related to WiredTiger APIs and testing. */
+namespace test_harness {
+
+/* Component names. */
+const std::string CHECKPOINT_MANAGER = "checkpoint_manager";
+const std::string RUNTIME_MONITOR = "runtime_monitor";
+const std::string TIMESTAMP_MANAGER = "timestamp_manager";
+const std::string WORKLOAD_GENERATOR = "workload_generator";
+const std::string WORKLOAD_TRACKING = "workload_tracking";
+
+/* Configuration API consts. */
+const std::string CACHE_SIZE_MB = "cache_size_mb";
+const std::string COLLECTION_COUNT = "collection_count";
+const std::string COMPRESSION_ENABLED = "compression_enabled";
+const std::string DURATION_SECONDS = "duration_seconds";
+const std::string ENABLED = "enabled";
+const std::string ENABLE_LOGGING = "enable_logging";
+const std::string INSERT_CONFIG = "insert_config";
+const std::string KEY_COUNT_PER_COLLECTION = "key_count_per_collection";
+const std::string KEY_SIZE = "key_size";
+const std::string LIMIT = "limit";
+const std::string MAX = "max";
+const std::string MIN = "min";
+const std::string OLDEST_LAG = "oldest_lag";
+const std::string OP_RATE = "op_rate";
+const std::string OPS_PER_TRANSACTION = "ops_per_transaction";
+const std::string POPULATE_CONFIG = "populate_config";
+const std::string POSTRUN_STATISTICS = "postrun_statistics";
+const std::string READ_CONFIG = "read_config";
+const std::string STABLE_LAG = "stable_lag";
+const std::string STAT_CACHE_SIZE = "stat_cache_size";
+const std::string STAT_DB_SIZE = "stat_db_size";
+const std::string STATISTICS_CONFIG = "statistics_config";
+const std::string THREAD_COUNT = "thread_count";
+const std::string TYPE = "type";
+const std::string UPDATE_CONFIG = "update_config";
+const std::string VALUE_SIZE = "value_size";
+
+/* WiredTiger API consts. */
+const std::string COMMIT_TS = "commit_timestamp";
+const std::string CONNECTION_CREATE = "create";
+const std::string OLDEST_TS = "oldest_timestamp";
+const std::string STABLE_TS = "stable_timestamp";
+const std::string STATISTICS_LOG = "statistics_log=(json,wait=1)";
+
+/* Test harness consts. */
+const std::string DEFAULT_FRAMEWORK_SCHEMA = "key_format=S,value_format=S,";
+const std::string TABLE_OPERATION_TRACKING = "table:operation_tracking";
+const std::string TABLE_SCHEMA_TRACKING = "table:schema_tracking";
+const std::string STATISTICS_URI = "statistics:";
+
+} // namespace test_harness
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h
index 1eef096aa29..ba7c8166ed7 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h
@@ -29,50 +29,52 @@
#ifndef API_CONST_H
#define API_CONST_H
+#include <string>
+
/* Define all constants related to WiredTiger APIs and testing. */
namespace test_harness {
/* Component names. */
-static const char *CHECKPOINT_MANAGER = "checkpoint_manager";
-static const char *RUNTIME_MONITOR = "runtime_monitor";
-static const char *TIMESTAMP_MANAGER = "timestamp_manager";
-static const char *WORKLOAD_GENERATOR = "workload_generator";
-static const char *WORKLOAD_TRACKING = "workload_tracking";
+extern const std::string CHECKPOINT_MANAGER;
+extern const std::string RUNTIME_MONITOR;
+extern const std::string TIMESTAMP_MANAGER;
+extern const std::string WORKLOAD_GENERATOR;
+extern const std::string WORKLOAD_TRACKING;
/* Configuration API consts. */
-static const char *CACHE_SIZE_MB = "cache_size_mb";
-static const char *COLLECTION_COUNT = "collection_count";
-static const char *COMPRESSION_ENABLED = "compression_enabled";
-static const char *DURATION_SECONDS = "duration_seconds";
-static const char *ENABLED = "enabled";
-static const char *ENABLE_LOGGING = "enable_logging";
-static const char *INSERT_CONFIG = "insert_config";
-static const char *KEY_COUNT_PER_COLLECTION = "key_count_per_collection";
-static const char *KEY_SIZE = "key_size";
-static const char *LIMIT = "limit";
-static const char *MAX = "max";
-static const char *MIN = "min";
-static const char *OLDEST_LAG = "oldest_lag";
-static const char *OP_RATE = "op_rate";
-static const char *OPS_PER_TRANSACTION = "ops_per_transaction";
-static const char *POPULATE_CONFIG = "populate_config";
-static const char *POSTRUN_STATISTICS = "postrun_statistics";
-static const char *READ_CONFIG = "read_config";
-static const char *STABLE_LAG = "stable_lag";
-static const char *STAT_CACHE_SIZE = "stat_cache_size";
-static const char *STAT_DB_SIZE = "stat_db_size";
-static const char *STATISTICS_CONFIG = "statistics_config";
-static const char *THREAD_COUNT = "thread_count";
-static const char *TYPE = "type";
-static const char *UPDATE_CONFIG = "update_config";
-static const char *VALUE_SIZE = "value_size";
+extern const std::string CACHE_SIZE_MB;
+extern const std::string COLLECTION_COUNT;
+extern const std::string COMPRESSION_ENABLED;
+extern const std::string DURATION_SECONDS;
+extern const std::string ENABLED;
+extern const std::string ENABLE_LOGGING;
+extern const std::string INSERT_CONFIG;
+extern const std::string KEY_COUNT_PER_COLLECTION;
+extern const std::string KEY_SIZE;
+extern const std::string LIMIT;
+extern const std::string MAX;
+extern const std::string MIN;
+extern const std::string OLDEST_LAG;
+extern const std::string OP_RATE;
+extern const std::string OPS_PER_TRANSACTION;
+extern const std::string POPULATE_CONFIG;
+extern const std::string POSTRUN_STATISTICS;
+extern const std::string READ_CONFIG;
+extern const std::string STABLE_LAG;
+extern const std::string STAT_CACHE_SIZE;
+extern const std::string STAT_DB_SIZE;
+extern const std::string STATISTICS_CONFIG;
+extern const std::string THREAD_COUNT;
+extern const std::string TYPE;
+extern const std::string UPDATE_CONFIG;
+extern const std::string VALUE_SIZE;
/* WiredTiger API consts. */
-static const char *COMMIT_TS = "commit_timestamp";
-static const char *CONNECTION_CREATE = "create";
-static const char *OLDEST_TS = "oldest_timestamp";
-static const char *STABLE_TS = "stable_timestamp";
-static const char *STATISTICS_LOG = "statistics_log=(json,wait=1)";
+extern const std::string COMMIT_TS;
+extern const std::string CONNECTION_CREATE;
+extern const std::string OLDEST_TS;
+extern const std::string STABLE_TS;
+extern const std::string STATISTICS_LOG;
/*
* Use the Snappy compressor for stress testing to avoid excessive disk space usage. Our CMake
@@ -88,10 +90,10 @@ static const char *STATISTICS_LOG = "statistics_log=(json,wait=1)";
#define SNAPPY_EXT ",extensions=(" SNAPPY_PATH ")"
/* Test harness consts. */
-static const char *DEFAULT_FRAMEWORK_SCHEMA = "key_format=S,value_format=S,";
-static const char *TABLE_OPERATION_TRACKING = "table:operation_tracking";
-static const char *TABLE_SCHEMA_TRACKING = "table:schema_tracking";
-static const char *STATISTICS_URI = "statistics:";
+extern const std::string DEFAULT_FRAMEWORK_SCHEMA;
+extern const std::string TABLE_OPERATION_TRACKING;
+extern const std::string TABLE_SCHEMA_TRACKING;
+extern const std::string STATISTICS_URI;
} // namespace test_harness
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h
index 2c35ef0d162..3b30ede7bd4 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h
@@ -60,6 +60,8 @@ namespace test_harness {
*/
#define LOG_TRACE 3
+void get_time(char *time_buf, size_t buf_size);
+
class logger {
public:
/* Current log level. Default is LOG_WARN. */
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cxx
index 599a8214be2..b0b20ccc0f8 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cxx
@@ -26,6 +26,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <string>
#include <utility>
#include "scoped_types.h"
@@ -33,7 +34,7 @@
namespace test_harness {
/* scoped_cursor implementation */
-scoped_cursor::scoped_cursor(WT_SESSION *session, const char *uri, const char *cfg)
+scoped_cursor::scoped_cursor(WT_SESSION *session, const std::string &uri, const std::string &cfg)
{
reinit(session, uri, cfg);
}
@@ -45,8 +46,10 @@ scoped_cursor::scoped_cursor(scoped_cursor &&other)
scoped_cursor::~scoped_cursor()
{
- if (_cursor != nullptr)
+ if (_cursor != nullptr) {
testutil_check(_cursor->close(_cursor));
+ _cursor = nullptr;
+ }
}
/*
@@ -63,14 +66,16 @@ scoped_cursor::operator=(scoped_cursor &&other)
}
void
-scoped_cursor::reinit(WT_SESSION *session, const char *uri, const char *cfg)
+scoped_cursor::reinit(WT_SESSION *session, const std::string &uri, const std::string &cfg)
{
+ testutil_assert(!uri.empty());
if (_cursor != nullptr) {
testutil_check(_cursor->close(_cursor));
_cursor = nullptr;
}
if (session != nullptr)
- testutil_check(session->open_cursor(session, uri, nullptr, cfg, &_cursor));
+ testutil_check(session->open_cursor(
+ session, uri.c_str(), nullptr, cfg.empty() ? nullptr : cfg.c_str(), &_cursor));
}
/*
@@ -103,8 +108,10 @@ scoped_session::scoped_session(WT_CONNECTION *conn)
scoped_session::~scoped_session()
{
- if (_session != nullptr)
+ if (_session != nullptr) {
testutil_check(_session->close(_session, nullptr));
+ _session = nullptr;
+ }
}
scoped_session::scoped_session(scoped_session &&other)
@@ -155,7 +162,7 @@ scoped_session::get()
}
scoped_cursor
-scoped_session::open_scoped_cursor(const char *uri, const char *cfg)
+scoped_session::open_scoped_cursor(const std::string &uri, const std::string &cfg)
{
return (scoped_cursor(_session, uri, cfg));
}
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 71fc24f6c26..c015c0c909b 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,7 +45,7 @@ namespace test_harness {
class scoped_cursor {
public:
scoped_cursor() = default;
- explicit scoped_cursor(WT_SESSION *session, const char *uri, const char *cfg);
+ explicit scoped_cursor(WT_SESSION *session, const std::string &uri, const std::string &cfg);
/* Moving is ok but copying is not. */
scoped_cursor(scoped_cursor &&other);
@@ -56,7 +56,7 @@ class scoped_cursor {
scoped_cursor(const scoped_cursor &) = delete;
scoped_cursor &operator=(const scoped_cursor &) = delete;
- void reinit(WT_SESSION *session, const char *uri, const char *cfg);
+ void reinit(WT_SESSION *session, const std::string &uri, const std::string &cfg);
WT_CURSOR &operator*();
WT_CURSOR *operator->();
@@ -93,7 +93,7 @@ class scoped_session {
WT_SESSION *get();
- scoped_cursor open_scoped_cursor(const char *uri, const char *cfg = nullptr);
+ scoped_cursor open_scoped_cursor(const std::string &uri, const std::string &cfg = "");
private:
WT_SESSION *_session = nullptr;
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cxx
index 9692ff9183a..3e373f5c1bc 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cxx
@@ -39,7 +39,7 @@
namespace test_harness {
/* collection class implementation */
collection::collection(const uint64_t id, const uint64_t key_count, const std::string &name)
- : id(id), _key_count(key_count), name(name)
+ : name(name), id(id), _key_count(key_count)
{
}
@@ -150,7 +150,7 @@ void
database::set_create_config(bool use_compression)
{
_collection_create_config = use_compression ?
- std::string(DEFAULT_FRAMEWORK_SCHEMA) + std::string(SNAPPY_BLK) :
+ DEFAULT_FRAMEWORK_SCHEMA + std::string(SNAPPY_BLK) :
DEFAULT_FRAMEWORK_SCHEMA;
}
} // namespace test_harness
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cxx
index 90a1e6585e1..1b9b12d689c 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cxx
@@ -48,7 +48,7 @@ populate_worker(thread_context *tc)
* WiredTiger lets you open a cursor on a collection using the same pointer. When a session
* is closed, WiredTiger APIs close the cursors too.
*/
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
uint64_t j = 0;
while (j < tc->key_count) {
tc->transaction.begin();
@@ -142,13 +142,14 @@ database_operation::insert_operation(thread_context *tc)
/* Collection cursor vector. */
std::vector<collection_cursor> ccv;
uint64_t collection_count = tc->db.get_collection_count();
+ testutil_assert(collection_count != 0);
uint64_t collections_per_thread = collection_count / tc->thread_count;
/* Must have unique collections for each thread. */
testutil_assert(collection_count % tc->thread_count == 0);
for (int i = tc->id * collections_per_thread;
i < (tc->id * collections_per_thread) + collections_per_thread && tc->running(); ++i) {
collection &coll = tc->db.get_collection(i);
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
ccv.push_back({coll, std::move(cursor)});
}
@@ -208,7 +209,7 @@ database_operation::read_operation(thread_context *tc)
collection &coll = tc->db.get_random_collection();
if (cursors.find(coll.id) == cursors.end())
- cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name.c_str())));
+ cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name)));
/* Do a second lookup now that we know it exists. */
auto &cursor = cursors[coll.id];
@@ -265,7 +266,7 @@ database_operation::update_operation(thread_context *tc)
"Thread {" + std::to_string(tc->id) +
"} Creating cursor for collection: " + coll.name);
/* Open a cursor for the chosen collection. */
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
cursors.emplace(coll.id, std::move(cursor));
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cxx
index 8c8c4f10f88..e8860acf522 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cxx
@@ -35,6 +35,22 @@
#include "thread_context.h"
namespace test_harness {
+
+const std::string
+type_string(thread_type type)
+{
+ switch (type) {
+ case thread_type::INSERT:
+ return ("insert");
+ case thread_type::READ:
+ return ("read");
+ case thread_type::UPDATE:
+ return ("update");
+ default:
+ testutil_die(EINVAL, "unexpected thread_type: %d", static_cast<int>(type));
+ }
+}
+
/* transaction_context class implementation */
transaction_context::transaction_context(
configuration *config, timestamp_manager *timestamp_manager, WT_SESSION *session)
@@ -125,7 +141,7 @@ transaction_context::set_commit_timestamp(wt_timestamp_t ts)
/* We don't want to set zero timestamps on transactions if we're not using timestamps. */
if (!_timestamp_manager->enabled())
return;
- std::string config = std::string(COMMIT_TS) + "=" + timestamp_manager::decimal_to_hex(ts);
+ const std::string config = COMMIT_TS + "=" + timestamp_manager::decimal_to_hex(ts);
testutil_check(_session->timestamp_transaction(_session, config.c_str()));
}
@@ -151,19 +167,18 @@ transaction_context::can_rollback()
thread_context::thread_context(uint64_t id, thread_type type, configuration *config,
scoped_session &&created_session, timestamp_manager *timestamp_manager,
workload_tracking *tracking, database &dbase)
- : id(id), type(type), db(dbase), tsm(timestamp_manager), tracking(tracking),
- session(std::move(created_session)),
- transaction(transaction_context(config, timestamp_manager, session.get())),
- /* These won't exist for certain threads which is why we use optional here. */
+ : /* These won't exist for certain threads which is why we use optional here. */
collection_count(config->get_optional_int(COLLECTION_COUNT, 1)),
key_count(config->get_optional_int(KEY_COUNT_PER_COLLECTION, 1)),
key_size(config->get_optional_int(KEY_SIZE, 1)),
value_size(config->get_optional_int(VALUE_SIZE, 1)),
- thread_count(config->get_int(THREAD_COUNT))
+ thread_count(config->get_int(THREAD_COUNT)), type(type), id(id), db(dbase),
+ session(std::move(created_session)), tsm(timestamp_manager),
+ transaction(transaction_context(config, timestamp_manager, session.get())),
+ tracking(tracking), _throttle(config)
{
- _throttle = throttle(config);
if (tracking->enabled())
- op_track_cursor = session.open_scoped_cursor(tracking->get_operation_table_name().c_str());
+ op_track_cursor = session.open_scoped_cursor(tracking->get_operation_table_name());
testutil_assert(key_size > 0 && value_size > 0);
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h
index 28c1ee4265b..38ce8a821ab 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h
@@ -46,20 +46,7 @@ class workload_tracking;
namespace test_harness {
enum thread_type { READ, INSERT, UPDATE };
-static std::string
-type_string(thread_type type)
-{
- switch (type) {
- case thread_type::INSERT:
- return ("insert");
- case thread_type::READ:
- return ("read");
- case thread_type::UPDATE:
- return ("update");
- default:
- testutil_die(EINVAL, "unexpected thread_type: %d", static_cast<int>(type));
- }
-}
+const std::string type_string(thread_type type);
class transaction_context {
public:
@@ -95,25 +82,25 @@ class transaction_context {
bool can_rollback();
private:
- /*
- * op_count is the current number of operations that have been executed in the current
- * transaction.
- */
- int64_t _op_count = 0;
+ bool _in_txn = false;
+ bool _needs_rollback = false;
/*
* _min_op_count and _max_op_count are the minimum and maximum number of operations within one
* transaction. is the current maximum number of operations that can be executed in the current
* transaction.
*/
- int64_t _min_op_count = 0;
int64_t _max_op_count = INT64_MAX;
+ int64_t _min_op_count = 0;
+ /*
+ * op_count is the current number of operations that have been executed in the current
+ * transaction.
+ */
+ int64_t _op_count = 0;
int64_t _target_op_count = 0;
- bool _in_txn = false;
- bool _needs_rollback = false;
- WT_SESSION *_session = nullptr;
timestamp_manager *_timestamp_manager = nullptr;
+ WT_SESSION *_session = nullptr;
};
/* Container class for a thread and any data types it may need to interact with the database. */
@@ -157,24 +144,24 @@ class thread_context {
bool running() const;
public:
- scoped_session session;
- scoped_cursor op_track_cursor;
- scoped_cursor stat_cursor;
- transaction_context transaction;
- timestamp_manager *tsm;
- workload_tracking *tracking;
- database &db;
const int64_t collection_count;
const int64_t key_count;
const int64_t key_size;
const int64_t value_size;
const int64_t thread_count;
- const uint64_t id;
const thread_type type;
+ const uint64_t id;
+ database &db;
+ scoped_session session;
+ scoped_cursor op_track_cursor;
+ scoped_cursor stat_cursor;
+ timestamp_manager *tsm;
+ transaction_context transaction;
+ workload_tracking *tracking;
private:
- throttle _throttle;
bool _running = true;
+ throttle _throttle;
};
} // namespace test_harness
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cxx
index e0e7738590d..e8a2ebbcc45 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cxx
@@ -66,7 +66,7 @@ workload_tracking::load()
_session = connection_manager::instance().create_session();
testutil_check(
_session->create(_session.get(), _schema_table_name.c_str(), _schema_table_config.c_str()));
- _schema_track_cursor = _session.open_scoped_cursor(_schema_table_name.c_str());
+ _schema_track_cursor = _session.open_scoped_cursor(_schema_table_name);
logger::log_msg(LOG_TRACE, "Schema tracking initiated");
/* Initiate operations tracking. */
@@ -78,7 +78,7 @@ workload_tracking::load()
* Open sweep cursor. This cursor will be used to clear out obsolete data from the tracking
* table.
*/
- _sweep_cursor = _session.open_scoped_cursor(_operation_table_name.c_str());
+ _sweep_cursor = _session.open_scoped_cursor(_operation_table_name);
logger::log_msg(LOG_TRACE, "Tracking table sweep initialized");
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cxx
index 833ec91d9e8..5f3976c0de1 100644
--- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cxx
@@ -87,7 +87,7 @@ workload_validation::validate(const std::string &operation_table_name,
/* Parse the tracking table. */
validation_collection current_collection_records;
- scoped_cursor cursor = session.open_scoped_cursor(operation_table_name.c_str());
+ scoped_cursor cursor = session.open_scoped_cursor(operation_table_name);
while ((ret = cursor->next(cursor.get())) == 0) {
testutil_check(
cursor->get_key(cursor.get(), &tracked_collection_id, &tracked_key, &tracked_timestamp));
@@ -154,7 +154,7 @@ workload_validation::parse_schema_tracking_table(scoped_session &session,
uint64_t key_collection_id;
int value_operation_type;
- scoped_cursor cursor = session.open_scoped_cursor(tracking_table_name.c_str());
+ scoped_cursor cursor = session.open_scoped_cursor(tracking_table_name);
while (cursor->next(cursor.get()) == 0) {
testutil_check(cursor->get_key(cursor.get(), &key_collection_id, &key_timestamp));
@@ -246,7 +246,7 @@ workload_validation::verify_key_value(scoped_session &session, const uint64_t co
const char *retrieved_value;
scoped_cursor cursor =
- session.open_scoped_cursor(database::build_collection_name(collection_id).c_str());
+ session.open_scoped_cursor(database::build_collection_name(collection_id));
cursor->set_key(cursor.get(), key.c_str());
ret = cursor->search(cursor.get());
if (ret != 0) {
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cxx
index 9d5318e7acb..81e0f717d6d 100644
--- a/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cxx
@@ -58,8 +58,8 @@ class burst_inserts : public test {
struct collection_cursor {
collection_cursor(
collection &coll, scoped_cursor &&write_cursor, scoped_cursor &&read_cursor)
- : coll(coll), write_cursor(std::move(write_cursor)),
- read_cursor(std::move(read_cursor))
+ : coll(coll), read_cursor(std::move(read_cursor)),
+ write_cursor(std::move(write_cursor))
{
}
collection &coll;
@@ -81,15 +81,14 @@ class burst_inserts : public test {
* Create a reading cursor that will read random documents for every next call. This
* will help generate cache pressure.
*/
- ccv.push_back({coll, std::move(tc->session.open_scoped_cursor(coll.name.c_str())),
- std::move(tc->session.open_scoped_cursor(coll.name.c_str(), "next_random=true"))});
+ ccv.push_back({coll, std::move(tc->session.open_scoped_cursor(coll.name)),
+ std::move(tc->session.open_scoped_cursor(coll.name, "next_random=true"))});
}
uint64_t counter = 0;
while (tc->running()) {
uint64_t start_key = ccv[counter].coll.get_key_count();
uint64_t added_count = 0;
- bool committed = true;
auto &cc = ccv[counter];
auto burst_start = std::chrono::system_clock::now();
while (tc->running() &&
@@ -139,9 +138,7 @@ class burst_inserts : public test {
logger::log_msg(LOG_TRACE,
"Committed an insertion of " + std::to_string(added_count) + " keys.");
cc.coll.increase_key_count(added_count);
- start_key = cc.coll.get_key_count();
}
- added_count = 0;
}
testutil_check(cc.write_cursor->reset(cc.write_cursor.get()));
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cxx
index bcacf115665..50ca6f0da82 100644
--- a/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cxx
@@ -46,6 +46,10 @@ extern "C" {
using namespace test_harness;
+/* Declarations to avoid the error raised by -Werror=missing-prototypes. */
+void insert_op(WT_CURSOR *cursor, int key_size, int value_size);
+void read_op(WT_CURSOR *cursor, int key_size);
+
bool do_inserts = false;
bool do_reads = false;
@@ -93,7 +97,7 @@ main(int argc, char *argv[])
logger::log_msg(LOG_ERROR, "This could be an error.");
/* Create a connection, set the cache size and specify the home directory. */
- const std::string conn_config = std::string(CONNECTION_CREATE) + ",cache_size=500MB";
+ const std::string conn_config = CONNECTION_CREATE + ",cache_size=500MB";
const std::string home_dir = std::string(DEFAULT_DIR) + '_' + progname;
/*
* A smart pointer is used here so that the connection can automatically be closed by the
@@ -109,8 +113,8 @@ main(int argc, char *argv[])
/* Create a collection. */
const std::string collection_name = "table:my_collection";
- testutil_check(
- insert_session->create(insert_session, collection_name.c_str(), DEFAULT_FRAMEWORK_SCHEMA));
+ testutil_check(insert_session->create(
+ insert_session, collection_name.c_str(), DEFAULT_FRAMEWORK_SCHEMA.c_str()));
/* Open different cursors. */
WT_CURSOR *insert_cursor, *read_cursor;
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cxx
index fc17f0c5efe..e3ead2e3818 100644
--- a/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cxx
@@ -58,7 +58,7 @@ class hs_cleanup : public test {
/* In this test each thread gets a single collection. */
testutil_assert(tc->db.get_collection_count() == tc->thread_count);
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
/* We don't know the keyrange we're operating over here so we can't be much smarter here. */
while (tc->running()) {
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/run.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/run.cxx
index 627921a9aa4..f86dfb77256 100755
--- a/src/third_party/wiredtiger/test/cppsuite/tests/run.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/run.cxx
@@ -40,7 +40,13 @@
#include "search_near_01.cxx"
#include "search_near_02.cxx"
-std::string
+/* Declarations to avoid the error raised by -Werror=missing-prototypes. */
+const std::string parse_configuration_from_file(const std::string &filename);
+void print_help();
+int64_t run_test(
+ const std::string &test_name, const std::string &config, const std::string &wt_open_config);
+
+const std::string
parse_configuration_from_file(const std::string &filename)
{
std::string cfg, line, error;
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cxx
index 20bcebff4a0..cde891ec5ca 100644
--- a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cxx
@@ -63,7 +63,7 @@ class search_near_01 : public test_harness::test {
*/
for (int64_t i = 0; i < collections_per_thread; ++i) {
collection &coll = tc->db.get_collection(i);
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
for (uint64_t j = 0; j < ALPHABET.size(); ++j) {
for (uint64_t k = 0; k < ALPHABET.size(); ++k) {
for (uint64_t count = 0; count < tc->key_count; ++count) {
@@ -204,7 +204,7 @@ class search_near_01 : public test_harness::test {
/* Get a collection and find a cached cursor. */
collection &coll = tc->db.get_random_collection();
if (cursors.find(coll.id) == cursors.end()) {
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
cursor->reconfigure(cursor.get(), "prefix_search=true");
cursors.emplace(coll.id, std::move(cursor));
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cxx b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cxx
index 58c3047dfa9..729aaef1dba 100644
--- a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cxx
+++ b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cxx
@@ -90,7 +90,7 @@ class search_near_02 : public test_harness::test {
for (uint64_t i = thread_offset;
i < thread_offset + collections_per_thread && tc->running(); ++i) {
collection &coll = tc->db.get_collection(i);
- scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name.c_str());
+ scoped_cursor cursor = tc->session.open_scoped_cursor(coll.name);
ccv.push_back({coll, std::move(cursor)});
}
@@ -163,8 +163,7 @@ class search_near_02 : public test_harness::test {
/* Find a cached cursor or create one if none exists. */
if (cursors.find(coll.id) == cursors.end()) {
- cursors.emplace(
- coll.id, std::move(tc->session.open_scoped_cursor(coll.name.c_str())));
+ cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name)));
auto &cursor_prefix = cursors[coll.id];
/* The cached cursors have the prefix configuration enabled. */
testutil_check(
@@ -211,7 +210,7 @@ class search_near_02 : public test_harness::test {
}
/* Open a cursor with the default configuration on the selected collection. */
- scoped_cursor cursor_default(tc->session.open_scoped_cursor(coll.name.c_str()));
+ scoped_cursor cursor_default(tc->session.open_scoped_cursor(coll.name));
/* Verify the prefix search_near output using the default cursor. */
validate_prefix_search_near(
diff --git a/src/third_party/wiredtiger/test/ctest_helpers.cmake b/src/third_party/wiredtiger/test/ctest_helpers.cmake
index a6afb901f71..3505c0d5e18 100644
--- a/src/third_party/wiredtiger/test/ctest_helpers.cmake
+++ b/src/third_party/wiredtiger/test/ctest_helpers.cmake
@@ -28,7 +28,7 @@
# create_test_executable(target SOURCES <source files> [EXECUTABLE_NAME <name>] [BINARY_DIR <dir>] [INCLUDES <includes>]
# [ADDITIONAL_FILES <files>] [ADDITIONAL_DIRECTORIES <dirs>] [LIBS <libs>] [FLAGS <flags>])
-# Defines a C test executable binary. This helper does the necessary initialisation to ensure the correct flags and libraries
+# Defines a C/CXX test executable binary. This helper does the necessary initialisation to ensure the correct flags and libraries
# are used when compiling the test executable.
# target - Target name of the test.
# SOURCES <source files> - Sources to compile for the given test.
@@ -79,15 +79,16 @@ function(create_test_executable target)
# Append the necessary compiler flags.
if(NOT CREATE_TEST_CXX)
- # Don't append the strict diagnostic flags to C++ targets (as these are chosen for C targets).
- set(test_c_flags "${COMPILER_DIAGNOSTIC_FLAGS}")
+ set(test_flags "${COMPILER_DIAGNOSTIC_C_FLAGS}")
+ else()
+ set(test_flags "${COMPILER_DIAGNOSTIC_CXX_FLAGS}")
endif()
if(NOT "${CREATE_TEST_FLAGS}" STREQUAL "")
- list(APPEND test_c_flags ${CREATE_TEST_FLAGS})
+ list(APPEND test_flags ${CREATE_TEST_FLAGS})
endif()
- target_compile_options(${target} PRIVATE ${test_c_flags})
+ target_compile_options(${target} PRIVATE ${test_flags})
- # Include the base set of directories for a wiredtiger C test.
+ # Include the base set of directories for a wiredtiger C/CXX test.
target_include_directories(${target}
PRIVATE
${CMAKE_SOURCE_DIR}/src/include
@@ -98,7 +99,7 @@ function(create_test_executable target)
target_include_directories(${target} PRIVATE ${CREATE_TEST_INCLUDES})
endif()
- # Link the base set of libraries for a wiredtiger C test.
+ # Link the base set of libraries for a wiredtiger C/CXX test.
target_link_libraries(${target} wiredtiger test_util)
if(NOT "${CREATE_TEST_LIBS}" STREQUAL "")
target_link_libraries(${target} ${CREATE_TEST_LIBS})