Fixed unsafe define of uint4korr()

Fixed that --extern works with mysql-test-run.pl
Small trivial cleanups
parent 120e3f5e
...@@ -1078,7 +1078,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ...@@ -1078,7 +1078,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
*/ */
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF) #define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#endif #endif
#define uint4korr(A) (*((unsigned long *) (A))) #define uint4korr(A) (*((uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[2])) << 16) +\
......
...@@ -236,8 +236,10 @@ sub mtr_report_stats ($) { ...@@ -236,8 +236,10 @@ sub mtr_report_stats ($) {
"the documentation at\n", "the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n"; "http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
} }
print if (!$::opt_extern)
"The servers were restarted $tot_restarts times\n"; {
print "The servers where restarted $tot_restarts times\n";
}
if ( $::opt_timer ) if ( $::opt_timer )
{ {
......
...@@ -696,7 +696,9 @@ sub command_line_setup () { ...@@ -696,7 +696,9 @@ sub command_line_setup () {
"$glob_basedir/client", "$glob_basedir/client",
"$glob_basedir/bin"); "$glob_basedir/bin");
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), if (!$opt_extern)
{
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
"$glob_basedir/sql/mysqld", "$glob_basedir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt", "$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max", "$path_client_bindir/mysqld-max",
...@@ -708,8 +710,16 @@ sub command_line_setup () { ...@@ -708,8 +710,16 @@ sub command_line_setup () {
"$glob_basedir/bin/mysqld", "$glob_basedir/bin/mysqld",
"$glob_basedir/sbin/mysqld"); "$glob_basedir/sbin/mysqld");
# Use the mysqld found above to find out what features are available # Use the mysqld found above to find out what features are available
collect_mysqld_features(); collect_mysqld_features();
}
else
{
$mysqld_variables{'port'}= 3306;
$mysqld_variables{'master-port'}= 3306;
$opt_skip_ndbcluster= 1;
$opt_skip_im= 1;
}
if ( $opt_comment ) if ( $opt_comment )
{ {
...@@ -746,7 +756,7 @@ sub command_line_setup () { ...@@ -746,7 +756,7 @@ sub command_line_setup () {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# NOTE if the default binlog format is changed, this has to be changed # NOTE if the default binlog format is changed, this has to be changed
$used_binlog_format= "stmt"; $used_binlog_format= "stmt";
if ( $mysql_version_id >= 50100 ) if (!$opt_extern && $mysql_version_id >= 50100 )
{ {
$used_binlog_format= "mixed"; # Default value for binlog format $used_binlog_format= "mixed"; # Default value for binlog format
...@@ -832,19 +842,20 @@ sub command_line_setup () { ...@@ -832,19 +842,20 @@ sub command_line_setup () {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check im suport # Check im suport
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ( $mysql_version_id < 50000 ) if (!$opt_extern)
{ {
# Instance manager is not supported until 5.0 if ( $mysql_version_id < 50000 ) {
$opt_skip_im= 1; # Instance manager is not supported until 5.0
$opt_skip_im= 1;
} }
if ( $glob_win32 ) if ( $glob_win32 ) {
{ mtr_report("Disable Instance manager - not supported on Windows");
mtr_report("Disable Instance manager - not supported on Windows"); $opt_skip_im= 1;
$opt_skip_im= 1; }
}
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Record flag # Record flag
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
...@@ -1208,7 +1219,7 @@ sub command_line_setup () { ...@@ -1208,7 +1219,7 @@ sub command_line_setup () {
$opt_skip_rpl= 1; $opt_skip_rpl= 1;
# Setup master->[0] with the settings for the extern server # Setup master->[0] with the settings for the extern server
$master->[0]->{'path_sock'}= $opt_socket if $opt_socket; $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
mtr_report("Using extern server at '$master->[0]->{path_sock}'"); mtr_report("Using extern server at '$master->[0]->{path_sock}'");
} }
else else
...@@ -1474,57 +1485,53 @@ sub executable_setup () { ...@@ -1474,57 +1485,53 @@ sub executable_setup () {
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
if ( $mysql_version_id >= 50100 )
{
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
{
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
}
else
{
$exe_mysql_upgrade= "";
}
if ( ! $glob_win32 ) if (!$opt_extern)
{ {
# Look for mysql_fix_system_table script if ( $mysql_version_id >= 50100 ) {
$exe_mysql_fix_system_tables= $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", }
"$path_client_bindir/mysql_fix_privilege_tables"); if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) {
} $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
} else {
$exe_mysql_upgrade= "";
}
# Look for mysql_fix_privilege_tables.sql script if ( ! $glob_win32 ) {
$file_mysql_fix_privilege_tables= # Look for mysql_fix_system_table script
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", $exe_mysql_fix_system_tables=
"$glob_basedir/share/mysql_fix_privilege_tables.sql"); mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"$path_client_bindir/mysql_fix_privilege_tables");
}
if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) # Look for mysql_fix_privilege_tables.sql script
{ $file_mysql_fix_privilege_tables=
mtr_warning("Could not find all required ndb binaries, " . mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
"all ndb tests will fail, use --skip-ndbcluster to " . "$glob_basedir/share/mysql_fix_privilege_tables.sql");
"skip testing it.");
foreach my $cluster (@{$clusters}) if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) {
{ mtr_warning("Could not find all required ndb binaries, " .
$cluster->{"executable_setup_failed"}= 1; "all ndb tests will fail, use --skip-ndbcluster to " .
"skip testing it.");
foreach my $cluster (@{$clusters}) {
$cluster->{"executable_setup_failed"}= 1;
}
} }
}
if ( ! $opt_skip_im and executable_setup_im()) if ( ! $opt_skip_im and executable_setup_im()) {
{ mtr_warning("Could not find all required instance manager binaries, " .
mtr_warning("Could not find all required instance manager binaries, " . "all im tests will fail, use --skip-im to " .
"all im tests will fail, use --skip-im to " . "continue without instance manager");
"continue without instance manager"); $instance_manager->{"executable_setup_failed"}= 1;
$instance_manager->{"executable_setup_failed"}= 1; }
}
# Look for the udf_example library # Look for the udf_example library
$lib_udf_example= $lib_udf_example=
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
"$glob_basedir/sql/.libs/udf_example.so",); "$glob_basedir/sql/.libs/udf_example.so",);
}
# Look for mysqltest executable # Look for mysqltest executable
if ( $glob_use_embedded_server ) if ( $glob_use_embedded_server )
{ {
...@@ -1590,7 +1597,7 @@ sub mysql_client_test_arguments() ...@@ -1590,7 +1597,7 @@ sub mysql_client_test_arguments()
mtr_add_arg($args, "--port=$master->[0]->{'port'}"); mtr_add_arg($args, "--port=$master->[0]->{'port'}");
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
if ( $mysql_version_id >= 50000 ) if ( $opt_extern || $mysql_version_id >= 50000 )
{ {
mtr_add_arg($args, "--vardir=$opt_vardir") mtr_add_arg($args, "--vardir=$opt_vardir")
} }
...@@ -1701,7 +1708,7 @@ sub environment_setup () { ...@@ -1701,7 +1708,7 @@ sub environment_setup () {
} }
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths, $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
$ENV{'LD_LIBRARY_PATHS'} ? $ENV{'LD_LIBRARY_PATH'} ?
split(':', $ENV{'LD_LIBRARY_PATH'}) : ()); split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}"); mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
...@@ -1882,7 +1889,7 @@ sub environment_setup () { ...@@ -1882,7 +1889,7 @@ sub environment_setup () {
my $cmdline_mysqlbinlog= my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" . "$exe_mysqlbinlog" .
" --no-defaults --local-load=$opt_tmpdir"; " --no-defaults --local-load=$opt_tmpdir";
if ( $mysql_version_id >= 50000 ) if (!$opt_extern && $mysql_version_id >= 50000 )
{ {
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
} }
...@@ -1913,7 +1920,7 @@ sub environment_setup () { ...@@ -1913,7 +1920,7 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env so childs can execute mysql_upgrade # Setup env so childs can execute mysql_upgrade
# ---------------------------------------------------- # ----------------------------------------------------
if ( $mysql_version_id >= 50000 ) if ( !$opt_extern && $mysql_version_id >= 50000 )
{ {
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments(); $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
} }
...@@ -1921,7 +1928,7 @@ sub environment_setup () { ...@@ -1921,7 +1928,7 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables # Setup env so childs can execute mysql_fix_system_tables
# ---------------------------------------------------- # ----------------------------------------------------
if ( ! $glob_win32 ) if ( !$opt_extern && ! $glob_win32 )
{ {
my $cmdline_mysql_fix_system_tables= my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " . "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
...@@ -1931,7 +1938,10 @@ sub environment_setup () { ...@@ -1931,7 +1938,10 @@ sub environment_setup () {
"--socket=$master->[0]->{'path_sock'}"; "--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
} }
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; if (!$opt_extern)
{
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
}
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env so childs can execute my_print_defaults # Setup env so childs can execute my_print_defaults
...@@ -2235,7 +2245,10 @@ sub check_ssl_support ($) { ...@@ -2235,7 +2245,10 @@ sub check_ssl_support ($) {
if ($opt_skip_ssl || $opt_extern) if ($opt_skip_ssl || $opt_extern)
{ {
mtr_report("Skipping SSL"); if (!$opt_extern)
{
mtr_report("Skipping SSL");
}
$opt_ssl_supported= 0; $opt_ssl_supported= 0;
$opt_ssl= 0; $opt_ssl= 0;
return; return;
...@@ -2310,9 +2323,12 @@ sub vs_config_dirs ($$) { ...@@ -2310,9 +2323,12 @@ sub vs_config_dirs ($$) {
sub check_ndbcluster_support ($) { sub check_ndbcluster_support ($) {
my $mysqld_variables= shift; my $mysqld_variables= shift;
if ($opt_skip_ndbcluster) if ($opt_skip_ndbcluster || $opt_extern)
{ {
mtr_report("Skipping ndbcluster"); if (!$opt_extern)
{
mtr_report("Skipping ndbcluster");
}
$opt_skip_ndbcluster_slave= 1; $opt_skip_ndbcluster_slave= 1;
return; return;
} }
...@@ -2728,7 +2744,10 @@ sub initialize_servers () { ...@@ -2728,7 +2744,10 @@ sub initialize_servers () {
} }
else else
{ {
mtr_report("No need to create '$opt_vardir' it already exists"); if ($opt_verbose)
{
mtr_report("No need to create '$opt_vardir' it already exists");
}
} }
} }
else else
...@@ -3125,17 +3144,17 @@ sub do_before_run_mysqltest($) ...@@ -3125,17 +3144,17 @@ sub do_before_run_mysqltest($)
unlink("$result_dir/$tname.log"); unlink("$result_dir/$tname.log");
unlink("$result_dir/$tname.warnings"); unlink("$result_dir/$tname.warnings");
if ( $mysql_version_id < 50000 ) if (!$opt_extern)
{
# Set environment variable NDB_STATUS_OK to 1
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "1";
}
elsif ( $mysql_version_id < 50100 )
{ {
# Set environment variable NDB_STATUS_OK to YES if ( $mysql_version_id < 50000 ) {
# if script decided to run mysqltest cluster _is_ installed ok # Set environment variable NDB_STATUS_OK to 1
$ENV{'NDB_STATUS_OK'} = "YES"; # if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "1";
} elsif ( $mysql_version_id < 50100 ) {
# Set environment variable NDB_STATUS_OK to YES
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "YES";
}
} }
} }
...@@ -4903,10 +4922,10 @@ sub usage ($) { ...@@ -4903,10 +4922,10 @@ sub usage ($) {
if ( $message ) if ( $message )
{ {
print STDERR "$message \n"; print STDERR "$message\n";
} }
print STDERR <<HERE; print <<HERE;
$0 [ OPTIONS ] [ TESTCASE ] $0 [ OPTIONS ] [ TESTCASE ]
......
...@@ -149,7 +149,7 @@ begin; ...@@ -149,7 +149,7 @@ begin;
# Have to check with pk access here since scans take locks on # Have to check with pk access here since scans take locks on
# all rows and then release them in chunks # all rows and then release them in chunks
select * from t1 where x = 1 for update; select * from t1 where x = 1 for update;
--error 1205 --error 1105,1205
select * from t1 where x = 2 for update; select * from t1 where x = 2 for update;
rollback; rollback;
......
...@@ -2203,11 +2203,11 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length) ...@@ -2203,11 +2203,11 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
{ {
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
ulong stmt_id= uint4korr(packet); ulong stmt_id= uint4korr(packet);
ulong flags= (ulong) ((uchar) packet[4]); ulong flags= (ulong) packet[4];
/* Query text for binary, general or slow log, if any of them is open */ /* Query text for binary, general or slow log, if any of them is open */
String expanded_query; String expanded_query;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
uchar *packet_end= (uchar *) packet + packet_length - 1; uchar *packet_end= packet + packet_length - 1;
#endif #endif
Prepared_statement *stmt; Prepared_statement *stmt;
bool error; bool error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment