Skip to content

Commit

Permalink
[unittest] PS-269: Initial Percona Server 8.0.12 tree
Browse files Browse the repository at this point in the history
-----------------------------------------------------------

PS-7949 Fix memry leak in gcs_xcom_control_interface-t test

https://jira.percona.com/browse/PS-7949

-----------------------------------------------------------

PS-7949 Fix memory leaks in temptable::Allocator tests

https://jira.percona.com/browse/PS-7949

-----------------------------------------------------------

PS-8979: Fix linking issue using `WITH_VALGRIND=ON`

Fix the following issue when `lld` is not detected or `-DUSE_LD_LLD=OFF` is used:
```
/usr/bin/ld: CMakeFiles/merge_large_tests-t.dir/dd_sdi-t.cc.o: warning: relocation against `_ZThn56_N2dd10Index_impl15se_private_dataEv' in read-only section `.text._ZN12sdi_unittestL11mock_dd_objEPN2dd5IndexEPNS0_6ColumnE'
/usr/bin/ld: CMakeFiles/merge_large_tests-t.dir/dd_sdi-t.cc.o: relocation R_X86_64_PC32 against symbol `_ZThn56_N2dd11Column_impl15se_private_dataEv' can not be used when making a PIE object; recompile with -fPIE
```

(cherry picked from commit c75e96a)

-----------------------------------------------------------

PS-9071: Merge MySQL 8.3.0 (fix test_routing_direct tests)

https://perconadev.atlassian.net/browse/PS-9071

Tests lack knowledge of some Percona and debug build specific system
variable names.
Updated known system variables lists for tests to be able to categorize
them properly.

-----------------------------------------------------------

PS-9218: Merge MySQL 8.4.0 (fix gcc-14 build)

https://perconadev.atlassian.net/browse/PS-9218

-----------------------------------------------------------

