diff options
author | unknown <guilhem@gbichot4.local> | 2007-08-09 15:00:32 +0200 |
---|---|---|
committer | unknown <guilhem@gbichot4.local> | 2007-08-09 15:00:32 +0200 |
commit | 0d301ee822c45fa6b8e1ff0e31e7ec3308c9747f (patch) | |
tree | 15f575ff8d17bb0e00ecee41cc70f14f74e60fc6 | |
parent | 95e2558f8eed4f23179b31d0b59f03bb8af05a12 (diff) | |
download | mariadb-git-0d301ee822c45fa6b8e1ff0e31e7ec3308c9747f.tar.gz |
* tests which use MERGE or INSERT DELAYED should run only
with engines which support that
* temporarily adding option --global-subst to mysqltest so that
the full testsuite can be run using Maria tables without failing
on trivial differences (like diff in the engine clause of
SHOW CREATE TABLE)
* using recognizable tags for todos of the Maria team
client/mysqltest.c:
temporarily adding option --global-subst: its argument is X,Y.
It replaces all occurrences of X by Y into mysqltest's result
before the comparison with the expected result is done.
This serves for when a test is run with --default-storage-engine=X
where X is not MyISAM: tests using SHOW CREATE TABLE will always fail
because SHOW CREATE TABLE prints X instead of MyISAM. With
--global-subst=X,MyISAM , such trivial differences are eliminated and
test may be reported as passing.
For example, --global-subst=MARIA,MyISAM
This is not good enough for merging into main trees! just for running
many tests and finding bugs now!
mysql-test/mysql-test-run.pl:
new option --mysqltest to pass options to mysqltest (like we have
--mysqld). Used for example like this:
./mtr --mysqltest=--global-subst=MARIA,MyISAM
mysql-test/r/merge.result:
update
mysql-test/t/delayed.test:
run test only with engines which support INSERT DELAYED
mysql-test/t/merge.test:
run test only with MyISAM tables, as they are required by MERGE
sql/sql_delete.cc:
recognizable tag
sql/table.cc:
recognizable tag
storage/maria/ha_maria.cc:
recognizable tag
storage/maria/ma_check.c:
recognizable tag
storage/maria/ma_create.c:
recognizable tag
-rw-r--r-- | client/mysqltest.c | 56 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 9 | ||||
-rw-r--r-- | mysql-test/r/merge.result | 2 | ||||
-rw-r--r-- | mysql-test/t/delayed.test | 9 | ||||
-rw-r--r-- | mysql-test/t/merge.test | 11 | ||||
-rw-r--r-- | sql/sql_delete.cc | 10 | ||||
-rw-r--r-- | sql/table.cc | 7 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 6 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 32 | ||||
-rw-r--r-- | storage/maria/ma_create.c | 3 |
10 files changed, 117 insertions, 28 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 0a1b57ff80a..76176d8acbb 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -69,7 +69,8 @@ enum { OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION, OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, - OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR + OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, + OPT_GLOBAL_SUBST }; static int record= 0, opt_sleep= -1; @@ -105,6 +106,9 @@ static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static uint delimiter_length= 1; static char TMPDIR[FN_REFLEN]; +static char global_subst_from[200]; +static char global_subst_to[200]; +static char *global_subst= NULL; /* Block stack */ enum block_cmd { @@ -788,6 +792,7 @@ void free_used_memory() my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR)); free_defaults(default_argv); free_re(); + my_free(global_subst, MYF(MY_ALLOW_ZERO_PTR)); #ifdef __WIN__ free_tmp_sh_file(); free_win_path_patterns(); @@ -1088,6 +1093,40 @@ void check_result(DYNAMIC_STRING* ds) break; /* ok */ case RESULT_LENGTH_MISMATCH: dump_result_to_reject_file(ds->str, ds->length); + if (global_subst) + { + /** + @todo MARIA_HACK + This serves for when a test is run with --default-storage-engine=X + where X is not MyISAM: tests using SHOW CREATE TABLE will always fail + because SHOW CREATE TABLE prints X instead of MyISAM. With + --global-subst=X,MyISAM , such trivial differences are eliminated and + test may be reported as passing. + --global-subst is only a quick way to run a lot of existing tests + with Maria and find bugs; it is not good enough for reaching the main + trees when Maria is merged into them. It relies on hard-coded path of + "replace", on existence of "cmp". It's just horrible but it works for + devs using a bk tree in a GNU-based system, which is what we have in + the team. + --global-subst should be removed. + */ + char reject_file[FN_REFLEN]; + char sys_com[50 + FN_REFLEN]; + fn_format(reject_file, result_file_name, "", ".reject", + MY_REPLACE_EXT); + sprintf(sys_com, "../extra/replace %s %s -- %s >/dev/null", + global_subst_from, global_subst_to, reject_file); + if (system(sys_com)) + die("replace failed"); + sprintf(sys_com, "cmp %s %s >/dev/null", + reject_file, result_file_name); + if (!system(sys_com)) + { + /* test is ok in fact */ + my_delete(reject_file, MYF(0)); + break; + } + } die("Result length mismatch"); break; case RESULT_CONTENT_MISMATCH: @@ -4430,6 +4469,11 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"global-subst", OPT_GLOBAL_SUBST, "argument should be 'X,Y' ;" + " substitute string X with another Y accross the whole test's current" + " result before comparing with expected result file", + (uchar**) &global_subst, (uchar**) &global_subst, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include, @@ -4673,6 +4717,16 @@ int parse_args(int argc, char **argv) if (tty_password) opt_pass= get_tty_password(NullS); /* purify tested */ + if (global_subst != NULL) + { + char *comma= strstr(global_subst, ","); + if (comma == NULL) + die("wrong --global-subst, must be X,Y"); + memcpy(global_subst_from, global_subst, (comma-global_subst)); + global_subst_from[comma-global_subst]= 0; + memcpy(global_subst_to, comma+1, strlen(comma)); + } + return 0; } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 06c1906cd18..9310c8d1626 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -167,6 +167,7 @@ our $opt_small_bench= 0; our $opt_big_test= 0; our @opt_extra_mysqld_opt; +our @opt_extra_mysqltest_opt; our $opt_compress; our $opt_ssl; @@ -558,6 +559,9 @@ sub command_line_setup () { # Extra options used when starting mysqld 'mysqld=s' => \@opt_extra_mysqld_opt, + # Extra options used when starting mysqld + 'mysqltest=s' => \@opt_extra_mysqltest_opt, + # Run test on running server 'extern' => \$opt_extern, 'ndb-connectstring=s' => \$opt_ndbconnectstring, @@ -4794,6 +4798,11 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--skip-ssl"); } + foreach my $arg ( @opt_extra_mysqltest_opt ) + { + mtr_add_arg($args, "%s", $arg); + } + # ---------------------------------------------------------------------- # If embedded server, we create server args to give mysqltest to pass on # ---------------------------------------------------------------------- diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index bb4fc654b38..d22b8ba5fdd 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -1,3 +1,5 @@ +set global storage_engine=myisam; +set session storage_engine=myisam; drop table if exists t1,t2,t3,t4,t5,t6; drop database if exists mysqltest; create table t1 (a int not null primary key auto_increment, message char(20)); diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 396c06f43e7..17c2722dda4 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -5,6 +5,15 @@ # (Can't be tested with purify :( ) # +# limit the test to engines which support INSERT DELAYED +disable_query_log; +--require r/true.require +select @@global.storage_engine in +("memory","myisam","archive","blackhole") and +@@session.storage_engine in +("memory","myisam","archive","blackhole") as `TRUE`; +enable_query_log; + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index fd479276b3b..91bf247c469 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,6 +2,11 @@ # test of MERGE TABLES # +# MERGE tables require MyISAM tables +let $default=`select @@global.storage_engine`; +set global storage_engine=myisam; +set session storage_engine=myisam; + --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6; drop database if exists mysqltest; @@ -512,3 +517,9 @@ CHECK TABLE tm1; DROP TABLE tm1, t1, t2; --echo End of 5.0 tests + +--disable_result_log +--disable_query_log +eval set global storage_engine=$default; +--enable_result_log +--enable_query_log diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c96ae8f2597..43e5bbf968f 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -923,11 +923,11 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); #ifdef WITH_MARIA_STORAGE_ENGINE - /* - A hack until BUG#30309 is fixed. - Had to make this, otherwise tests "temp_table.test" and "truncate.test" - crashes server at shutdown when using Maria tables: a temporary table is - correctly created as non-transactional but then, when truncated, is + /** + @todo MARIA_HACK until BUG#30309 is fixed. + Had to make this, otherwise tests "temp_table.test" and "truncate.test" + crashes server at shutdown when using Maria tables: a temporary table + is correctly created as non-transactional but then, when truncated, is recreated as transactional. */ if (table_type->db_type == DB_TYPE_MARIA) diff --git a/sql/table.cc b/sql/table.cc index 6eb758162df..e8add38640c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2425,9 +2425,10 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table) create_info->row_type= share->row_type; create_info->default_table_charset= share->table_charset; create_info->table_charset= 0; - /* - See hack in mysql_truncate(); when this is properly fixed, the if() below - can be removed, the assignment can always be made. + /** + @todo MARIA_HACK + See hack in mysql_truncate(); when this is properly fixed, the if() below + can be removed, the assignment can always be made. */ if (create_info->transactional == HA_CHOICE_UNDEF) create_info->transactional= share->transactional; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index cfc8e5fc07a..99b92c1bcfc 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -746,7 +746,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER))) return (my_errno ? my_errno : -1); - /* + /** + @todo ASK_MONTY This is a protection for the case of a frm and MAI containing incompatible table definitions (as in BUG#25908). This was merged from MyISAM. But it breaks maria.test and ps_maria.test ("incorrect key file") if the @@ -2160,7 +2161,8 @@ int ha_maria::create(const char *name, register TABLE *table_arg, create_info.data_file_name= ha_create_info->data_file_name; create_info.index_file_name= ha_create_info->index_file_name; #ifdef ASK_MONTY - /* + /** + @todo ASK_MONTY Where "transactional" in the frm and in the engine can go out of sync. Don't we want to do, after the setting, this test: if (!create_info.transactional && diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index e15c9405e23..a68a21d0180 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2047,9 +2047,10 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, } _ma_reset_status(sort_info.new_info); #ifdef ASK_MONTY /* cf maria_create() */ - /* - without this call, a REPAIR on an empty table leaves the data file of - size 0, which sounds reasonable. + /** + @todo ASK_MONTY + without this call, a REPAIR on an empty table leaves the data file of + size 0, which sounds reasonable. */ if (_ma_initialize_data_file(sort_info.new_info->s, new_file)) goto err; @@ -2272,20 +2273,19 @@ err: llstr(sort_param.start_recpos,llbuff)); if (sort_info.new_info && sort_info.new_info != sort_info.info) { -#ifdef ASK_MONTY - /* - grepping for "dfile.file=" - shows several places (ma_check.c, ma_panic.c, ma_extra.c) where we - modify dfile.file without modifying share->bitmap.file.file; those - sound like bugs because the two variables are normally copies of each - other in BLOCK_RECORD (and in other record formats it does not hurt to - change the unused share->bitmap.file.file). - It does matter, because if we close dfile.file, set dfile.file to -1, - but leave bitmap.file.file to its positive value, maria_close() will - close a file which it is not allowed to (maybe even a file in another - engine or mysqld!). + /** + @todo ASK_MONTY + grepping for "dfile.file=" + shows several places (ma_check.c, ma_panic.c, ma_extra.c) where we + modify dfile.file without modifying share->bitmap.file.file; those + sound like bugs because the two variables are normally copies of each + other in BLOCK_RECORD (and in other record formats it does not hurt + to change the unused share->bitmap.file.file). + It does matter, because if we close dfile.file, set dfile.file to -1, + but leave bitmap.file.file to its positive value, maria_close() will + close a file which it is not allowed to (maybe even a file in another + engine or mysqld!). */ -#endif sort_info.new_info->dfile.file= -1; maria_close(sort_info.new_info); } diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index b3aef7c544c..f944b9d8bf7 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1041,7 +1041,8 @@ int maria_create(const char *name, enum data_file_type datafile_type, goto err; errpos=3; - /* + /** + @todo ASK_MONTY QQ: this sets data_file_length from 0 to 8192, but we wrote the state already to the index file (because: - log record is built from index header so state must be written before |