diff options
author | unknown <msvensson@neptunus.(none)> | 2005-10-12 13:56:07 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2005-10-12 13:56:07 +0200 |
commit | 32f2ad060606f08a749b01655bf242bf7a0d40e1 (patch) | |
tree | 5f053dd50effadde3efbece9a9d1399ad9d4e578 /mysql-test | |
parent | c7e95b37fe86dc2f253ec08dd38e17ec8a4b6223 (diff) | |
download | mariadb-git-32f2ad060606f08a749b01655bf242bf7a0d40e1.tar.gz |
Always test ssl and compress
- Updated after review
client/mysqltest.c:
Updated after review.
Fix "connect" command to take SSL and/or COMPRESS as options instead of enable/disable_ssl and enable/disable_compress
Commented do_connect, added test cases etc.
Fix safe_get_param to make it possible to call it once for every argument without having any checks inbetween.
Make a copy for query->first_argument since safe_get_param will modify query string. Now connect works inside a while loop as well.
mysql-test/mysql-test-run.pl:
Updated after review
mysql-test/r/connect.result:
Enable test that was previolsy disabled because of "no error handling" in connect
mysql-test/r/mysqltest.result:
Added tests for "connect"
mysql-test/t/compress.test:
Updated after review, use the option argument to connect
mysql-test/t/connect.test:
Enable test that was previolsy disabled because of "no error handling" in connect
Now it's possible to use "--error" before connect, so let's use it.
mysql-test/t/information_schema.test:
Connection user4 was already used
mysql-test/t/myisam.test:
Disconnect con1 so the name can be reused
mysql-test/t/mysqltest.test:
Added tests for "connect"
mysql-test/t/openssl_1.test:
Updated after review, use the option argument to connect
mysql-test/t/sp-security.test:
Disconnect user1 connection so the name can be reused
mysql-test/t/ssl.test:
Updated after review, use the option argument to connect
mysql-test/t/ssl_compress.test:
Updated after review, use the option argument to connect
sql/mysqld.cc:
Updated after review, Compression variable is always available
sql/sql_show.cc:
Updated after review, Compression variable is always available
sql/structs.h:
Updated after review, Compression variable is always available
Diffstat (limited to 'mysql-test')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 13 | ||||
-rw-r--r-- | mysql-test/r/connect.result | 20 | ||||
-rw-r--r-- | mysql-test/r/mysqltest.result | 12 | ||||
-rw-r--r-- | mysql-test/t/compress.test | 4 | ||||
-rw-r--r-- | mysql-test/t/connect.test | 82 | ||||
-rw-r--r-- | mysql-test/t/information_schema.test | 4 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 3 | ||||
-rw-r--r-- | mysql-test/t/mysqltest.test | 68 | ||||
-rw-r--r-- | mysql-test/t/openssl_1.test | 10 | ||||
-rw-r--r-- | mysql-test/t/sp-security.test | 1 | ||||
-rw-r--r-- | mysql-test/t/ssl.test | 5 | ||||
-rw-r--r-- | mysql-test/t/ssl_compress.test | 6 |
12 files changed, 154 insertions, 74 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 833b7515c59..35b5f9c512a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -191,7 +191,6 @@ our $opt_compress; our $opt_ssl; our $opt_skip_ssl; our $opt_ssl_supported; -our $opt_with_openssl; # Deprecated flag our $opt_ps_protocol; our $opt_current_test; @@ -480,8 +479,7 @@ sub command_line_setup () { # Control what engine/variation to run 'embedded-server' => \$opt_embedded_server, 'ps-protocol' => \$opt_ps_protocol, - 'with-openssl' => \$opt_with_openssl, - 'ssl' => \$opt_ssl, + 'ssl|with-openssl' => \$opt_ssl, 'skip-ssl' => \$opt_skip_ssl, 'compress' => \$opt_compress, 'bench' => \$opt_bench, @@ -1101,13 +1099,6 @@ sub kill_and_cleanup () { sub check_ssl_support () { - - # Convert deprecated --with-openssl to --ssl - if ( $opt_with_openssl ) - { - $opt_ssl= 1; - } - if ($opt_skip_ssl) { mtr_report("Skipping SSL"); @@ -2597,7 +2588,7 @@ Options to control what test suites or cases to run force Continue to run the suite after failure with-ndbcluster Use cluster, and enable test cases that requres it - skip-ndb[cluster] Use cluster, and enable test cases that requres it + skip-ndb[cluster] Skip the ndb test cases, don't start cluster do-test=PREFIX Run test cases which name are prefixed with PREFIX start-from=PREFIX Run test cases starting from test prefixed with PREFIX suite=NAME Run the test suite named NAME. The default is "main" diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 2508d751b46..0e038cb3f09 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -20,6 +20,10 @@ time_zone_transition_type user show tables; Tables_in_test +connect(localhost,root,z,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) +connect(localhost,root,z,test,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling"; show tables; @@ -43,6 +47,14 @@ time_zone_transition_type user show tables; Tables_in_test +connect(localhost,test,,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) +connect(localhost,test,,"",9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) +connect(localhost,test,zorro,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +connect(localhost,test,zorro,test,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; set password=""; @@ -70,6 +82,14 @@ time_zone_transition_type user show tables; Tables_in_test +connect(localhost,test,,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) +connect(localhost,test,,test,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) +connect(localhost,test,zorro,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +connect(localhost,test,zorro,test,9306,MYSQL_TEST_DIR/var/tmp/master.sock); +ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) delete from mysql.user where user=_binary"test"; flush privileges; create table t1 (id integer not null auto_increment primary key); diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index c643a5ae647..a21ec8de7fb 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -344,6 +344,18 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: Invalid integer argument "a" +mysqltest: At line 1: Syntax error in connect - expected '(' found 'mysqltest: At line 1: Missing connection host +mysqltest: At line 1: Missing connection host +mysqltest: At line 1: Missing connection user +mysqltest: At line 1: Missing connection user +mysqltest: At line 1: Missing connection password +mysqltest: At line 1: Missing connection db +mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db' +mysqltest: At line 1: Illegal argument for port: 'illegal_port' +mysqltest: At line 1: Illegal option to connect: SMTP +mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c +mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool +mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists failing_statement; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1 failing_statement; diff --git a/mysql-test/t/compress.test b/mysql-test/t/compress.test index 45b9ab9dd1e..fb1c8793f33 100644 --- a/mysql-test/t/compress.test +++ b/mysql-test/t/compress.test @@ -3,12 +3,11 @@ -- source include/have_compress.inc -enable_compress; # Reconnect to turn compress on for # default connection disconnect default; -connect (default,localhost,root,,); +connect (default,localhost,root,,,,,COMPRESS); # Check compression turned on SHOW STATUS LIKE 'Compression'; @@ -16,4 +15,3 @@ SHOW STATUS LIKE 'Compression'; # Source select test case -- source t/select.test -disable_compress; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 60ac7b88bbe..0bcd1d76d28 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -1,7 +1,6 @@ # This test is to check various cases of connections -# with right and wrong password, with and without database -# Unfortunately the check is incomplete as we can't handle errors on connect -# Also we can't connect without database +# with right and wrong password, with and without database +# Unfortunately the check is incomplete as we can't connect without database # This test makes no sense with the embedded server --source include/not_embedded.inc @@ -10,69 +9,72 @@ drop table if exists t1,t2; --enable_warnings + #connect (con1,localhost,root,,""); #show tables; connect (con1,localhost,root,,mysql); show tables; -connect (con1,localhost,root,,test); +connect (con2,localhost,root,,test); show tables; -# Re enable this one day if error handling on connect will take place - -#connect (con1,localhost,root,z,test2); -#--error 1045 -#connect (con1,localhost,root,z,); -#--error 1045 +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,root,z,test2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,root,z,); grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling"; # Now check this user with different databases - #connect (con1,localhost,test,gambling,""); #show tables; -connect (con1,localhost,test,gambling,mysql); +connect (con3,localhost,test,gambling,mysql); show tables; -connect (con1,localhost,test,gambling,test); +connect (con4,localhost,test,gambling,test); show tables; -# Re enable this one day if error handling on connect will take place - -#connect (con1,localhost,test,,test2); -#--error 1045 -#connect (con1,localhost,test,,""); -#--error 1045 -#connect (con1,localhost,test,zorro,test2); -#--error 1045 -#connect (con1,localhost,test,zorro,); -#--error 1045 +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,,test2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,,""); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,zorro,test2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,zorro,); # check if old password version also works update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; -#connect (con1,localhost,test,gambling2,""); -#show tables; -connect (con1,localhost,test,gambling2,mysql); +connect (con10,localhost,test,gambling2,); +connect (con5,localhost,test,gambling2,mysql); set password=""; --error 1372 set password='gambling3'; set password=old_password('gambling3'); show tables; -connect (con1,localhost,test,gambling3,test); +connect (con6,localhost,test,gambling3,test); show tables; -# Re enable this one day if error handling on connect will take place - -#connect (con1,localhost,test,,test2); -#--error 1045 -#connect (con1,localhost,test,,); -#--error 1045 -#connect (con1,localhost,test,zorro,test2); -#--error 1045 -#connect (con1,localhost,test,zorro,); -#--error 1045 +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,,test2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,,); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,zorro,test2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--error 1045 +connect (fail_con,localhost,test,zorro,); # remove user 'test' so that other tests which may use 'test' @@ -84,13 +86,13 @@ flush privileges; # # Bug#12517: Clear user variables and replication events before # closing temp tables in thread cleanup. -connect (con2,localhost,root,,test); -connection con2; +connect (con7,localhost,root,,test); +connection con7; create table t1 (id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key); set @id := 1; delete from t1 where id like @id; -disconnect con2; +disconnect con7; --sleep 5 connection default; drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 51cca0a3db1..37c319a24b5 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -498,8 +498,8 @@ drop table t1; # grant select on test.* to mysqltest_4@localhost; -connect (user4,localhost,mysqltest_4,,); -connection user4; +connect (user10261,localhost,mysqltest_4,,); +connection user10261; SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='TABLE_NAME'; connection default; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index eeac2971788..74f5afd8b8b 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -650,6 +650,7 @@ insert into t1 values (10),(11),(12); select * from t1; check table t1; drop table t1; +disconnect con1; # Same test with dynamic record length create table t1 (a int, b varchar(30) default "hello"); @@ -674,8 +675,10 @@ insert into t1 (a) values (10),(11),(12); select a from t1; check table t1; drop table t1; +disconnect con1; set global concurrent_insert=@save_concurrent_insert; + # BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce # different statistics on the same table with NULL values. create table t1 (a int, key(a)); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index c903749839d..1af8560c48b 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -358,11 +358,11 @@ select 3 from t1 ; # Missing delimiter # The comment will be "sucked into" the sleep command since # delimiter is missing until after "show status" ---system echo "sleep 4" > var/log/mysqltest.sql ---system echo "# A comment" >> var/log/mysqltest.sql ---system echo "show status;" >> var/log/mysqltest.sql +--system echo "sleep 4" > var/tmp/mysqltest.sql +--system echo "# A comment" >> var/tmp/mysqltest.sql +--system echo "show status;" >> var/tmp/mysqltest.sql --error 1 ---exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 +--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1 # # Extra delimiter @@ -808,6 +808,66 @@ select "a" as col1, "c" as col2; --error 1 --exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1 +# ---------------------------------------------------------------------------- +# Test connect +# ---------------------------------------------------------------------------- + +--error 1 +--exec echo "connect;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect ();" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2,);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2,localhost);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2, localhost, root);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2, localhost, root,);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1 + +# Repeat connect/disconnect +--exec echo "let \$i=100;" > var/tmp/con.sql +--exec echo "while (\$i)" >> var/tmp/con.sql +--exec echo "{" >> var/tmp/con.sql +--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql +--exec echo " disconnect test_con1; " >> var/tmp/con.sql +--exec echo " dec \$i; " >> var/tmp/con.sql +--exec echo "}" >> var/tmp/con.sql +--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1 + +# Repeat connect/disconnect, exceed max number of connections +--exec echo "let \$i=200;" > var/tmp/con.sql +--exec echo "while (\$i)" >> var/tmp/con.sql +--exec echo "{" >> var/tmp/con.sql +--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql +--exec echo " disconnect test_con1; " >> var/tmp/con.sql +--exec echo " dec \$i; " >> var/tmp/con.sql +--exec echo "}" >> var/tmp/con.sql +--error 1 +--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1 + +# Select disconnected connection +--exec echo "connect (test_con1,localhost,root,,);" > var/tmp/con.sql +--exec echo "disconnect test_con1; " >> var/tmp/con.sql +--exec echo "connection test_con1;" >> var/tmp/con.sql +--error 1 +--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1 + +# Connection name already used +--exec echo "connect (test_con1,localhost,root,,);" > var/tmp/con.sql +--exec echo "connect (test_con1,localhost,root,,);" >> var/tmp/con.sql +--error 1 +--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1 + + # ---------------------------------------------------------------------------- # Test mysqltest arguments diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index e9487425dd7..359b8b69a4d 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -13,11 +13,11 @@ grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; flush privileges; -enable_ssl; -connect (con1,localhost,ssl_user1,,); -connect (con2,localhost,ssl_user2,,); -connect (con3,localhost,ssl_user3,,); -connect (con4,localhost,ssl_user4,,); + +connect (con1,localhost,ssl_user1,,,,,SSL); +connect (con2,localhost,ssl_user2,,,,,SSL); +connect (con3,localhost,ssl_user3,,,,,SSL); +connect (con4,localhost,ssl_user4,,,,,SSL); connection con1; # Check ssl turned on diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 6f1332f80d5..197eede2f52 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -336,6 +336,7 @@ connection user1; do 1; use test; +disconnect user1; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost; drop function bug_9503; diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index d13bec60c2b..921b3262013 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -3,12 +3,10 @@ -- source include/have_openssl.inc -enable_ssl; - # Reconnect to turn ssl on for # default connection disconnect default; -connect (default,localhost,root,,); +connect (default,localhost,root,,,,,SSL); # Check ssl turned on SHOW STATUS LIKE 'Ssl_cipher'; @@ -16,6 +14,5 @@ SHOW STATUS LIKE 'Ssl_cipher'; # Source select test case -- source t/select.test -disable_ssl; diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test index 4a0d3a254ff..2d40b85c33d 100644 --- a/mysql-test/t/ssl_compress.test +++ b/mysql-test/t/ssl_compress.test @@ -4,13 +4,11 @@ -- source include/have_openssl.inc -- source include/have_compress.inc -enable_compress; -enable_ssl; # Reconnect to turn ssl and compress on for # default connection disconnect default; -connect (default,localhost,root,,); +connect (default,localhost,root,,,,,SSL COMPRESS); # Check ssl turned on SHOW STATUS LIKE 'Ssl_cipher'; @@ -21,5 +19,3 @@ SHOW STATUS LIKE 'Compression'; # Source select test case -- source t/select.test -disable_compress; -disable_ssl; |