summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_latin2_ch.inc4
-rw-r--r--mysql-test/include/wait_slave_status.inc158
-rw-r--r--mysql-test/lib/mtr_report.pl10
-rwxr-xr-xmysql-test/mysql-test-run.pl392
-rw-r--r--mysql-test/r/ctype_big5.result3
-rwxr-xr-xmysql-test/r/ctype_eucjpms.result6
-rw-r--r--mysql-test/r/ctype_gbk.result3
-rw-r--r--mysql-test/r/ctype_latin2_ch.result30
-rw-r--r--mysql-test/r/ctype_ujis.result6
-rw-r--r--mysql-test/r/fulltext.result10
-rw-r--r--mysql-test/r/have_latin2_ch.require2
-rw-r--r--mysql-test/r/ndb_insert.result28
-rw-r--r--mysql-test/r/ndb_replace.result12
-rw-r--r--mysql-test/r/subselect.result6
-rw-r--r--mysql-test/t/ctype_big5.test10
-rw-r--r--mysql-test/t/ctype_eucjpms.test17
-rw-r--r--mysql-test/t/ctype_gbk.test10
-rw-r--r--mysql-test/t/ctype_latin2_ch.test30
-rw-r--r--mysql-test/t/ctype_ujis.test15
-rw-r--r--mysql-test/t/fulltext.test2
-rw-r--r--mysql-test/t/ndb_insert.test23
-rw-r--r--mysql-test/t/ndb_replace.test11
-rw-r--r--mysql-test/t/subselect.test11
-rw-r--r--mysql-test/t/type_float.test5
-rw-r--r--mysql-test/t/type_newdecimal.test10
-rw-r--r--mysql-test/t/variables.test2
26 files changed, 701 insertions, 115 deletions
diff --git a/mysql-test/include/have_latin2_ch.inc b/mysql-test/include/have_latin2_ch.inc
new file mode 100644
index 00000000000..9d3ee6b341c
--- /dev/null
+++ b/mysql-test/include/have_latin2_ch.inc
@@ -0,0 +1,4 @@
+-- require r/have_latin2_ch.require
+disable_query_log;
+show collation like "latin2_czech_cs";
+enable_query_log;
diff --git a/mysql-test/include/wait_slave_status.inc b/mysql-test/include/wait_slave_status.inc
new file mode 100644
index 00000000000..7d3636e673c
--- /dev/null
+++ b/mysql-test/include/wait_slave_status.inc
@@ -0,0 +1,158 @@
+# include/wait_slave_status.inc
+#
+# Created by Matthias Leich
+#
+# SUMMARY
+#
+# Waits until slave has reached certain state or maximum time reached.
+#
+# (This script will not work, when the SHOW command delivers more than one
+# result record, because only the first record will be caught.)
+#
+# USAGE
+#
+# Set $result_pattern in test file and source this file:
+#
+# let $result_pattern= <pattern used for LIKE on the result of
+# SHOW STATUS SLAVE>
+# --include wait_slave_status.inc
+#
+# EXAMPLE
+#
+# The script rpl_until.test:
+# ...
+# --replace_result $MASTER_MYPORT MASTER_MYPORT
+# --replace_column 1 # 9 # 23 # 33 #
+# --vertical_results show slave status;
+#
+# outputs
+# show slave status;
+# Slave_IO_State #
+# Master_Host 127.0.0.1
+# Master_User root
+# Master_Port MASTER_MYPORT
+# Connect_Retry 1
+# Master_Log_File master-bin.000001
+# Read_Master_Log_Pos 776
+# Relay_Log_File slave-relay-bin.000004
+# Relay_Log_Pos #
+# Relay_Master_Log_File master-bin.000001
+# Slave_IO_Running Yes
+# Slave_SQL_Running No
+# Replicate_Do_DB
+# Replicate_Ignore_DB
+# Replicate_Do_Table
+# Replicate_Ignore_Table
+# Replicate_Wild_Do_Table
+# Replicate_Wild_Ignore_Table
+# Last_Errno 0
+# Last_Error
+# Skip_Counter 0
+# Exec_Master_Log_Pos 319
+# Relay_Log_Space #
+# Until_Condition Master
+# Until_Log_File master-bin.000001
+# Until_Log_Pos 319
+# Master_SSL_Allowed No
+# Master_SSL_CA_File
+# Master_SSL_CA_Path
+# Master_SSL_Cert
+# Master_SSL_Cipher
+# Master_SSL_Key
+# Seconds_Behind_Master #
+#
+# The main problem with the "show slave status;" in rpl_until is, that
+# depending on the total test engine power and the current load caused by
+# other processes, the expected slave status might be not reached though
+# it will happen in maybe some seconds.
+#
+# The typical problem with rpl_until is that Slave_IO_Running is "No"
+# instead of "Yes".
+#
+# The expected result follows the LIKE pattern:
+#
+# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
+#
+# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
+#
+# How to get this pattern ?
+#
+# Any lines "--replace_result ..." and "--replace_colum ..." just before
+# the SHOW TABLE STATUS and of course the expected result itself
+# show us columns where the content must be unified, because it is non
+# deterministic or it depends on the current test environment.
+#
+# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
+# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
+# Therefore such content must be covered by '%'.
+#
+# Please be careful. A more simple pattern might be dangerous, because we
+# might get "wrong" matches. Example: There might be several "Yes" and "No"
+# within one result row.
+#
+###############################################################################
+
+# We do not want to print the auxiliary commands, because they are not of
+# interest and their amount will vary depending how fast we get the
+# desired state.
+--disable_query_log
+
+# The protocol should show
+# - the setting of $result_pattern and
+# - that this file is sourced ,
+# because this increases the chance to use the protocol as replay script.
+eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
+SELECT '--source include/wait_slave_status.inc' AS "";
+
+# We accept to wait maximum 30 seconds (0.2 sec/loop).
+let $max_wait= 150;
+while ($max_wait)
+{
+ let $my_val= `SHOW SLAVE STATUS`;
+ # Now we have the first record of the SHOW result set as one fat string
+ # within the variable $my_val.
+
+ eval SET @my_val = '$my_val';
+ # DEBUG eval SELECT @my_val AS "response to SHOW SLAVE STATUS";
+
+ eval SELECT @my_val LIKE $result_pattern INTO @success;
+ # @success is '1' if we have a match
+ # '0' if we have no match
+ # DEBUG SELECT @success;
+
+ let $success= `SELECT @success`;
+ let $no_success= `SELECT @success = 0`;
+ if ($success)
+ {
+ # We reached the expected result and want to jump out of the loop
+ # without unneeded sleeps.
+ # Attention: Do not set $max_wait to 0, because "while" with negative value
+ # does not work.
+ let $max_wait= 1;
+ }
+ if ($no_success)
+ {
+ # We did not reach the expected result and will have to sleep again
+ # or jump out of the loop, when max_wait is exhausted.
+ real_sleep 0.2;
+ }
+ dec $max_wait;
+}
+--enable_query_log
+if ($no_success)
+{
+let $message= ! Attention: Timeout in wait_slave_status.inc.
+ | Possible reasons with decreasing probability:
+ | - The LIKE pattern ($result_pattern) is wrong, because the
+ | testcase was altered or the layout of the
+ | SHOW SLAVE STATUS result set changed.
+ | - There is a new bug within the replication.
+ | - We met an extreme testing environment and $max_wait is
+ | too small.;
+--source include/show_msg80.inc
+--echo DEBUG INFO START (wait_slave_status.inc):
+--echo $result_pattern
+--vertical_results
+show slave status;
+--echo DEBUG INFO END
+}
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index 92ce7437365..4587c8bc385 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
+ my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" )
@@ -43,10 +44,11 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
+ $log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
}
if ( -f $eval_file )
- {
+ {
$result_file= $eval_file;
}
elsif ( $::opt_result_ext and
@@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) {
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n";
}
+
+ if ( -f $log_file )
+ {
+ print "Result from queries before failure can be found in $log_file\n";
+ # FIXME Maybe a tail -f -n 10 $log_file here
+ }
}
sub mtr_report_test_name ($) {
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 7309fff04e2..23aeb004c71 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -134,6 +134,7 @@ our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_cygwin_shell= undef;
+our $glob_use_libtool= 1;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
@@ -205,7 +206,6 @@ our $opt_cursor_protocol;
our $opt_view_protocol;
our $opt_current_test;
-our $opt_ddd;
our $opt_debug;
our $opt_do_test;
our @opt_cases; # The test cases names in argv
@@ -219,9 +219,14 @@ our $opt_gcov;
our $opt_gcov_err;
our $opt_gcov_msg;
+our $glob_debugger= 0;
our $opt_gdb;
our $opt_client_gdb;
+our $opt_ddd;
+our $opt_client_ddd;
our $opt_manual_gdb;
+our $opt_manual_ddd;
+our $opt_manual_debug;
our $opt_gprof;
our $opt_gprof_dir;
@@ -278,11 +283,12 @@ our $opt_timer;
our $opt_user;
our $opt_user_test;
-our $opt_valgrind;
-our $opt_valgrind_mysqld;
-our $opt_valgrind_mysqltest;
-our $opt_valgrind_all;
+our $opt_valgrind= 0;
+our $opt_valgrind_mysqld= 0;
+our $opt_valgrind_mysqltest= 0;
+our $opt_valgrind_all= 0;
our $opt_valgrind_options;
+our $opt_valgrind_path;
our $opt_stress= "";
our $opt_stress_suite= "main";
@@ -294,8 +300,6 @@ our $opt_stress_test_duration= 0;
our $opt_stress_init_file= "";
our $opt_stress_test_file= "";
-our $opt_verbose;
-
our $opt_wait_for_master;
our $opt_wait_for_slave;
our $opt_wait_timeout= 10;
@@ -446,6 +450,12 @@ sub initial_setup () {
$glob_cygwin_perl= ($^O eq "cygwin");
$glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
+ # Use libtool on all platforms except windows
+ if ( $glob_win32 )
+ {
+ $glob_use_libtool= 0;
+ }
+
# We require that we are in the "mysql-test" directory
# to run mysql-test-run
@@ -577,9 +587,11 @@ sub command_line_setup () {
# Debugging
'gdb' => \$opt_gdb,
- 'manual-gdb' => \$opt_manual_gdb,
'client-gdb' => \$opt_client_gdb,
+ 'manual-gdb' => \$opt_manual_gdb,
+ 'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd,
+ 'client-ddd' => \$opt_client_ddd,
'strace-client' => \$opt_strace_client,
'master-binary=s' => \$exe_master_mysqld,
'slave-binary=s' => \$exe_slave_mysqld,
@@ -587,10 +599,12 @@ sub command_line_setup () {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
- 'valgrind:s' => \$opt_valgrind,
- 'valgrind-mysqltest:s' => \$opt_valgrind_mysqltest,
- 'valgrind-all:s' => \$opt_valgrind_all,
+ 'valgrind' => \$opt_valgrind,
+ 'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
+ 'valgrind-mysqld' => \$opt_valgrind_mysqld,
+ 'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
+ 'valgrind-path=s' => \$opt_valgrind_path,
# Stress testing
'stress' => \$opt_stress,
@@ -603,6 +617,10 @@ sub command_line_setup () {
'stress-test-count=i' => \$opt_stress_test_count,
'stress-test-duration=i' => \$opt_stress_test_duration,
+ # Directories
+ 'tmpdir=s' => \$opt_tmpdir,
+ 'vardir=s' => \$opt_vardir,
+
# Misc
'big-test' => \$opt_big_test,
'comment=s' => \$opt_comment,
@@ -620,12 +638,9 @@ sub command_line_setup () {
'start-and-exit' => \$opt_start_and_exit,
'start-from=s' => \$opt_start_from,
'timer' => \$opt_timer,
- 'tmpdir=s' => \$opt_tmpdir,
'unified-diff|udiff' => \$opt_udiff,
'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user,
- 'vardir=s' => \$opt_vardir,
- 'verbose' => \$opt_verbose,
'wait-timeout=i' => \$opt_wait_timeout,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
@@ -757,29 +772,17 @@ sub command_line_setup () {
mtr_error("Coverage test needs the source - please use source dist");
}
- if ( $opt_gdb )
+ # Check debug related options
+ if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
+ $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug)
{
+ # Indicate that we are using debugger
+ $glob_debugger= 1;
+ # Increase timeouts
$opt_wait_timeout= 300;
if ( $opt_extern )
{
- mtr_error("Can't use --extern with --gdb");
- }
- }
-
- if ( $opt_manual_gdb )
- {
- $opt_gdb= 1;
- if ( $opt_extern )
- {
- mtr_error("Can't use --extern with --manual-gdb");
- }
- }
-
- if ( $opt_ddd )
- {
- if ( $opt_extern )
- {
- mtr_error("Can't use --extern with --ddd");
+ mtr_error("Can't use --extern when using debugger");
}
}
@@ -798,22 +801,20 @@ sub command_line_setup () {
$opt_with_ndbcluster= 0;
}
- # The ":s" in the argument spec, means we have three different cases
- #
- # undefined option not set
- # "" option set with no argument
- # "somestring" option is name/path of valgrind executable
-
- # Take executable path from any of them, if any
- $opt_valgrind_mysqld= $opt_valgrind;
- $opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
- $opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
-
- # If valgrind flag not defined, define if other valgrind flags are
- unless ( defined $opt_valgrind )
+ # Turn on valgrinding of all executables if "valgrind" or "valgrind-all"
+ if ( $opt_valgrind or $opt_valgrind_all )
{
- $opt_valgrind= ""
- if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;
+ mtr_report("Turning on valgrind for all executables");
+ $opt_valgrind= 1;
+ $opt_valgrind_mysqld= 1;
+ $opt_valgrind_mysqltest= 1;
+ }
+ elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest )
+ {
+ # If test's are run for a specific executable, turn on
+ # verbose and show-reachable
+ $opt_valgrind= 1;
+ $opt_valgrind_all= 1;
}
if ( ! $opt_testcase_timeout )
@@ -828,12 +829,11 @@ sub command_line_setup () {
$opt_suite_timeout*= 4 if defined $opt_valgrind;
}
- if ( defined $opt_valgrind )
+ # Increase times to wait for executables to start if using valgrind
+ if ( $opt_valgrind )
{
$opt_sleep_time_after_restart= 10;
$opt_sleep_time_for_delete= 60;
- # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
- # valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
}
if ( ! $opt_user )
@@ -1023,19 +1023,7 @@ sub executable_setup () {
}
else
{
- if ( $opt_valgrind_mysqltest )
- {
- # client/mysqltest might be a libtool .sh script, so look for real exe
- # to avoid valgrinding bash ;)
- $exe_mysqltest=
- mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
- "$path_client_bindir/.libs/mysqltest",
- "$path_client_bindir/mysqltest");
- }
- else
- {
- $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
- }
+ $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
@@ -1576,8 +1564,9 @@ sub run_suite () {
mtr_print_line();
- if ( ! $opt_gdb and ! $glob_use_running_server and
- ! $opt_ddd and ! $glob_use_embedded_server )
+ if ( ! $glob_debugger and
+ ! $glob_use_running_server and
+ ! $glob_use_embedded_server )
{
stop_masters_slaves();
}
@@ -2118,11 +2107,32 @@ sub save_installed_db () {
}
}
+
+#
+# Save any interesting files in the data_dir
+# before the data dir is removed.
+#
+sub save_files_before_restore($$) {
+ my $test_name= shift;
+ my $data_dir= shift;
+ my $save_name= "$opt_vardir/log/$test_name";
+
+ # Look for core files
+ foreach my $core_file ( glob("$data_dir/core*") )
+ {
+ my $core_name= basename($core_file);
+ mtr_report("Saving $core_name");
+ mkdir($save_name) if ! -d $save_name;
+ rename("$core_file", "$save_name/$core_name");
+ }
+}
+
#
# Restore snapshot of the installed test db(s)
# if the snapshot exists
#
-sub restore_installed_db () {
+sub restore_installed_db ($) {
+ my $test_name= shift;
if ( -d $path_snapshot)
{
@@ -2133,6 +2143,7 @@ sub restore_installed_db () {
foreach my $data_dir (@data_dir_lst)
{
my $name= basename($data_dir);
+ save_files_before_restore($test_name, $data_dir);
rmtree("$data_dir");
copy_dir("$path_snapshot/$name", "$data_dir");
}
@@ -2160,7 +2171,7 @@ sub report_failure_and_restart ($) {
if ( $opt_force )
{
# Restore the snapshot of the installed test db
- restore_installed_db();
+ restore_installed_db($tinfo->{'name'});
print "Resuming Tests\n\n";
return;
}
@@ -2168,8 +2179,9 @@ sub report_failure_and_restart ($) {
my $test_mode= join(" ", @::glob_test_mode) || "default";
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
print "To continue, re-run with '--force'.\n";
- if ( ! $opt_gdb and ! $glob_use_running_server and
- ! $opt_ddd and ! $glob_use_embedded_server )
+ if ( ! $glob_debugger and
+ ! $glob_use_running_server and
+ ! $glob_use_embedded_server )
{
stop_masters_slaves();
}
@@ -2296,7 +2308,7 @@ sub mysqld_arguments ($$$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
- if ( defined $opt_valgrind_mysqld )
+ if ( $opt_valgrind_mysqld )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -2434,7 +2446,8 @@ sub mysqld_arguments ($$$$$$) {
mtr_add_arg($args, "%s--log-warnings", $prefix);
}
- if ( $opt_gdb or $opt_client_gdb or $opt_manual_gdb or $opt_ddd)
+ # Indicate to "mysqld" it will be debugged in debugger
+ if ( $glob_debugger )
{
mtr_add_arg($args, "%s--gdb", $prefix);
}
@@ -2510,7 +2523,7 @@ sub mysqld_start ($$$$$) {
my $args; # Arg vector
my $exe;
- my $pid;
+ my $pid= -1;
if ( $type eq 'master' )
{
@@ -2527,7 +2540,7 @@ sub mysqld_start ($$$$$) {
mtr_init_args(\$args);
- if ( defined $opt_valgrind_mysqld )
+ if ( $opt_valgrind_mysqld )
{
valgrind_arguments($args, \$exe);
}
@@ -2535,29 +2548,53 @@ sub mysqld_start ($$$$$) {
mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info,
$using_ndbcluster);
+ if ( $opt_gdb || $opt_manual_gdb)
+ {
+ gdb_arguments(\$args, \$exe, "$type"."_$idx");
+ }
+ elsif ( $opt_ddd || $opt_manual_ddd )
+ {
+ ddd_arguments(\$args, \$exe, "$type"."_$idx");
+ }
+ elsif ( $opt_manual_debug )
+ {
+ print "\nStart $type in your debugger\n" .
+ "dir: $glob_mysql_test_dir\n" .
+ "exe: $exe\n" .
+ "args: " . join(" ", @$args) . "\n\n" .
+ "Waiting ....\n";
+
+ # Indicate the exe should not be started
+ $exe= undef;
+ }
+
if ( $type eq 'master' )
{
- if ( $pid= mtr_spawn($exe, $args, "",
- $master->[$idx]->{'path_myerr'},
- $master->[$idx]->{'path_myerr'},
- "",
- { append_log_file => 1 }) )
+ if ( ! defined $exe or
+ $pid= mtr_spawn($exe, $args, "",
+ $master->[$idx]->{'path_myerr'},
+ $master->[$idx]->{'path_myerr'},
+ "",
+ { append_log_file => 1 }) )
{
return sleep_until_file_created($master->[$idx]->{'path_mypid'},
- $master->[$idx]->{'start_timeout'}, $pid);
+ $master->[$idx]->{'start_timeout'},
+ $pid);
}
}
if ( $type eq 'slave' )
{
- if ( $pid= mtr_spawn($exe, $args, "",
+ if ( ! defined $exe or
+ $pid= mtr_spawn($exe, $args, "",
$slave->[$idx]->{'path_myerr'},
$slave->[$idx]->{'path_myerr'},
"",
{ append_log_file => 1 }) )
{
return sleep_until_file_created($slave->[$idx]->{'path_mypid'},
- $master->[$idx]->{'start_timeout'}, $pid);
+ $master->[$idx]->{'start_timeout'},
+ $pid);
}
}
@@ -2876,7 +2913,7 @@ sub run_mysqltest ($) {
mtr_init_args(\$args);
- if ( defined $opt_valgrind_mysqltest )
+ if ( $opt_valgrind_mysqltest )
{
valgrind_arguments($args, \$exe);
}
@@ -2996,7 +3033,10 @@ sub run_mysqltest ($) {
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
- mtr_add_arg($args, "-R");
+ mtr_add_arg($args, "--test-file");
+ mtr_add_arg($args, $tinfo->{'path'});
+
+ mtr_add_arg($args, "--result-file");
mtr_add_arg($args, $tinfo->{'result_file'});
if ( $opt_record )
@@ -3004,21 +3044,169 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--record");
}
+ if ( $opt_client_gdb )
+ {
+ gdb_arguments(\$args, \$exe, "client");
+ }
+ elsif ( $opt_client_ddd )
+ {
+ ddd_arguments(\$args, \$exe, "client");
+ }
+
+ if ($glob_use_libtool and $opt_valgrind)
+ {
+ # Add "libtool --mode-execute" before the test to execute
+ # if running in valgrind(to avoid valgrinding bash)
+ unshift(@$args, "--mode=execute", $exe);
+ $exe= "libtool";
+ }
+
if ( $opt_check_testcases )
{
run_check_testcase("before");
}
- my $res = mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
+ my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases )
{
run_check_testcase("after");
}
+
return $res;
+
}
+#
+# Modify the exe and args so that program is run in gdb in xterm
+#
+sub gdb_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $type= shift;
+
+ # Write $args to gdb init file
+ my $str= join(" ", @$$args);
+ my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+
+ # Remove the old gdbinit file
+ unlink($gdb_init_file);
+
+ if ( $type eq "client" )
+ {
+ # write init file for client
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break main\n");
+ }
+ else
+ {
+ # write init file for mysqld
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break mysql_parse\n" .
+ "commands 1\n" .
+ "disable 1\n" .
+ "end\n" .
+ "run");
+ }
+
+ if ( $opt_manual_gdb )
+ {
+ print "\nTo start gdb for $type, type in another window:\n";
+ print "cd $glob_mysql_test_dir;\n";
+ print "gdb -x $gdb_init_file $$exe\n";
+
+ # Indicate the exe should not be started
+ $$exe= undef;
+ return;
+ }
+
+ $$args= [];
+ mtr_add_arg($$args, "-title");
+ mtr_add_arg($$args, "$type");
+ mtr_add_arg($$args, "-e");
+
+ if ( $glob_use_libtool )
+ {
+ mtr_add_arg($$args, "libtool");
+ mtr_add_arg($$args, "--mode=execute");
+ }
+
+ mtr_add_arg($$args, "gdb");
+ mtr_add_arg($$args, "-x");
+ mtr_add_arg($$args, "$gdb_init_file");
+ mtr_add_arg($$args, "$$exe");
+
+ $$exe= "xterm";
+}
+
+#
+# Modify the exe and args so that program is run in ddd
+#
+sub ddd_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $type= shift;
+
+ # Write $args to ddd init file
+ my $str= join(" ", @$$args);
+ my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+
+ # Remove the old gdbinit file
+ unlink($gdb_init_file);
+
+ if ( $type eq "client" )
+ {
+ # write init file for client
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break main\n");
+ }
+ else
+ {
+ # write init file for mysqld
+ mtr_tofile($gdb_init_file,
+ "file $$exe\n" .
+ "set args $str\n" .
+ "break mysql_parse\n" .
+ "commands 1\n" .
+ "disable 1\n" .
+ "end\n" .
+ "run");
+ }
+
+ if ( $opt_manual_ddd )
+ {
+ print "\nTo start ddd for $type, type in another window:\n";
+ print "cd $glob_mysql_test_dir;\n";
+ print "ddd -x $gdb_init_file $$exe\n";
+
+ # Indicate the exe should not be started
+ $$exe= undef;
+ return;
+ }
+
+ my $save_exe= $$exe;
+ $$args= [];
+ if ( $glob_use_libtool )
+ {
+ $$exe= "libtool";
+ mtr_add_arg($$args, "--mode=execute");
+ mtr_add_arg($$args, "ddd");
+ }
+ else
+ {
+ $$exe= "ddd";
+ }
+ mtr_add_arg($$args, "--command=$gdb_init_file");
+ mtr_add_arg($$args, "$save_exe");
+}
+
+#
+# Modify the exe and args so that program is run in valgrind
+#
sub valgrind_arguments {
my $args= shift;
my $exe= shift;
@@ -3030,7 +3218,7 @@ sub valgrind_arguments {
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
- if ( defined $opt_valgrind_all )
+ if ( $opt_valgrind_all )
{
mtr_add_arg($args, "-v");
mtr_add_arg($args, "--show-reachable=yes");
@@ -3038,14 +3226,13 @@ sub valgrind_arguments {
if ( $opt_valgrind_options )
{
- # FIXME split earlier and put into @glob_valgrind_*
mtr_add_arg($args, split(' ', $opt_valgrind_options));
}
mtr_add_arg($args, $$exe);
- $$exe= $opt_valgrind || "valgrind";
+ $$exe= $opt_valgrind_path || "valgrind";
}
@@ -3076,6 +3263,13 @@ Options to control what engine/variation to run
bench Run the benchmark suite FIXME
small-bench FIXME
+Options to control directories to use
+ vardir=DIR The directory where files generated from the test run
+ is stored(default: ./var). Specifying a ramdisk or tmpfs
+ will speed up tests.
+ tmpdir=DIR The directory where temporary files are stored
+ (default: ./var/tmp).
+
Options to control what test suites or cases to run
force Continue to run the suite after failure
@@ -3111,10 +3305,12 @@ Options to run test on running server
Options for debugging the product
- gdb FIXME
- manual-gdb FIXME
- client-gdb FIXME
- ddd FIXME
+ gdb Start the mysqld(s) in gdb
+ manual-gdb Let user manually start mysqld in gdb, before running test(s)
+ manual-debug Let user manually start mysqld in debugger, before running test(s)
+ client-gdb Start mysqltest client in gdb
+ ddd Start mysqld in ddd
+ client-ddd Start mysqltest client in ddd
strace-client FIXME
master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use
@@ -3123,16 +3319,17 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
- valgrind[=EXE] Run the "mysqld" server using valgrind, optionally
- specifying the executable path/name
- valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
- valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
+ valgrind Run the "mysqltest" and "mysqld" executables using valgrind
+ valgrind-all Same as "valgrind" but will also add "verbose" and "--show-reachable"
+ flags to valgrind
+ valgrind-mysqltest Run the "mysqltest" executable with valgrind
+ valgrind-mysqld Run the "mysqld" executable with valgrind
valgrind-options=ARGS Extra options to give valgrind
+ valgrind-path=[EXE] Path to the valgrind executable
Misc options
comment=STR Write STR to the output
- verbose Verbose output from this script
script-debug Debug this script itself
timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers, use the startup
@@ -3160,7 +3357,6 @@ Options not yet described, or that I want to look into more
old-master
sleep=SECONDS
socket=PATH
- tmpdir=DIR
user-test=s
wait-timeout=SECONDS
warnings
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 4c5832a57e9..6574908101c 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -189,3 +189,6 @@ select hex(a) from t1 where a = _big5 0xF9DC;
hex(a)
E5ABBA
drop table t1;
+select hex(convert(_big5 0xC84041 using ucs2));
+hex(convert(_big5 0xC84041 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index cdb28cd0fdd..ad9666d0c86 100755
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
@@ -9819,3 +9819,9 @@ eucjpms_bin 6109
eucjpms_bin 61
eucjpms_bin 6120
drop table t1;
+select hex(convert(_eucjpms 0xA5FE41 using ucs2));
+hex(convert(_eucjpms 0xA5FE41 using ucs2))
+003F0041
+select hex(convert(_eucjpms 0x8FABF841 using ucs2));
+hex(convert(_eucjpms 0x8FABF841 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index aaffe692126..241539ecf42 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -165,3 +165,6 @@ hex(a)
A1A1
A3A0
DROP TABLE t1;
+select hex(convert(_gbk 0xA14041 using ucs2));
+hex(convert(_gbk 0xA14041 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result
new file mode 100644
index 00000000000..2b3765c07c4
--- /dev/null
+++ b/mysql-test/r/ctype_latin2_ch.result
@@ -0,0 +1,30 @@
+drop table if exists t1;
+set names latin2;
+select 'A' = 'a' collate latin2_czech_cs;
+'A' = 'a' collate latin2_czech_cs
+0
+create table t1 (
+id int(5) not null,
+tt char(255) not null
+) character set latin2 collate latin2_czech_cs;
+insert into t1 values (1,'Aa');
+insert into t1 values (2,'Aas');
+alter table t1 add primary key aaa(tt);
+select * from t1 where tt like 'Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 ignore index (primary) where tt like 'Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 where tt like '%Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 where tt like 'AA%';
+id tt
+select * from t1 ignore index (primary) where tt like 'AA%';
+id tt
+select * from t1 where tt like '%AA%';
+id tt
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 2e14fe34430..091d96c56d3 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2307,6 +2307,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+select hex(convert(_ujis 0xA5FE41 using ucs2));
+hex(convert(_ujis 0xA5FE41 using ucs2))
+003F0041
+select hex(convert(_ujis 0x8FABF841 using ucs2));
+hex(convert(_ujis 0x8FABF841 using ucs2))
+003F0041
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index d683fcfa3ff..85894d5cb0e 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -447,12 +447,12 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
-PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
-a MATCH(a) AGAINST('test1 test')
-test1 0.68526661396027
+a FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1 0.685267
EXECUTE stmt;
-a MATCH(a) AGAINST('test1 test')
-test1 0.68526661396027
+a FORMAT(MATCH(a) AGAINST('test1 test'),6)
+test1 0.685267
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
diff --git a/mysql-test/r/have_latin2_ch.require b/mysql-test/r/have_latin2_ch.require
new file mode 100644
index 00000000000..352401bbfe8
--- /dev/null
+++ b/mysql-test/r/have_latin2_ch.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+latin2_czech_cs latin2 2 Yes 4
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index 464eeb6d607..93614419865 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -577,6 +577,25 @@ pk1 b c
2 2 17
4 4 3
6 6 3
+DELETE FROM t1;
+CREATE UNIQUE INDEX bi ON t1(b);
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,b=b+10;
+select * from t1 order by pk1;
+pk1 b c
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 7 7
+8 8 8
+9 9 9
+10 10 10
+11 11 1
+21 21 21
DROP TABLE t1;
CREATE TABLE t1(a INT) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1);
@@ -586,7 +605,7 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
-SELECT * FROM t1;
+SELECT * FROM t1 ORDER BY a;
a
1
1
@@ -606,4 +625,11 @@ a
1
1
1
+DELETE FROM t1;
+CREATE UNIQUE INDEX ai ON t1(a);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1 ORDER BY a;
+a
+1
DROP TABLE t1;
diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
index 63fd8b55c8e..5d772620b2c 100644
--- a/mysql-test/r/ndb_replace.result
+++ b/mysql-test/r/ndb_replace.result
@@ -19,3 +19,15 @@ gesuchnr benutzer_id
2 1
3 2
drop table t1;
+CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
+j INT,
+k INT,
+UNIQUE INDEX(j)
+) ENGINE = ndb;
+INSERT INTO t1 VALUES (1,1,23),(2,2,24);
+REPLACE INTO t1 (j,k) VALUES (1,42);
+REPLACE INTO t1 (i,j) VALUES (17,2);
+SELECT * from t1 ORDER BY i;
+i j k
+3 1 42
+17 2 24
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index d605e81aa93..d8561915564 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -3163,3 +3163,9 @@ t
crash1
crash1
drop table t1;
+create table t1 (c int, key(c));
+insert into t1 values (1142477582), (1142455969);
+create table t2 (a int, b int);
+insert into t2 values (2, 1), (1, 0);
+delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
+drop table t1, t2;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index ffe2a12234e..200002cd235 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -53,4 +53,14 @@ alter table t1 convert to character set utf8;
select hex(a) from t1 where a = _big5 0xF9DC;
drop table t1;
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xC840, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_big5 0xC84041 using ucs2));
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test
index 3609407fe96..8f813fbd82b 100644
--- a/mysql-test/t/ctype_eucjpms.test
+++ b/mysql-test/t/ctype_eucjpms.test
@@ -363,3 +363,20 @@ SET collation_connection='eucjpms_japanese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='eucjpms_bin';
-- source include/ctype_filesort.inc
+
+
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xA5FE, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_eucjpms 0xA5FE41 using ucs2));
+# This one should return 0x003F0041:
+# scan unassigned three-byte character 0x8FABF8,
+# convert it as QUESTION MARK 0x003F and then scan
+# the next character, which is a single byte character 0x41.
+select hex(convert(_eucjpms 0x8FABF841 using ucs2));
+
diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test
index 5eeade96186..7aec48586d8 100644
--- a/mysql-test/t/ctype_gbk.test
+++ b/mysql-test/t/ctype_gbk.test
@@ -31,4 +31,14 @@ INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
SELECT hex(a) FROM t1 ORDER BY a;
DROP TABLE t1;
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xA140, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_gbk 0xA14041 using ucs2));
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test
new file mode 100644
index 00000000000..626d83fa17d
--- /dev/null
+++ b/mysql-test/t/ctype_latin2_ch.test
@@ -0,0 +1,30 @@
+-- source include/have_latin2_ch.inc
+
+#
+# Tests with latin2_czech_cs
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug#17374: select ... like 'A%' operator fails
+# to find value on columuns with key
+#
+set names latin2;
+select 'A' = 'a' collate latin2_czech_cs;
+create table t1 (
+ id int(5) not null,
+ tt char(255) not null
+) character set latin2 collate latin2_czech_cs;
+insert into t1 values (1,'Aa');
+insert into t1 values (2,'Aas');
+alter table t1 add primary key aaa(tt);
+select * from t1 where tt like 'Aa%';
+select * from t1 ignore index (primary) where tt like 'Aa%';
+select * from t1 where tt like '%Aa%';
+select * from t1 where tt like 'AA%';
+select * from t1 ignore index (primary) where tt like 'AA%';
+select * from t1 where tt like '%AA%';
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 77d250b5c45..14b37569b11 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1152,6 +1152,21 @@ SET collation_connection='ujis_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xA5FE, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_ujis 0xA5FE41 using ucs2));
+# This one should return 0x003F0041:
+# scan unassigned three-byte character 0x8FABF8,
+# convert it as QUESTION MARK 0x003F and then scan
+# the next character, which is a single byte character 0x41.
+select hex(convert(_ujis 0x8FABF841 using ucs2));
+
# End of 4.1 tests
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 91033fe2ba9..0f7835e9e7e 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -371,7 +371,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
-PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index 92bc51bcf4f..4fe847058c4 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -591,14 +591,14 @@ DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
select * from t1 where pk1 = b and b != c order by pk1;
-# The following test case currently does not work
-#DELETE FROM t1;
-#CREATE UNIQUE INDEX bi ON t1(b);
-#INSERT INTO t1 VALUES
-#(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
-#(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
-#INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,c=b+10;
-#select * from t1 order by pk1;
+# Test handling of duplicate unique
+DELETE FROM t1;
+CREATE UNIQUE INDEX bi ON t1(b);
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,b=b+10;
+select * from t1 order by pk1;
DROP TABLE t1;
@@ -614,7 +614,12 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
-SELECT * FROM t1;
+SELECT * FROM t1 ORDER BY a;
+DELETE FROM t1;
+CREATE UNIQUE INDEX ai ON t1(a);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test
index b97a0322a6a..6cad80ef8ea 100644
--- a/mysql-test/t/ndb_replace.test
+++ b/mysql-test/t/ndb_replace.test
@@ -27,4 +27,15 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
drop table t1;
+# bug#17431
+CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
+ j INT,
+ k INT,
+ UNIQUE INDEX(j)
+ ) ENGINE = ndb;
+INSERT INTO t1 VALUES (1,1,23),(2,2,24);
+REPLACE INTO t1 (j,k) VALUES (1,42);
+REPLACE INTO t1 (i,j) VALUES (17,2);
+SELECT * from t1 ORDER BY i;
+
# End of 4.1 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 368020dd721..1ef80bdd7ac 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2074,3 +2074,14 @@ create table t1( f1 int,f2 int);
insert into t1 values (1,1),(2,2);
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
drop table t1;
+
+#
+# Bug #18306: server crash on delete using subquery.
+#
+
+create table t1 (c int, key(c));
+insert into t1 values (1142477582), (1142455969);
+create table t2 (a int, b int);
+insert into t2 values (2, 1), (1, 0);
+delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
+drop table t1, t2;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index d223c315735..5bfd744e4a8 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -116,10 +116,15 @@ drop table if exists t1;
# Check conversion of floats to character field (Bug #7774)
create table t1 (c char(20));
insert into t1 values (5e-28);
+# Expected result is "5e-28", but windows returns "5e-028"
+--replace_result 5e-028 5e-28
select * from t1;
drop table t1;
create table t1 (c char(6));
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+# Expected result is "2e+06", but windows returns "2e+006"
+# Expected result is "2e-05", but windows returns "2e-005"
+--replace_result 2e+006 2e+06 2e-005 2e-05
select * from t1;
drop table t1;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index e2fe9767432..74782a5bddb 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1050,6 +1050,10 @@ while ($max_power)
}
SELECT my_float, my_double, my_varchar FROM t1;
+# Expected result 0.000000000011754943372854760000
+# On windows we get 0.000000000011754943372854770000
+# use replace_result to correct it
+--replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000
SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
@@ -1061,7 +1065,13 @@ SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
--disable_warnings
UPDATE t1 SET my_decimal = my_float;
+
+# Expected result 0.000000000011754943372854760000
+# On windows we get 0.000000000011754943372854770000
+# use replace_result to correct it
+--replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000
SELECT my_decimal, my_float FROM t1;
+
UPDATE t1 SET my_decimal = my_double;
SELECT my_decimal, my_double FROM t1;
--enable_warnings
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 8df1d34ea5e..8d8dc7896df 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -20,6 +20,8 @@ select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @select=2,@t5=1.23456;
select @`select`,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
+# Expected result "1e-10", windows returns "1e-010"
+--replace_result 1e-010 1e-10
select @test_int,@test_double,@test_string,@test_string2,@select;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
select @test_int,@test_double,@test_string,@test_string2;