| 1 |
########################################### |
| 2 |
# |
| 3 |
# This include file executes define_engine.inc which belongs to the storage engine |
| 4 |
# and then checks and sets test options and parameters. |
| 5 |
# |
| 6 |
# The name of the engine under test must be defined in $ENGINE variable. |
| 7 |
# You can define it either in define_engine.inc or in your environment. |
| 8 |
# |
| 9 |
################################ |
| 10 |
# |
| 11 |
# The following three variables define specific options for columns and tables. |
| 12 |
# Normally there should be none needed, but for some engines it can be different. |
| 13 |
# If the engine requires specific column option for all or indexed columns, |
| 14 |
# set them inside the comment, e.g. /*!NOT NULL*/. |
| 15 |
# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/ |
| 16 |
|
| 17 |
let $default_col_opts = /*!*/; |
| 18 |
let $default_col_indexed_opts = /*!*/; |
| 19 |
let $default_tbl_opts = /*!*/; |
| 20 |
|
| 21 |
# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type -- choose minimal that the engine allows, |
| 22 |
# or set it to /*!*/ if none is supported |
| 23 |
|
| 24 |
let $default_index = /*!INDEX*/; |
| 25 |
|
| 26 |
# If the engine does not support these types, replace them with the closest possible |
| 27 |
|
| 28 |
let $default_int_type = INT(11); |
| 29 |
let $default_char_type = CHAR(8); |
| 30 |
|
| 31 |
################################ |
| 32 |
# |
| 33 |
# Here the actual work starts |
| 34 |
# define_engine.inc will set the ENGINE variable |
| 35 |
# and possibly redefine some of default_* variables |
| 36 |
|
| 37 |
--source define_engine.inc |
| 38 |
|
| 39 |
if (!$ENGINE) |
| 40 |
{ |
| 41 |
--skip Storage engine under test is not defined, export ENGINE env variable or set it in define_engine.inc |
| 42 |
} |
| 43 |
|
| 44 |
# Check that the storage engine is loaded. Here we don't need to worry about the case, |
| 45 |
# as I_S is case-insensitive. |
| 46 |
|
| 47 |
if (!`SELECT engine FROM INFORMATION_SCHEMA.ENGINES WHERE engine = '$ENGINE' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) |
| 48 |
{ |
| 49 |
--skip The test requires $ENGINE engine |
| 50 |
} |
| 51 |
|
| 52 |
# Further in tests we will use $storage_engine variable |
| 53 |
|
| 54 |
let $storage_engine = $ENGINE; |
| 55 |
|
| 56 |
# In case somebody removed comment tags in define_engine.inc |
| 57 |
if (!$default_col_opts) |
| 58 |
{ |
| 59 |
let $default_col_opts = /*!*/; |
| 60 |
} |
| 61 |
if (!$default_col_indexed_opts) |
| 62 |
{ |
| 63 |
let $default_col_indexed_opts = /*!*/; |
| 64 |
} |
| 65 |
if (!$default_tbl_opts) |
| 66 |
{ |
| 67 |
let $default_tbl_opts = /*!*/; |
| 68 |
} |
| 69 |
if (!$default_index) |
| 70 |
{ |
| 71 |
let $default_index = /*!*/; |
| 72 |
} |
| 73 |
|
| 74 |
# Adding a comment after default options helps later to mask the custom values in result output |
| 75 |
let $default_index = $default_index /*Custom index*/; |
| 76 |
let $default_col_opts = $default_col_opts /*Custom column options*/; |
| 77 |
let $default_col_indexed_opts = $default_col_indexed_opts /*Custom indexed column options*/; |
| 78 |
let $default_tbl_opts = $default_tbl_opts /*Custom table options*/; |
| 79 |
|
| 80 |
|
| 81 |
# Finally, set some variables which will make our life easier later. |
| 82 |
# For many tests, we need a simple INT or CHAR column, but with |
| 83 |
# (optional) column attributes which the engine might require. |
| 84 |
# Also, a test might be called by another test, and the calling test |
| 85 |
# might need additional attributes. So, here we are collecting them all together. |
| 86 |
# Example: |
| 87 |
# CSV engine requires all columns to be NOT NULL, so its define_engine.inc file will contain |
| 88 |
# let $default_col_opts = /*!NOT NULL*/; |
| 89 |
# Then, we have test1.test which calls have_engine.inc. |
| 90 |
# If it's executed directly, it will have $int_col = 'INT(11) NOT NULL' for CSV and 'INT(11)' for MyISAM. |
| 91 |
# Another test, test2.test might set $extra_type_opts = UNSIGNED and/or $extra_col_opts = NULL |
| 92 |
# and call test1.test. |
| 93 |
# If both are set, test1.test will be executed for MyISAM with 'INT(11) UNSIGNED NULL', |
| 94 |
# and for CSV INT(11) UNSIGNED NOT NULL NULL (and will fail because CSV does not support nullable columns) |
| 95 |
|
| 96 |
let $col_opts = $default_col_opts; |
| 97 |
let $col_indexed_opts = $default_col_indexed_opts; |
| 98 |
|
| 99 |
if ($extra_col_opts) |
| 100 |
{ |
| 101 |
let $col_opts = $col_opts $extra_col_opts; |
| 102 |
let $col_indexed_opts = $col_indexed_opts $extra_col_opts; |
| 103 |
} |
| 104 |
|
| 105 |
if ($extra_type_opts) |
| 106 |
{ |
| 107 |
let $col_opts = $extra_type_opts $col_opts; |
| 108 |
let $col_indexed_opts = $extra_type_opts $col_indexed_opts; |
| 109 |
} |
| 110 |
|
| 111 |
let $int_col = $default_int_type $col_opts; |
| 112 |
let $int_indexed_col = $default_int_type $col_indexed_opts; |
| 113 |
|
| 114 |
let $char_col = $default_char_type $col_opts; |
| 115 |
let $char_indexed_col = $default_char_type $col_indexed_opts; |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
if (`SELECT @@global.log_bin = 'ON' AND @@global.binlog_format = 'STATEMENT'`) |
| 120 |
{ |
| 121 |
--disable_query_log |
| 122 |
CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT'); |
| 123 |
--enable_query_log |
| 124 |
} |
| 125 |
|
| 126 |
--disable_abort_on_error |
| 127 |
|