From 5df928c8e603f52552a94cad150d0ee727208d8d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Jun 2006 14:03:08 +0300 Subject: [PATCH 1/4] Added purecov comment for new, not executed code for my recent changeset (Found by dgcov) mysql-test/r/show_check.result: Test SHOW PLUGIN. (Was not covered by test suite before) mysql-test/t/show_check.test: Test SHOW PLUGIN. (Was not covered by test suite before) mysys/my_handler.c: Added purecov comment for new, not executed code sql/filesort.cc: Added purecov comment for new, not executed code Removed 'purecov: inspected' from code covered by current testsuite sql/ha_ndbcluster_binlog.cc: Added purecov comment for new, not executed code sql/log_event.cc: Added purecov comment for new, not executed code sql/mysqld.cc: Added purecov comment for new, not executed code sql/sql_parse.cc: Added purecov comment for new, not executed code --- mysql-test/r/show_check.result | 6 ++++++ mysql-test/t/show_check.test | 13 +++++++++++++ mysys/my_handler.c | 3 ++- sql/filesort.cc | 10 +++++++++- sql/ha_ndbcluster_binlog.cc | 2 ++ sql/log_event.cc | 2 ++ sql/mysqld.cc | 2 ++ sql/sql_parse.cc | 4 ++-- 8 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index bb6c2c3beee..7237cf11fc0 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -623,4 +623,10 @@ delete from mysql.db where user='mysqltest_4'; delete from mysql.tables_priv where user='mysqltest_4'; flush privileges; drop database mysqltest; +show full plugin; +show warnings; +Level Code Message +Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead. +show plugin; +show plugins; End of 5.1 tests diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 2f44f4e97c5..94894ef50de 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -445,4 +445,17 @@ delete from mysql.tables_priv where user='mysqltest_4'; flush privileges; drop database mysqltest; +# +# Ensure that show plugin code is tested +# + +--disable_result_log +show full plugin; +--enable_result_log +show warnings; +--disable_result_log +show plugin; +show plugins; +--enable_result_log + --echo End of 5.1 tests diff --git a/mysys/my_handler.c b/mysys/my_handler.c index da619a49ffd..bfec44d57a4 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -548,7 +548,8 @@ HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a) case HA_KEYTYPE_DOUBLE: a= end; break; - case HA_KEYTYPE_END: + case HA_KEYTYPE_END: /* purecov: inspected */ + /* keep compiler happy */ DBUG_ASSERT(0); break; } diff --git a/sql/filesort.cc b/sql/filesort.cc index e712bed9e13..f41d72ac07a 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -688,9 +688,17 @@ static void make_sortkey(register SORTPARAM *param, bzero((char*) to-1,sort_field->length+1); else { + /* purecov: begin deadcode */ + /* + This should only happen during extreme conditions if we run out + of memory or have an item marked not null when it can be null. + This code is here mainly to avoid a hard crash in this case. + */ + DBUG_ASSERT(0); DBUG_PRINT("warning", ("Got null on something that shouldn't be null")); bzero((char*) to,sort_field->length); // Avoid crash + /* purecov: end */ } break; } @@ -699,7 +707,7 @@ static void make_sortkey(register SORTPARAM *param, diff=(int) (sort_field_length - length); if (diff < 0) { - diff=0; /* purecov: inspected */ + diff=0; length= sort_field_length; } if (sort_field->suffix_length) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 3afba85248e..b124f358e55 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -125,6 +125,7 @@ static TABLE_LIST binlog_tables; */ #ifndef DBUG_OFF +/* purecov: begin deadcode */ static void print_records(TABLE *table, const char *record) { for (uint j= 0; j < table->s->fields; j++) @@ -144,6 +145,7 @@ static void print_records(TABLE *table, const char *record) DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf)); } } +/* purecov: end */ #else #define print_records(a,b) #endif diff --git a/sql/log_event.cc b/sql/log_event.cc index 7cffa552954..36805e0043d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5918,6 +5918,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) if (col <= tsh->fields) { + /* purecov: begin inspected */ /* If we get here, the number of columns in the event didn't match the number of columns in the table on the slave, *or* @@ -5950,6 +5951,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) thd->query_error= 1; error= ERR_BAD_TABLE_DEF; goto err; + /* purecov: end */ } /* diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 73ccecf45df..e339065cd55 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3223,9 +3223,11 @@ server."); /* fall back to the log files if tables are not present */ if (have_csv_db == SHOW_OPTION_NO) { + /* purecov: begin inspected */ sql_print_error("CSV engine is not present, falling back to the " "log files"); log_output_options= (log_output_options & ~LOG_TABLE) | LOG_FILE; + /* purecov: end */ } logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ea4eea19e34..5445b37846d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5212,7 +5212,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) even if the query itself redirects the output. */ if (!(result= new select_send())) - return 1; + return 1; /* purecov: inspected */ thd->send_explain_fields(result); res= mysql_explain_union(thd, &thd->lex->unit, result); if (lex->describe & DESCRIBE_EXTENDED) @@ -5231,7 +5231,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) else { if (!result && !(result= new select_send())) - return 1; + return 1; /* purecov: inspected */ query_cache_store_query(thd, all_tables); res= handle_select(thd, lex, result, 0); if (result != lex->result) From e4f4f9dfa5d4c4eaea65820c947008a83cf07802 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Jun 2006 17:23:54 +0300 Subject: [PATCH 2/4] Added -DHAVE_MUTEX_THREAD_ONLY to fix that bdb doesn't crash with "unable to initialize mutex" BitKeeper/etc/ignore: added *.gcno --- .bzrignore | 2 ++ BUILD/compile-pentium-gcov | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index 25056b86642..ee94bf6c9db 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1777,3 +1777,5 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj +*.gcda +*.gcno diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index b024bba49bf..ca37f78e283 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -14,7 +14,7 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage" # The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the # code with profiling information used by gcov. # the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl. -extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM" +extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY" extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" extra_configs="$extra_configs $max_configs" From 0194db09e6871a351c7c06b45944cf5c2dec9d78 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jun 2006 03:24:33 +0300 Subject: [PATCH 3/4] Fixed failing test rpl_ndb_auto_inc.test Mark events_stress.test as 'big' as it's very slow on some machines BitKeeper/etc/ignore: added server-tools/instance-manager/net_serv.cc mysql-test/t/events_stress.test: Slow test: only run when using --big mysql-test/t/rpl_ndb_auto_inc.test: Fix failing test --- .bzrignore | 1 + mysql-test/t/events_stress.test | 3 ++- mysql-test/t/rpl_ndb_auto_inc.test | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.bzrignore b/.bzrignore index c90b5c651ab..d570c36c7f5 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1780,3 +1780,4 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj +server-tools/instance-manager/net_serv.cc diff --git a/mysql-test/t/events_stress.test b/mysql-test/t/events_stress.test index a3a683a0a1a..6546bce3a76 100644 --- a/mysql-test/t/events_stress.test +++ b/mysql-test/t/events_stress.test @@ -1,5 +1,6 @@ # Can't test with embedded server that doesn't support grants --- source include/not_embedded.inc +--source include/not_embedded.inc +--source include/big_test.inc CREATE DATABASE IF NOT EXISTS events_test; # diff --git a/mysql-test/t/rpl_ndb_auto_inc.test b/mysql-test/t/rpl_ndb_auto_inc.test index a9cc9563d88..0fc31de9b3a 100644 --- a/mysql-test/t/rpl_ndb_auto_inc.test +++ b/mysql-test/t/rpl_ndb_auto_inc.test @@ -6,7 +6,8 @@ # Date: 2006-02-10 # Change: Augmented test to use with cluster ##################################### --- source include/master-slave.inc +--source include/master-slave.inc +--source include/have_binlog_format_mixed_or_row.inc --echo ***************** Test 1 ************************ --echo From 372f81af1646abf565148f21cb46f15039683a2d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jun 2006 23:22:55 +0300 Subject: [PATCH 4/4] Replaced assert with argument checking, as rpl_ndb_UUID caused slave to fail on x86 64 bit (It failed even if test was marked as skipped) sql/ha_ndbcluster.cc: Replaced assert with argument checking, as rpl_ndb_UUID failed on x64 --- sql/ha_ndbcluster.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 361ec9b0d2b..701d47eebb8 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4667,7 +4667,15 @@ int ha_ndbcluster::create(const char *name, // reset at return m_table= ndbtab_g.get_table(); // TODO check also that we have the same frm... - DBUG_ASSERT(m_table != 0); + if (!m_table) + { + /* purecov: begin deadcode */ + const NdbError err= dict->getNdbError(); + ERR_PRINT(err); + my_errno= ndb_to_mysql_error(&err); + DBUG_RETURN(my_errno); + /* purecov: end */ + } DBUG_PRINT("info", ("Table %s/%s created successfully", m_dbname, m_tabname));