From 9a67ecc3e4c080aeb53eb947a70531e035805d25 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 01:25:06 +0200 Subject: [PATCH 1/8] Fix Windows build warning and file missing from projects. VC++Files/libmysql/libmysql.dsp: Add missing file VC++Files/client/mysqlclient.dsp: Add missing file vio/viosocket.c: Add missing parameter --- VC++Files/client/mysqlclient.dsp | 4 ++++ VC++Files/libmysql/libmysql.dsp | 4 ++++ vio/viosocket.c | 1 + 3 files changed, 9 insertions(+) diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 599bad92d7f..9a6fd933041 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -322,6 +322,10 @@ SOURCE=..\mysys\mulalloc.c # End Source File # Begin Source File +SOURCE=..\mysys\my_access.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_alloc.c # End Source File # Begin Source File diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index 21e393f137d..9bc7dfb8a1d 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -295,6 +295,10 @@ SOURCE=..\mysys\mulalloc.c # End Source File # Begin Source File +SOURCE=..\mysys\my_access.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_alloc.c # End Source File # Begin Source File diff --git a/vio/viosocket.c b/vio/viosocket.c index 172d9127dc2..904b75583a9 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -379,6 +379,7 @@ int vio_close_pipe(Vio * vio) void vio_ignore_timeout(Vio *vio __attribute__((unused)), + uint which __attribute__((unused)), uint timeout __attribute__((unused))) { } From 0812385dcc5557e25e09371dedf52bccd0102d4a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Jun 2005 09:45:41 -0700 Subject: [PATCH 2/8] group_by.result, group_by.test: Added a test case for bug #8614. sql_select.cc: Fixed bug #8614. SELECT DISTINCT ... GROUP BY 'const' must be equivalent to SELECT ... GROUP BY 'const'. sql/sql_select.cc: Fixed bug #8614. SELECT DISTINCT ... GROUP BY 'const' must be equivalent to SELECT ... GROUP BY 'const'. mysql-test/t/group_by.test: Added a test case for bug #8614. mysql-test/r/group_by.result: Added a test case for bug #8614. --- mysql-test/r/group_by.result | 10 ++++++++++ mysql-test/t/group_by.test | 15 ++++++++++++++- sql/sql_select.cc | 11 ++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 3e082fa04e3..ee4b6a31f2f 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -722,3 +722,13 @@ WHERE hostname LIKE '%aol%' GROUP BY hostname; hostname no cache-dtc-af05.proxy.aol.com 1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (1,3); +SELECT a, b FROM t1 GROUP BY 'const'; +a b +1 2 +SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; +a b +1 2 +DROP TABLE t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 21d5abcc287..f9d113a9c50 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,3 +1,4 @@ + # Initialise --disable_warnings drop table if exists t1,t2,t3; @@ -524,7 +525,7 @@ select min(b) from t1; drop table t1; # -# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1) +# Test for bug #11088: GROUP BY a BLOB column with COUNT(DISTINCT column1) # CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext); @@ -539,3 +540,15 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 WHERE hostname LIKE '%aol%' GROUP BY hostname; +DROP TABLE t1; + +# +# Test for bug #8614: GROUP BY 'const with DISTINCT +# + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (1,3); +SELECT a, b FROM t1 GROUP BY 'const'; +SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; + +DROP TABLE t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 352227acc68..5b5dde54bc9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -676,9 +676,14 @@ JOIN::optimize() DBUG_RETURN(1); } simple_group= 0; - group_list= remove_const(this, group_list, conds, - rollup.state == ROLLUP::STATE_NONE, - &simple_group); + { + ORDER *old_group_list; + group_list= remove_const(this, (old_group_list= group_list), conds, + rollup.state == ROLLUP::STATE_NONE, + &simple_group); + if (old_group_list && !group_list) + select_distinct= 0; + } if (!group_list && group) { order=0; // The output has only one row From 61b2a6b08312555eb2800a27d982edc13d5f0e86 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Jun 2005 21:44:17 +0200 Subject: [PATCH 3/8] Fix hang/crash with Boolean full-text search against an unindexed field for which the query contained more words than we allocated space. (Bug #7858) myisam/ft_boolean_search.c: Fix calculation of max number of elements -- "words" may not have spaces between them. mysql-test/t/fulltext.test: Modify test to be specific to reported bug (fix for old bug wasn't quite enough) mysql-test/r/fulltext.result: Update results --- myisam/ft_boolean_search.c | 2 +- mysql-test/r/fulltext.result | 2 +- mysql-test/t/fulltext.test | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 62c68322595..8045ddd4657 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -398,7 +398,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, Hack: instead of init_queue, we'll use reinit queue to be able to alloc queue with alloc_root() */ - res=ftb->queue.max_elements=1+query_len/(min(ft_min_word_len,2)+1); + res=ftb->queue.max_elements=1+query_len/2; if (!(ftb->queue.root= (byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*)))) goto err; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index dd5b0407eb3..7ac7e1ca72b 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -338,7 +338,7 @@ insert into t2 values (3, 1, 'xxbuz'); select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); t1_id name t2_id t1_id name 1 data1 1 1 xxfoo -select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode); +select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode); t2_id t1_id name drop table t1,t2; create table t1 (a text, fulltext key (a)); diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 4809f6f0357..d5493daf63e 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -253,9 +253,9 @@ insert into t2 values (3, 1, 'xxbuz'); select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); # -# bug with many short (< ft_min_word_len) words in boolean search +# Bug #7858: bug with many short (< ft_min_word_len) words in boolean search # -select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode); +select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode); drop table t1,t2; # From 0f5b946ccf3aa2e9bc030b674a85acbfda41cee4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2005 18:03:30 +0200 Subject: [PATCH 4/8] Makefile.am: Corrected dependency for "lex_hash.h", to avoid occasional make failure sql/Makefile.am: Corrected dependency for "lex_hash.h", to avoid occasional make failure --- sql/Makefile.am | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sql/Makefile.am b/sql/Makefile.am index f812bbe72af..a76adbd0d57 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -104,8 +104,8 @@ DEFS = -DMYSQL_SERVER \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ @DEFS@ -# Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion -BUILT_SOURCES = sql_yacc.cc sql_yacc.h + +BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) AM_YFLAGS = -d @@ -123,9 +123,6 @@ link_sources: mysql_tzinfo_to_sql.cc rm -f my_time.c @LN_CP_F@ ../sql-common/my_time.c my_time.c -gen_lex_hash.o: gen_lex_hash.cc lex.h - $(CXXCOMPILE) -c $(INCLUDES) $< - mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES) $(CXXCOMPILE) -c $(INCLUDES) -DTZINFO2SQL $< @@ -140,13 +137,9 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS) @echo "If it fails, re-run configure with --with-low-memory" $(CXXCOMPILE) $(LM_CFLAGS) -c $< -lex_hash.h: lex.h gen_lex_hash.cc sql_yacc.h - $(MAKE) gen_lex_hash$(EXEEXT) +lex_hash.h: gen_lex_hash$(EXEEXT) ./gen_lex_hash$(EXEEXT) > $@ -# Hack to ensure that lex_hash.h is built early -sql_lex.o: lex_hash.h - # For testing of udf_example.so; Works on platforms with gcc # (This is not part of our build process but only provided as an example) udf_example.so: udf_example.cc From 7b24dad470ad5cd3526ad081672adc25f1e1a672 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2005 18:54:45 +0200 Subject: [PATCH 5/8] Fix handling of command-line on Windows, missed as part of earlier commit. (Bug #10840) client/mysql.cc: Add cast of unsigned value stored in signed char --- client/mysql.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index b9b9b938da0..5454c76e720 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -989,7 +989,8 @@ static int read_lines(bool execute_commands) a nil, it still needs the space in the linebuffer for it. This is, naturally, undocumented. */ - } while (linebuffer[0] <= linebuffer[1] + 1); + } while ((unsigned char)linebuffer[0] <= + (unsigned char)linebuffer[1] + 1); line= buffer.c_ptr(); #endif /* __NETWARE__ */ #else From 15b113e186939e091af4c93759dfc1ca66a37fda Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2005 10:49:04 -0700 Subject: [PATCH 6/8] group_by.result: Added a test case for bug #11385. group_by.test: Added a test case for bug #11385. field.h: Fixed bug #11385. The bug was due to not defined method decimals for the class Field_datetime. sql/field.h: Fixed bug #11385. The bug was due to not defined method decimals for the class Field_datetime. mysql-test/t/group_by.test: Added atest case for bug #11385. mysql-test/r/group_by.result: Added a test case for bug #11385. --- mysql-test/r/group_by.result | 9 +++++++++ mysql-test/t/group_by.test | 15 ++++++++++++++- sql/field.h | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index ee4b6a31f2f..e279fca2a9d 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -732,3 +732,12 @@ SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; a b 1 2 DROP TABLE t1; +CREATE TABLE t1 (id INT, dt DATETIME); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f; +f id +20050501123000 1 +DROP TABLE t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index f9d113a9c50..382580cbd4e 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -543,7 +543,7 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 DROP TABLE t1; # -# Test for bug #8614: GROUP BY 'const with DISTINCT +# Test for bug #8614: GROUP BY 'const' with DISTINCT # CREATE TABLE t1 (a int, b int); @@ -552,3 +552,16 @@ SELECT a, b FROM t1 GROUP BY 'const'; SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; DROP TABLE t1; + +# +# Test for bug #11385: GROUP BY for datetime converted to decimals +# + +CREATE TABLE t1 (id INT, dt DATETIME); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' ); +SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f; + +DROP TABLE t1; diff --git a/sql/field.h b/sql/field.h index 1d7669d540d..ba963418c7a 100644 --- a/sql/field.h +++ b/sql/field.h @@ -25,6 +25,7 @@ #endif #define NOT_FIXED_DEC 31 +#define DATETIME_DEC 6 class Send_field; class Protocol; @@ -861,6 +862,7 @@ public: enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; } #endif enum Item_result cmp_type () const { return INT_RESULT; } + uint decimals() const { return DATETIME_DEC; } int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr); From d73327e1996d172640d063b6ac22a0d21be26562 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2005 21:37:39 +0200 Subject: [PATCH 7/8] mtr_cases.pl: Bug#11466: Script can now get test case name from test case file path on command line mysql-test-run.pl: Bug#11466: Added --skip-ndbcluster/--skip-ndb option mtr_cases.pl: Don't set --default-time-zone if opt file sets it Restart the server if time zone is given in opt file mysql-test-run.pl: Don't remove symlink to "var" directory in cleanup Removed duplicate/unessesary options to mysqld mysql-test/mysql-test-run.pl: Bug#11466: Added --skip-ndbcluster/--skip-ndb option mysql-test/lib/mtr_cases.pl: Bug#11466: Script can now get test case name from test case file path on command line --- mysql-test/lib/mtr_cases.pl | 75 +++++++++++++++++++++++------------- mysql-test/mysql-test-run.pl | 29 +++++++------- 2 files changed, 63 insertions(+), 41 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index c07f10c3bf7..72cbe72bc0a 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -4,6 +4,7 @@ # and is part of the translation of the Bourne shell script with the # same name. +use File::Basename; use strict; sub collect_test_cases ($); @@ -39,6 +40,7 @@ sub collect_test_cases ($) { if ( @::opt_cases ) { foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort + $tname= basename($tname, ".test"); my $elem= "$tname.test"; if ( ! -f "$testdir/$elem") { @@ -161,52 +163,73 @@ sub collect_one_test_case($$$$$) { my $slave_sh= "$testdir/$tname-slave.sh"; my $disabled= "$testdir/$tname.disabled"; - $tinfo->{'master_opt'}= ["--default-time-zone=+3:00"]; - $tinfo->{'slave_opt'}= ["--default-time-zone=+3:00"]; + $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; + $tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; $tinfo->{'slave_mi'}= []; if ( -f $master_opt_file ) { $tinfo->{'master_restart'}= 1; # We think so for now - # This is a dirty hack from old mysql-test-run, we use the opt file - # to flag other things as well, it is not a opt list at all - $tinfo->{'master_opt'}= mtr_get_opts_from_file($master_opt_file); - foreach my $opt (@{$tinfo->{'master_opt'}}) + MASTER_OPT: { - my $value; + my $master_opt= mtr_get_opts_from_file($master_opt_file); - $value= mtr_match_prefix($opt, "--timezone="); - - if ( defined $value ) + foreach my $opt ( @$master_opt ) { - $tinfo->{'timezone'}= $value; - $tinfo->{'master_opt'}= []; - $tinfo->{'master_restart'}= 0; - last; - } + my $value; - $value= mtr_match_prefix($opt, "--result-file="); + # This is a dirty hack from old mysql-test-run, we use the opt + # file to flag other things as well, it is not a opt list at + # all - if ( defined $value ) - { - $tinfo->{'result_file'}= "r/$value.result"; - if ( $::opt_result_ext and $::opt_record or - -f "$tinfo->{'result_file'}$::opt_result_ext") + $value= mtr_match_prefix($opt, "--timezone="); + if ( defined $value ) { - $tinfo->{'result_file'}.= $::opt_result_ext; + $tinfo->{'timezone'}= $value; + $tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ + last MASTER_OPT; } - $tinfo->{'master_opt'}= []; - $tinfo->{'master_restart'}= 0; - last; + + $value= mtr_match_prefix($opt, "--result-file="); + if ( defined $value ) + { + $tinfo->{'result_file'}= "r/$value.result"; + if ( $::opt_result_ext and $::opt_record or + -f "$tinfo->{'result_file'}$::opt_result_ext") + { + $tinfo->{'result_file'}.= $::opt_result_ext; + } + $tinfo->{'master_restart'}= 0; + last MASTER_OPT; + } + + # If we set default time zone, remove the one we have + $value= mtr_match_prefix($opt, "--default-time-zone="); + if ( defined $value ) + { + $tinfo->{'master_opt'}= []; + } + } + + # Ok, this was a real option list, add it + push(@{$tinfo->{'master_opt'}}, @$master_opt); } } if ( -f $slave_opt_file ) { - $tinfo->{'slave_opt'}= mtr_get_opts_from_file($slave_opt_file); $tinfo->{'slave_restart'}= 1; + my $slave_opt= mtr_get_opts_from_file($slave_opt_file); + + foreach my $opt ( @$slave_opt ) + { + # If we set default time zone, remove the one we have + my $value= mtr_match_prefix($opt, "--default-time-zone="); + $tinfo->{'slave_opt'}= [] if defined $value; + } + push(@{$tinfo->{'slave_opt'}}, @$slave_opt); } if ( -f $slave_mi_file ) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6151dd68160..060d8f7207a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -264,6 +264,7 @@ our $opt_warnings; our $opt_udiff; +our $opt_skip_ndbcluster; our $opt_with_ndbcluster; our $opt_with_openssl; @@ -463,6 +464,7 @@ sub command_line_setup () { # Control what test suites or cases to run 'force' => \$opt_force, 'with-ndbcluster' => \$opt_with_ndbcluster, + 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, 'do-test=s' => \$opt_do_test, 'suite=s' => \$opt_suite, 'skip-rpl' => \$opt_skip_rpl, @@ -662,6 +664,11 @@ sub command_line_setup () { $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port"; } + if ( $opt_skip_ndbcluster ) + { + $opt_with_ndbcluster= 0; + } + # FIXME #if ( $opt_valgrind or $opt_valgrind_all ) @@ -1020,11 +1027,6 @@ sub kill_and_cleanup () { mtr_report("Removing Stale Files"); - if ( -l $opt_vardir and ! unlink($opt_vardir) ) - { - mtr_error("Can't remove soft link \"$opt_vardir\""); - } - rmtree("$opt_vardir/log"); rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port"); rmtree("$opt_vardir/run"); @@ -1722,6 +1724,11 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--local-infile", $prefix); mtr_add_arg($args, "%s--datadir=%s", $prefix, $master->[$idx]->{'path_myddir'}); + + if ( $opt_skip_ndbcluster ) + { + mtr_add_arg($args, "%s--skip-ndbcluster", $prefix); + } } if ( $type eq 'slave' ) @@ -1862,19 +1869,11 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix); mtr_add_arg($args, "%s--init-rpl-role=master", $prefix); } - else + elsif ( $type eq 'master' ) { mtr_add_arg($args, "%s--exit-info=256", $prefix); mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); - - if ( $type eq 'master' ) - { - mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); - } - if ( $type eq 'slave' ) - { - mtr_add_arg($args, "%s--log=%s", $prefix, $slave->[0]->{'path_mylog'}); - } + mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); } return $args; From e74d5313738d853dd7108aeab12db96bfc26b489 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jun 2005 02:21:52 +0200 Subject: [PATCH 8/8] mysql-test-run.pl: More compact and safe handling of path names. Support for running in Windows source tree. Use libtool wrapper, instead of messing with library path names, and objects in .libs dir. mtr_misc.pl: Utility function that search aand check path names mtr_report.pl: Patch by Carsten, set correct reject/result/eval if not main suite mysql-test/lib/mtr_report.pl: Patch by Carsten, set correct reject/result/eval if not main suite mysql-test/lib/mtr_misc.pl: Utility function that search aand check path names mysql-test/mysql-test-run.pl: More compact and safe handling of path names. Support for running in Windows source tree. Use libtool wrapper, instead of messing with library path names, and objects in .libs dir. --- mysql-test/lib/mtr_misc.pl | 52 ++++++++++ mysql-test/lib/mtr_report.pl | 7 ++ mysql-test/mysql-test-run.pl | 187 ++++++++++++----------------------- 3 files changed, 123 insertions(+), 123 deletions(-) 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 060d8f7207a..0ecc7bc6c52 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