Commit 0d301ee8 authored by unknown's avatar unknown

* 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
parent 95e2558f
......@@ -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;
}
......
......@@ -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
# ----------------------------------------------------------------------
......
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));
......
......@@ -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
......
......@@ -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
......@@ -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)
......
......@@ -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;
......
......@@ -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 &&
......
......@@ -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 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
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);
}
......
......@@ -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
......
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