Commit 30b8a9c1 authored by kent@mysql.com's avatar kent@mysql.com

spatial.cc:

  Added { ... } around float8get() macro, avoids VC7 error
  message "illegal else without matching if"
mtr_report.pl:
  Parse error logs to create "warnings" file
mtr_cases.pl:
  Added optoion --ignore-disabled-def
  Windows build now let TZ pass, removed
  work around
mysql-test-run.pl, mtr_process.pl:
  Back port of changes from 5.0
parent 1fe9126d
......@@ -56,7 +56,7 @@ sub collect_test_cases ($) {
# Disable some tests listed in disabled.def
# ----------------------------------------------------------------------
my %disabled;
if ( open(DISABLED, "$testdir/disabled.def" ) )
if ( ! $::opt_ignore_disabled_def and open(DISABLED, "$testdir/disabled.def" ) )
{
while ( <DISABLED> )
{
......@@ -189,8 +189,8 @@ sub collect_one_test_case($$$$$$) {
my $slave_sh= "$testdir/$tname-slave.sh";
my $disabled_file= "$testdir/$tname.disabled";
$tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
$tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
$tinfo->{'master_opt'}= [];
$tinfo->{'slave_opt'}= [];
$tinfo->{'slave_mi'}= [];
if ( -f $master_opt_file )
......@@ -213,7 +213,6 @@ sub collect_one_test_case($$$$$$) {
if ( defined $value )
{
$tinfo->{'timezone'}= $value;
$tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ
last MASTER_OPT;
}
......
......@@ -824,7 +824,7 @@ sub sleep_until_file_created ($$$) {
}
# Check if it died after the fork() was successful
if ( waitpid($pid,&WNOHANG) == $pid )
if ( $pid > 0 && waitpid($pid,&WNOHANG) == $pid )
{
return 0;
}
......@@ -848,14 +848,16 @@ sub sleep_until_file_created ($$$) {
sub mtr_kill_processes ($) {
my $pids = shift;
foreach my $sig (15,9)
foreach my $sig (15, 9)
{
my $retries= 20; # FIXME 20 seconds, this is silly!
kill($sig, @{$pids});
while ( $retries-- and kill(0, @{$pids}) )
my $retries= 10;
while (1)
{
mtr_debug("Sleep 1 second waiting for processes to die");
sleep(1) # Wait one second
kill($sig, @{$pids});
last unless kill (0, @{$pids}) and $retries--;
mtr_debug("Sleep 2 second waiting for processes to die");
sleep(2);
}
}
}
......@@ -877,7 +879,14 @@ sub mtr_exit ($) {
# cluck("Called mtr_exit()");
mtr_timer_stop_all($::glob_timers);
local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$);
# ToDo: Signalling -$$ will only work if we are the process group
# leader (in fact on QNX it will signal our session group leader,
# which might be Do-compile or Pushbuild, causing tests to be
# aborted). So we only do it if we are the group leader. We might
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if $$ == getpgrp();
sleep 2;
exit($code);
}
......
......@@ -185,39 +185,57 @@ sub mtr_report_stats ($) {
}
# ----------------------------------------------------------------------
# If a debug run, there might be interesting information inside
# the "var/log/*.err" files. We save this info in "var/log/warnings"
# ----------------------------------------------------------------------
if ( ! $::glob_use_running_server )
{
# Save and report if there was any fatal warnings/errors in err logs
# Report if there was any fatal warnings/errors in the log files
#
unlink("$::opt_vardir/log/warnings");
unlink("$::opt_vardir/log/warnings.tmp");
# Remove some non fatal warnings from the log files
my $warnlog= "$::opt_vardir/log/warnings";
# FIXME what is going on ????? ;-)
# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
# var/log/*.err \
# | sed -e 's!Warning: Table:.* on rename!!g' \
# > var/log/warnings.tmp;
#
# found_error=0;
# # Find errors
# for i in "^Warning:" "^Error:" "^==.* at 0x"
# do
# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings )
# {
# found_error=1
# }
# done
# unlink("$::opt_vardir/log/warnings.tmp");
# if ( $found_error= "1" )
# {
# print "WARNING: Got errors/warnings while running tests. Please examine\n"
# print "$::opt_vardir/log/warnings for details.\n"
# }
# }
unless ( open(WARN, ">$warnlog") )
{
mtr_warning("can't write to the file \"$warnlog\": $!");
}
else
{
my $found_problems= 0; # Some warnings are errors...
# We report different types of problems in order
foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x" )
{
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
{
unless ( open(ERR, $errlog) )
{
mtr_warning("can't read $errlog");
next;
}
while ( <ERR> )
{
# Skip some non fatal warnings from the log files
if ( /Warning:\s+Table:.* on (delete|rename)/ or
/Warning:\s+Setting lower_case_table_names=2/ or
/Warning:\s+One can only use the --user.*root/ )
{
next; # Skip these lines
}
if ( /$pattern/ )
{
$found_problems= 1;
print WARN $_;
}
}
}
if ( $found_problems )
{
mtr_warning("Got errors/warnings while running tests, please examine",
"\"$warnlog\" for details.");
}
}
}
}
print "\n";
......
......@@ -76,6 +76,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
#require 5.6.1;
use File::Path;
use File::Basename;
use File::Copy;
use Cwd;
use Getopt::Long;
use Sys::Hostname;
......@@ -152,6 +153,7 @@ our $path_language;
our $path_timefile;
our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_tmpdir; # A path but set directly on cmd line
......@@ -238,7 +240,7 @@ our $opt_sleep_time_after_restart= 1;
our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout;
our $opt_suite_timeout;
my $default_testcase_timeout= 10; # 10 min max
my $default_testcase_timeout= 15; # 15 min max
my $default_suite_timeout= 120; # 2 hours max
our $opt_socket;
......@@ -257,6 +259,7 @@ 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_options;
......@@ -475,7 +478,8 @@ sub command_line_setup () {
#
if ( $ENV{'MTR_BUILD_THREAD'} )
{
$opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000;
# Up to two masters, up to three slaves
$opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
$opt_slave_myport= $opt_master_myport + 2; # and 3 4
$opt_ndbcluster_port= $opt_master_myport + 5;
}
......@@ -609,6 +613,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# FIXME maybe not needed?
$path_manager_log= "$opt_vardir/log/manager.log"
unless $path_manager_log;
......@@ -725,6 +730,7 @@ sub command_line_setup () {
# "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;
......@@ -834,6 +840,7 @@ sub command_line_setup () {
}
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
}
......@@ -851,7 +858,8 @@ sub executable_setup () {
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/bin");
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",);
$path_language= mtr_path_exists("$glob_basedir/share/english/");
......@@ -874,8 +882,20 @@ sub executable_setup () {
"/usr/bin/false");
}
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_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"/usr/bin/false");
......@@ -985,6 +1005,7 @@ sub environment_setup () {
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
......@@ -996,6 +1017,8 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
......@@ -1015,7 +1038,7 @@ sub environment_setup () {
print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
print "Using NDBCLUSTER_PORT = $opt_ndbcluster_port\n";
print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
}
......@@ -1077,10 +1100,40 @@ sub kill_and_cleanup () {
mtr_report("Removing Stale Files");
if ( $opt_vardir eq "$glob_mysql_test_dir/var" )
{
#
# Running with "var" in mysql-test dir
#
if ( -l "$glob_mysql_test_dir/var" )
{
# Some users creates a soft link in mysql-test/var to another area
# - allow it
mtr_report("WARNING: Using the 'mysql-test/var' symlink");
rmtree("$opt_vardir/log");
rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
rmtree("$opt_vardir/run");
rmtree("$opt_vardir/tmp");
}
else
{
# Remove the entire "var" dir
rmtree("$opt_vardir/");
}
}
else
{
#
# Running with "var" in some other place
#
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
rmtree("$glob_mysql_test_dir/var");
# Remove the "var" dir
rmtree("$opt_vardir/");
}
mkpath("$opt_vardir/log");
mkpath("$opt_vardir/run");
......@@ -1104,14 +1157,22 @@ sub kill_and_cleanup () {
mkpath("$data_dir/test");
}
# To make some old test cases work, we create a soft
# link from the old "var" location to the new one
if ( ! $glob_win32 and $opt_vardir ne "$glob_mysql_test_dir/var" )
# Make a link std_data_ln in var/ that points to std_data
if ( ! $glob_win32 )
{
# FIXME why bother with the above, why not always remove all of var?!
rmtree("$glob_mysql_test_dir/var"); # Clean old var, FIXME or rename it?!
symlink($opt_vardir, "$glob_mysql_test_dir/var");
symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
}
else
{
# on windows, copy all files from std_data into var/std_data_ln
mkpath("$opt_vardir/std_data_ln");
opendir(DIR, "$glob_mysql_test_dir/std_data")
or mtr_error("Can't find the std_data directory: $!");
for my $elem ( readdir(DIR) ) {
next if -d "$glob_mysql_test_dir/std_data/$elem";
copy("$glob_mysql_test_dir/std_data/$elem", "$opt_vardir/std_data_ln/$elem");
}
closedir(DIR);
}
}
......@@ -1543,6 +1604,7 @@ sub run_testcase ($) {
}
if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} )
{
# Test needs cluster, start an extra mysqld connected to cluster
$master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[]);
if ( ! $master->[1]->{'pid'} )
......@@ -1787,7 +1849,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 )
if ( defined $opt_valgrind_mysqld )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
......@@ -1854,6 +1916,10 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--skip-innodb", $prefix);
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix);
# Directory where slaves find the dumps generated by "load data"
# on the server. The path need to have constant length otherwise
# test results will vary, thus a relative path is used.
mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
$path_slave_load_tmpdir);
mtr_add_arg($args, "%s--socket=%s", $prefix,
......@@ -2012,7 +2078,7 @@ sub mysqld_start ($$$$) {
mtr_init_args(\$args);
if ( defined $opt_valgrind )
if ( defined $opt_valgrind_mysqld )
{
valgrind_arguments($args, \$exe);
}
......
......@@ -176,7 +176,9 @@ static double wkb_get_double(const char *ptr, Geometry::wkbByteOrder bo)
{
double res;
if (bo != Geometry::wkb_xdr)
{
float8get(res, ptr);
}
else
{
char inv_array[8];
......
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