PS-9328 merge: Merge 8.4.2 - Fixed gcc-12 RelWithDebInfo compilation warnings (percona#5406)

https://perconadev.atlassian.net/browse/PS-9328

Suppressed '-Wrestrict' warnings in selected GIS and Router unit tests.

/usr/include/c++/12/bits/char_traits.h:435:56: error: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
  435 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  • Loading branch information
inikep authored and dlenev committed Oct 17, 2024
1 parent 17d470c commit e8cb6a6
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 16 deletions.
4 changes: 3 additions & 1 deletion router/tests/integration/test_routing_direct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3686,7 +3686,9 @@ TEST_P(ConnectionTest, classic_protocol_session_vars_nullable) {
"character_set_results", //
"innodb_ft_user_stopword_table", //
"innodb_interpreter_output", // debug
"session_track_system_variables"));
"session_track_system_variables",
"debug_set_operations_secondary_overflow_at",
"log_query_errors"));
}
}
}
Expand Down
27 changes: 25 additions & 2 deletions unittest/gunit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ SET(TESTS
charset_bug32788301
collation_loader
cost_estimate
dbug
decimal
dns_srv_data
dphyp
Expand Down Expand Up @@ -313,7 +312,15 @@ IF(LINUX_ALPINE)
ENDIF()

IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
ADD_COMPILE_FLAGS(regexp_engine-t.cc COMPILE_FLAGS "-Wno-restrict")
ADD_COMPILE_FLAGS(
regexp_engine-t.cc
gis_area-t.cc
gis_is_simple-t.cc
gis_isvalid-t.cc
gis_relops-t.cc
gis_setops-t.cc
COMPILE_FLAGS "-Wno-restrict"
)
ENDIF()

IF(WIN32)
Expand All @@ -326,6 +333,22 @@ IF(HAS_WARN_FLAG)
ADD_COMPILE_FLAGS(segfault-t.cc COMPILE_FLAGS ${HAS_WARN_FLAG})
ENDIF()

# Suppress warnings for gcc-10 or newer
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
ADD_CXX_COMPILE_FLAGS_TO_FILES(-Wno-stringop-overflow FILES integer_digits-t.cc)
ENDIF()

# Suppress warnings for gcc-14 or newer
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
ADD_COMPILE_FLAGS(hypergraph_optimizer-t.cc COMPILE_FLAGS "-Wno-array-bounds")
ENDIF()

# Avoid 'requires dynamic R_X86_64_PC32 reloc' linker error for dd_sdi-t.cc
# when built with ASAN
IF(WITH_ASAN OR WITH_VALGRIND)
ADD_CXX_COMPILE_FLAGS_TO_FILES(-fPIC FILES dd_sdi-t.cc)
ENDIF()

# Warnings about missing PGO profile data are not useful for unit tests.
DISABLE_MISSING_PROFILE_WARNING()

Expand Down
2 changes: 1 addition & 1 deletion unittest/gunit/dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Mock_dd_HANDLER : public Base_mock_HANDLER {
Mock_dd_HANDLER(handlerton *hton, TABLE_SHARE *share)
: Base_mock_HANDLER(hton, share) {}

virtual ~Mock_dd_HANDLER() = default;
~Mock_dd_HANDLER() override {}
};

/**
Expand Down
1 change: 1 addition & 0 deletions unittest/gunit/innodb/lob/lot0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ this program; if not, write to the Free Software Foundation, Inc.,

#include "lot0buf.h"
#include "mach0data.h"
#include "my_compiler.h"
#include "ut0byte.h"
#include "ut0ut.h"

Expand Down
5 changes: 0 additions & 5 deletions unittest/gunit/innodb/log0log-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,6 @@ static bool log_test_recovery() {

} else {
srv_shutdown_state = SRV_SHUTDOWN_FLUSH_PHASE;

/* XXX: Shouldn't this be guaranteed within log0recv.cc ? */
while (srv_thread_is_active(srv_threads.m_recv_writer)) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

recv_sys_close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ TEST_F(XComControlTest, JoinTestSkipOwnNodeAndCycleThroughPeerNodes) {
result = xcom_control_if->leave();
ASSERT_EQ(GCS_OK, result);
ASSERT_FALSE(xcom_control_if->is_xcom_running());

free(con);
}

TEST_F(XComControlTest, JoinTestAllPeersUnavailable) {
Expand Down
2 changes: 1 addition & 1 deletion unittest/gunit/log_timestamp-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "test_utils.h"

#include <mysql/components/services/log_shared.h>
#include "../sql/log.h"
#include "sql/log.h"

// CET: 32 bytes
// date (10), 'T', time (8), '.', microseconds (6), timezone offset (6)
Expand Down
1 change: 1 addition & 0 deletions unittest/gunit/m_string-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ TEST(MString, HumanReadableSize) {
data_size *= 1000;
EXPECT_EQ("1025000Y", HumanReadable(data_size));
data_size *= 1000;

EXPECT_EQ("1025000000Y", HumanReadable(data_size));
data_size *=
static_cast<double>(std::numeric_limits<unsigned long long>::max());
Expand Down
6 changes: 5 additions & 1 deletion unittest/gunit/mdl-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3783,7 +3783,11 @@ TEST_F(MDLTest, FindLockOwner) {
Verify that correct error is reported when the MDL system exhausts the LF
Pinbox.
*/
TEST_F(MDLTest, ExhaustPinbox) {
/**
Disabled, because Percona Server allows up to 2^32 pins
and this test would take a lot of time
*/
TEST_F(MDLTest, DISABLED_ExhaustPinbox) {
for (int i = 0; i < 65535; ++i) {
MDL_context c;
EXPECT_FALSE(test_drive_fix_pins(&c));
Expand Down
3 changes: 2 additions & 1 deletion unittest/gunit/mysys_my_b_vprintf-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ void test1(const char *res, const char *fmt, ...) {
IO_CACHE info;
va_list args;
size_t len;
init_io_cache(&info, -1, 0, WRITE_CACHE, 0, true, MYF(0));
int init_res = init_io_cache(&info, -1, 0, WRITE_CACHE, 0, true, MYF(0));
EXPECT_EQ(init_res, 0);
memset(info.write_buffer, 0, 64); /* RECORD_CACHE_SIZE is 64K */
va_start(args, fmt);
len = my_b_vprintf(&info, fmt, args);
Expand Down
2 changes: 1 addition & 1 deletion unittest/gunit/mysys_pathfuncs-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ TEST(Mysys, CreateTempFile) {
File fileno = create_temp_file(dst, "/tmp", prefix, 42, UNLINK_FILE, 0);
EXPECT_GE(fileno, 0);
my_close(fileno, 0);
EXPECT_THAT(dst, MatchesRegex("/tmp/[a]+fd=[0-9]+"));
EXPECT_THAT(dst, MatchesRegex("/tmp/[a]+(fd=[0-9]+|[a-zA-Z0-9]+)"));
aset(dst, 0xaa);

char *env_tmpdir = getenv("TMPDIR");
Expand Down
4 changes: 2 additions & 2 deletions unittest/gunit/temptable_storage-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ TEST(StorageTest, Iterate) {
std::thread t([]() {
temptable::TableResourceMonitor table_resource_monitor(16 * 1024 * 1024);
temptable::Block shared_block;
temptable::Allocator<uint8_t> allocator(&shared_block,
table_resource_monitor);
{
temptable::Allocator<uint8_t> allocator(&shared_block,
table_resource_monitor);
temptable::Storage storage(&allocator);

storage.element_size(sizeof(uint64_t));
Expand Down
4 changes: 4 additions & 0 deletions unittest/gunit/xplugin/xpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ IF(WIN32)
SET_TARGET_PROPERTIES(xplugin_unit_tests PROPERTIES COMPILE_FLAGS "/wd4373")
ENDIF(WIN32)

IF(MY_COMPILER_IS_CLANG)
STRING_APPEND(CMAKE_CXX_FLAGS " -Wno-deprecated")
ENDIF()

TARGET_LINK_LIBRARIES(xplugin_unit_tests
${GCOV_LDFLAGS}
${MYSQLX_CLIENT_LIB}
Expand Down
1 change: 0 additions & 1 deletion unittest/gunit/xplugin/xpl/mysql_function_names.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,3 @@ GET_OTHER_FUNCTION_NAMES(${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy OTHER_MYSQL_FUNCT

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_function_names_t.cc.in
${MYSQLX_GENERATE_DIR}/mysql_function_names_t.cc)

0 comments on commit e8cb6a6

Please sign in to comment.