Commit bd4c449f authored by unknown's avatar unknown

Fix warnings

Make list of tags/name/values to simplify adding more tags
Check if debug compiled binaries


mysql-test/lib/mtr_cases.pl:
  Fix warnings
  Use local file handle for recursive "include file" loop
  Make list of tags/name/value to search for in .test files
  Add fileter for "require debug compiled binary"
mysql-test/lib/mtr_process.pl:
  Fix warnings
mysql-test/lib/mtr_report.pl:
  Fix warning, only print total time if "--timer"
mysql-test/mysql-test-run.pl:
  Fix warnings
  Add check of debug compiled binaries
parent b6296a9c
......@@ -10,6 +10,8 @@ use strict;
sub collect_test_cases ($);
sub collect_one_test_case ($$$$$$$);
sub mtr_options_from_test_file($$);
##############################################################################
#
# Collect information about test cases we are to run
......@@ -482,6 +484,12 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Not running with binlog format '$tinfo->{'binlog_format'}'";
}
if ( $tinfo->{'need_debug'} && $::debug_compiled_binaries )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need debug binaries";
}
}
# We can't restart a running server that may be in use
......@@ -496,66 +504,53 @@ sub collect_one_test_case($$$$$$$) {
}
sub mtr_options_from_test_file($$$) {
use IO::File;
# List of tags in the .test files that if found should set
# the specified value in "tinfo"
our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
["include/have_binlog_format_row.inc", "binlog_format", "row"],
["include/have_binlog_format_statement.inc", "binlog_format", "stmt"],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1],
["require_manager", "require_manager", 1],
);
sub mtr_options_from_test_file($$) {
my $tinfo= shift;
my $file= shift;
#mtr_verbose("$file");
my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!");
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my @args;
while ( <FILE> )
while ( <$F> )
{
chomp;
# Check if test uses innodb
if ( defined mtr_match_substring($_,"include/have_innodb.inc"))
# Match this line against tag in "tags" array
foreach my $tag (@tags)
{
$tinfo->{'innodb_test'} = 1;
}
# Check if test need rowbased logging
if ( defined mtr_match_substring($_,"include/have_binlog_format_row.inc"))
if ( $_ =~ /(.*)\Q$tag->[0]\E(.*)$/ )
{
$tinfo->{'binlog_format'} = "row";
# Tag matched, assign value to "tinfo"
$tinfo->{"$tag->[1]"}= $tag->[2];
}
# Check if test need rowbased logging
if ( defined mtr_match_substring($_,"include/have_binlog_format_statement.inc"))
{
$tinfo->{'binlog_format'} = "stmt";
}
# Check if test need "big test"
if ( defined mtr_match_substring($_,"include/big_test.inc"))
{
$tinfo->{'big_test'} = 1;
}
# Check if test need "ndb_extra"
if ( defined mtr_match_substring($_,"include/have_ndb_extra.inc"))
{
$tinfo->{'ndb_extra'} = 1;
}
# Check if test need "manager", the old one
if ( defined mtr_match_substring($_,"require_manager;"))
{
$tinfo->{'require_manager'} = 1;
}
# If test sources another file, open it as well
my $value= mtr_match_prefix($_, "--source");
if ( defined $value)
if ( /^--([[:space:]]*)source/ )
{
$value=~ s/^\s+//; # Remove leading space
$value=~ s/\s+$//; # Remove ending space
my $value= $';
$value =~ s/^\s+//; # Remove leading space
$value =~ s/\s+$//; # Remove ending space
my $sourced_file= "$::glob_mysql_test_dir/$value";
mtr_options_from_test_file($tinfo, $sourced_file);
}
}
close FILE;
}
1;
......@@ -496,7 +496,7 @@ sub mtr_kill_leftovers () {
foreach my $srv ( @kill_pids )
{
if ( mtr_ping_port($srv->{'port'}) )
if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
{
mtr_warning("can't kill old process holding port $srv->{'port'}");
}
......@@ -633,7 +633,7 @@ sub mtr_check_stop_servers ($) {
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{
# Know it is dead so should be no race, careful anyway
if ( -f $file and ! unlink($file) and -f $file )
if ( defined $file and -f $file and ! unlink($file) and -f $file )
{
$errors++;
mtr_warning("couldn't delete $file");
......@@ -753,7 +753,8 @@ sub mtr_ping_with_timeout($) {
foreach my $srv ( @$spec )
{
$res= 1; # We are optimistic
if ( $srv->{'pid'} and mtr_ping_port($srv->{'port'}) )
if ( $srv->{'pid'} and
defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
{
mtr_verbose("waiting for process $srv->{'pid'} to stop ".
"using port $srv->{'port'}");
......
......@@ -204,8 +204,13 @@ sub mtr_report_stats ($) {
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
}
print
"The servers were restarted $tot_restarts times\n",
"Spent $::glob_tot_real_time seconds actually executing testcases\n";
"The servers were restarted $tot_restarts times\n";
if ( $::opt_timer )
{
print
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
}
# ----------------------------------------------------------------------
# If a debug run, there might be interesting information inside
......
......@@ -330,6 +330,8 @@ our $file_ndb_testrun_log;
our @data_dir_lst;
our $used_binlog_format;
our $debug_compiled_binaries;
our $glob_tot_real_time= 0;
######################################################################
#
......@@ -389,6 +391,7 @@ sub main () {
check_ndbcluster_support(); # We check whether to actually use it later
check_ssl_support();
check_debug_support();
environment_setup();
signal_setup();
......@@ -1028,6 +1031,7 @@ sub command_line_setup () {
connect_string => "$opt_ndbconnectstring",
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd
installed_ok => 'NO',
};
$data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
......@@ -1040,6 +1044,7 @@ sub command_line_setup () {
connect_string => "$opt_ndbconnectstring_slave",
path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd
installed_ok => 'NO',
};
# Init pids of ndbd's
......@@ -1543,6 +1548,24 @@ sub check_ssl_support () {
}
sub check_debug_support () {
# check debug support by testing using a switch
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--debug",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{
# mtr_report("Binaries are not debug compiled");
$debug_compiled_binaries= 0;
return;
}
mtr_report("Binaries are debug compiled");
$debug_compiled_binaries= 1;
}
##############################################################################
#
# Start the ndb cluster
......
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