1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
--echo #
--echo # WL#10916: Allow setting component option values at INSTALL COMPONENT
--echo #
# UBSAN compile removes -fvisibility=hidden from components.
# This causes failures in instrumented components
--source include/not_ubsan.inc
call mtr.add_suppression("Effective value of validate_password_length is changed. New value is");
call mtr.add_suppression("option '[^']*': signed value [^ ]* adjusted");
call mtr.add_suppression("Unknown suffix '[^']' used for variable '[^']*'");
call mtr.add_suppression("Parsing options for variable '[^;]*' failed");
call mtr.add_suppression("Error while setting value '[^']*' to '[^']*'");
call mtr.add_suppression("variable registration failed");
call mtr.add_suppression("boolean value '[^']*' was not recognized. Set to OFF");
--echo # FR1: check the syntax
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET;
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET SESSION foo = 16;
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET PERSIST_ONLY bar = 16;
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET @@bar = 16;
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET @@bar = DEFAULT;
--error ER_PARSE_ERROR
INSTALL COMPONENT "file://component_validate_password" SET @@bar = xxx;
--error ER_INSTALL_COMPONENT_SET_NULL_VALUE
INSTALL COMPONENT "file://component_validate_password" SET length = NULL;
INSTALL COMPONENT "file://component_validate_password" SET length = 8 + 8;
--echo # Should be 16
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
--error ER_SET_CONSTANTS_ONLY
INSTALL COMPONENT "file://component_validate_password" SET length = (SELECT a FROM t1);
DROP TABLE t1;
SET @gizmo = 32;
INSTALL COMPONENT "file://component_validate_password" SET length = @gizmo;
--echo # Should be 32
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
INSTALL COMPONENT "file://component_validate_password" SET length = @@global.max_connections;
--echo # Should be 1
SELECT @@global.validate_password.length = @@global.max_connections;
UNINSTALL COMPONENT "file://component_validate_password";
INSTALL COMPONENT "file://component_validate_password" SET length = DAYOFMONTH('1972-07-29');
--echo # Should be 29
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # Should pass
INSTALL COMPONENT "file://component_validate_password" SET length = CAST(RAND() * 10 AS SIGNED);
UNINSTALL COMPONENT "file://component_validate_password";
--echo # Should fail
--error ER_SET_CONSTANTS_ONLY
INSTALL COMPONENT "file://component_validate_password" SET length = SUM(100);
--echo # Should pass
INSTALL COMPONENT "file://component_validate_password" SET length = 1024 * 1024 * 1024 * 1024;
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # Should fail
--error ER_DATA_OUT_OF_RANGE
INSTALL COMPONENT "file://component_validate_password" SET length = 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024;
--echo # Should return 4: adjusted
INSTALL COMPONENT "file://component_validate_password" SET length = -100;
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
--error ER_COMPONENTS_LOAD_CANT_INITIALIZE
INSTALL COMPONENT "file://component_validate_password" SET length = 3.14159;
--error ER_COMPONENTS_LOAD_CANT_INITIALIZE
INSTALL COMPONENT "file://component_validate_password" SET length = 3.000000000000;
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password" SET length = 1e2;
--error ER_DATA_OUT_OF_RANGE
INSTALL COMPONENT "file://component_validate_password" SET length = 1e308 * 100;
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password" SET length = '100';
CREATE FUNCTION test_func () RETURNS INT DETERMINISTIC
RETURN 12 + 3;
--error ER_SET_CONSTANTS_ONLY
INSTALL COMPONENT "file://component_validate_password" SET length = testfunc();
DROP FUNCTION test_func;
--echo # FR1.1: setting a non-related value. should fail
--error ER_INSTALL_COMPONENT_SET_UNUSED_VALUE
INSTALL COMPONENT "file://component_validate_password" SET init_connect = "SELECT 1";
--echo # A boolean variable set to ON. Should pass
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = ON;
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to "ON". Should pass
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = "ON";
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to OFF. Should pass
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = OFF;
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to "OFF". Should pass
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = "OFF";
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to gizmo. Should pass and return 0
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = gizmo;
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to gizmo.off. Should fail
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = gizmo.off;
--echo # A boolean variable set to 1. Should pass
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = 1;
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # A boolean variable set to 11. Should pass and return 1
INSTALL COMPONENT "file://component_validate_password" SET check_user_name = 11;
SELECT @@global.validate_password.check_user_name;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # FR1.4.1: test failed sysvar cleanup: should load
INSTALL COMPONENT "file://component_validate_password";
UNINSTALL COMPONENT "file://component_validate_password";
INSTALL COMPONENT "file://component_validate_password"
SET GLOBAL validate_password.length = 16;
--echo # FR6: precedence over command line: Should be 16 and not 100
SELECT @@global.validate_password.length;
SELECT VARIABLE_VALUE FROM performance_schema.persisted_variables
WHERE VARIABLE_NAME='validate_password.length';
UNINSTALL COMPONENT "file://component_validate_password";
--echo # FR1.2: no class means GLOBAL
INSTALL COMPONENT "file://component_validate_password"
SET validate_password.length = 16, PERSIST validate_password.number_count = 13;
SELECT VARIABLE_VALUE FROM performance_schema.persisted_variables
WHERE VARIABLE_NAME LIKE 'validate_password.%' ORDER BY 1;
UNINSTALL COMPONENT "file://component_validate_password";
--echo # FR5: UNINSTALL doesn't unpersist
SELECT VARIABLE_VALUE FROM performance_schema.persisted_variables
WHERE VARIABLE_NAME LIKE 'validate_password.%' ORDER BY 1;
--echo # FR6: INSTALL still picks up persisted variable values: should be 13
INSTALL COMPONENT "file://component_validate_password"
SET validate_password.length = 16;
SELECT @@global.validate_password.number_count;
UNINSTALL COMPONENT "file://component_validate_password";
INSTALL COMPONENT "file://component_validate_password"
SET GLOBAL validate_password.length = 60, validate_password.number_count = 50;
--echo # FR6: precedence over persist: should be 50
SELECT @@global.validate_password.number_count;
UNINSTALL COMPONENT "file://component_validate_password";
RESET PERSIST;
--echo FR4: No extra privs required for INSTALL SET
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
CREATE USER wl10916@localhost;
GRANT INSERT,DELETE,UPDATE ON mysql.component TO wl10916@localhost;
connect(wl10916_con,localhost, wl10916, ,);
INSTALL COMPONENT "file://component_validate_password"
SET GLOBAL validate_password.length = 16;
UNINSTALL COMPONENT "file://component_validate_password";
connection default;
disconnect wl10916_con;
DROP USER wl10916@localhost;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password" SET GLOBAL validate_password.length = 'gizmo';
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password" SET PERSIST validate_password.length = 'gizmo';
--echo #FR7: check if non-prefixed variable names can be used
INSTALL COMPONENT "file://component_validate_password" SET length = 12;
SELECT @@global.validate_password.length;
UNINSTALL COMPONENT "file://component_validate_password";
--error ER_INSTALL_COMPONENT_SET_UNUSED_VALUE
INSTALL COMPONENT "file://component_validate_password", "file://component_example_component1" SET length = 12;
--error ER_INSTALL_COMPONENT_SET_UNUSED_VALUE
INSTALL COMPONENT "file://component_validate_password" SET foo = 1;
--error ER_INSTALL_COMPONENT_SET_UNUSED_VALUE
INSTALL COMPONENT "file://component_validate_password" SET foo = 1, bar = 2;
--error ER_INSTALL_COMPONENT_SET_UNUSED_VALUE
INSTALL COMPONENT "file://component_validate_password" SET foo = 1, bar = 2, baz = 3;
--echo # test if all components are unloaded on error
--error ER_WRONG_TYPE_FOR_VAR
INSTALL COMPONENT "file://component_validate_password", "file://component_example_component1"
SET PERSIST validate_password.number_count = 13, GLOBAL validate_password.length = 'gizmo';
--echo # should be empty
SELECT VARIABLE_VALUE FROM performance_schema.persisted_variables
WHERE VARIABLE_NAME LIKE 'validate_password.%' ORDER BY 1;
--echo # the 4 below should pass
INSTALL COMPONENT "file://component_example_component1";
INSTALL COMPONENT "file://component_validate_password";
UNINSTALL COMPONENT "file://component_example_component1";
UNINSTALL COMPONENT "file://component_validate_password";
--echo # Cleanup
RESET PERSIST;
--let $MYSQLD_DATADIR= `select @@datadir`
--remove_file $MYSQLD_DATADIR/mysqld-auto.cnf
--echo # End of 8.0 tests
|