diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index efa1b3bec21..aba6f78c9de 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -9,6 +9,9 @@ use strict; sub mtr_full_hostname (); sub mtr_init_args ($); sub mtr_add_arg ($$); +sub mtr_path_exists(@); +sub mtr_script_exists(@); +sub mtr_exe_exists(@); ############################################################################## # @@ -47,4 +50,53 @@ sub mtr_add_arg ($$) { push(@$args, sprintf($format, @fargs)); } +############################################################################## + +sub mtr_path_exists (@) { + foreach my $path ( @_ ) + { + return $path if -e $path; + } + if ( @_ == 1 ) + { + mtr_error("Could not find $_[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @_)); + } +} + +sub mtr_script_exists (@) { + foreach my $path ( @_ ) + { + return $path if -x $path; + } + if ( @_ == 1 ) + { + mtr_error("Could not find $_[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @_)); + } +} + +sub mtr_exe_exists (@) { + foreach my $path ( @_ ) + { + $path.= ".exe" if $::opt_win32; + return $path if -x $path; + } + if ( @_ == 1 ) + { + mtr_error("Could not find $_[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @_)); + } +} + + 1; diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index a258d139bb1..0af34d11a3f 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -38,6 +38,13 @@ sub mtr_show_failed_diff ($) { my $result_file= "r/$tname.result"; my $eval_file= "r/$tname.eval"; + if ( $::opt_suite ne "main" ) + { + $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"; + } + if ( -f $eval_file ) { $result_file= $eval_file; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ab5a8900e63..4ba067c3bf5 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -770,146 +770,83 @@ sub executable_setup () { if ( $opt_source_dist ) { + if ( $glob_win32 ) + { + $path_client_bindir= mtr_path_exists("$glob_basedir/client_release"); + $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt"); + $path_language= mtr_path_exists("$glob_basedir/share/english/"); + $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); + } + else + { + $path_client_bindir= mtr_path_exists("$glob_basedir/client"); + $exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld"); + $path_language= mtr_path_exists("$glob_basedir/sql/share/english/"); + $path_charsetsdir= mtr_path_exists("$glob_basedir/sql/share/charsets"); + } + if ( $glob_use_embedded_server ) { - if ( -f "$glob_basedir/libmysqld/examples/mysqltest" ) - { - $exe_mysqltest= "$glob_basedir/libmysqld/examples/mysqltest"; - } - else - { - mtr_error("Can't find embedded server 'mysqltest'"); - } + my $path_examples= "$glob_basedir/libmysqld/examples"; + $exe_mysqltest= mtr_exe_exists("$path_examples/mysqltest"); $exe_mysql_client_test= - "$glob_basedir/libmysqld/examples/mysql_client_test_embedded"; + mtr_exe_exists("$path_examples/mysql_client_test_embedded"); } else { - if ( -f "$glob_basedir/client/.libs/lt-mysqltest" ) - { - $exe_mysqltest= "$glob_basedir/client/.libs/lt-mysqltest"; - } - elsif ( -f "$glob_basedir/client/.libs/mysqltest" ) - { - $exe_mysqltest= "$glob_basedir/client/.libs/mysqltest"; - } - else - { - $exe_mysqltest= "$glob_basedir/client/mysqltest"; - } + $exe_mysqltest= mtr_exe_exists("$glob_basedir/client/mysqltest"); $exe_mysql_client_test= - "$glob_basedir/tests/mysql_client_test"; + mtr_exe_exists("$glob_basedir/tests/mysql_client_test"); } - if ( -f "$glob_basedir/client/.libs/mysqldump" ) - { - $exe_mysqldump= "$glob_basedir/client/.libs/mysqldump"; - } - else - { - $exe_mysqldump= "$glob_basedir/client/mysqldump"; - } - if ( -f "$glob_basedir/client/.libs/mysqlshow" ) - { - $exe_mysqlshow= "$glob_basedir/client/.libs/mysqlshow"; - } - else - { - $exe_mysqlshow= "$glob_basedir/client/mysqlshow"; - } - if ( -f "$glob_basedir/client/.libs/mysqlbinlog" ) - { - $exe_mysqlbinlog= "$glob_basedir/client/.libs/mysqlbinlog"; - } - else - { - $exe_mysqlbinlog= "$glob_basedir/client/mysqlbinlog"; - } - - $path_client_bindir= "$glob_basedir/client"; - $exe_mysqld= "$glob_basedir/sql/mysqld"; - $exe_mysqladmin= "$path_client_bindir/mysqladmin"; - $exe_mysql= "$path_client_bindir/mysql"; - $exe_mysql_fix_system_tables= "$glob_basedir/scripts/mysql_fix_privilege_tables"; - $path_language= "$glob_basedir/sql/share/english/"; - $path_charsetsdir= "$glob_basedir/sql/share/charsets"; - - $path_ndb_tools_dir= "$glob_basedir/ndb/tools"; - $exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm"; + $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); + $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); + $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); + $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); + $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); + $exe_mysql_fix_system_tables= + mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables"); + $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools"); + $exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm"; } else { - my $path_tests_bindir= "$glob_basedir/tests"; + $path_client_bindir= mtr_path_exists("$glob_basedir/bin"); + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); + $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); + $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); + $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); + $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); + $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); + $exe_mysql_fix_system_tables= + mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables"); - $path_client_bindir= "$glob_basedir/bin"; - $exe_mysqltest= "$path_client_bindir/mysqltest"; - $exe_mysqldump= "$path_client_bindir/mysqldump"; - $exe_mysqlshow= "$path_client_bindir/mysqlshow"; - $exe_mysqlbinlog= "$path_client_bindir/mysqlbinlog"; - $exe_mysqladmin= "$path_client_bindir/mysqladmin"; - $exe_mysql= "$path_client_bindir/mysql"; - $exe_mysql_fix_system_tables= "$path_client_bindir/mysql_fix_privilege_tables"; - - if ( -d "$glob_basedir/share/mysql/english" ) - { - $path_language ="$glob_basedir/share/mysql/english/"; - $path_charsetsdir ="$glob_basedir/share/mysql/charsets"; - } - else - { - $path_language ="$glob_basedir/share/english/"; - $path_charsetsdir ="$glob_basedir/share/charsets"; - } - - if ( -x "$glob_basedir/libexec/mysqld" ) - { - $exe_mysqld= "$glob_basedir/libexec/mysqld"; - } - else - { - $exe_mysqld= "$glob_basedir/bin/mysqld"; - } + $path_language= mtr_path_exists("$glob_basedir/share/mysql/english/", + "$glob_basedir/share/english/"); + $path_charsetsdir= mtr_path_exists("$glob_basedir/share/mysql/charsets", + "$glob_basedir/share/charsets"); + $exe_mysqld= mtr_exe_exists ("$glob_basedir/libexec/mysqld", + "$glob_basedir/bin/mysqld"); if ( $glob_use_embedded_server ) { - if ( -f "$path_client_bindir/mysqltest_embedded" ) - { - # FIXME valgrind? - $exe_mysqltest="$path_client_bindir/mysqltest_embedded"; - } - else - { - mtr_error("Cannot find embedded server 'mysqltest_embedded'"); - } - if ( -d "$path_tests_bindir/mysql_client_test_embedded" ) - { - $exe_mysql_client_test= - "$path_tests_bindir/mysql_client_test_embedded"; - } - else - { - $exe_mysql_client_test= - "$path_client_bindir/mysql_client_test_embedded"; - } + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest_embedded"); + $exe_mysql_client_test= + mtr_exe_exists("$glob_basedir/tests/mysql_client_test_embedded", + "$path_client_bindir/mysql_client_test_embedded"); } else { - $exe_mysqltest="$path_client_bindir/mysqltest"; - $exe_mysql_client_test="$path_client_bindir/mysql_client_test"; + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); + $exe_mysql_client_test= + mtr_exe_exists("$path_client_bindir/mysql_client_test"); } $path_ndb_tools_dir= "$glob_basedir/bin"; $exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm"; } - if ( ! $exe_master_mysqld ) - { - $exe_master_mysqld= $exe_mysqld; - } - - if ( ! $exe_slave_mysqld ) - { - $exe_slave_mysqld= $exe_mysqld; - } + $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld; + $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld; $path_ndb_backup_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port"; @@ -928,15 +865,19 @@ sub executable_setup () { sub environment_setup () { # -------------------------------------------------------------------------- - # Set LD_LIBRARY_PATH if we are using shared libraries + # We might not use a standard installation directory, like /usr/lib. + # Set LD_LIBRARY_PATH to make sure we find our installed libraries. # -------------------------------------------------------------------------- - $ENV{'LD_LIBRARY_PATH'}= - "$glob_basedir/lib:$glob_basedir/libmysql/.libs" . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); - $ENV{'DYLD_LIBRARY_PATH'}= - "$glob_basedir/lib:$glob_basedir/libmysql/.libs" . - ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); + unless ( $opt_source_dist ) + { + $ENV{'LD_LIBRARY_PATH'}= + "$glob_basedir/lib" . + ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); + $ENV{'DYLD_LIBRARY_PATH'}= + "$glob_basedir/lib" . + ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); + } # -------------------------------------------------------------------------- # Also command lines in .opt files may contain env vars