#At file:///work/bzr/mysql-5.1-sys-var/
2730 Horst Hunger 2008-08-28
Fix for bug#36873: Simplified the test and replaced all sleeps by polling.
modified:
mysql-test/r/wait_timeout_func.result
mysql-test/t/wait_timeout_func.test
=== modified file 'mysql-test/r/wait_timeout_func.result'
--- a/mysql-test/r/wait_timeout_func.result 2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/wait_timeout_func.result 2008-08-28 14:46:48 +0000
@@ -1,30 +1,21 @@
-drop table if exists t1;
-## Creating new table t1 ##
-CREATE TABLE t1
-(
-id INT NOT NULL auto_increment,
-PRIMARY KEY (id),
-name VARCHAR(30)
-);
+SET @start_value= @@global.wait_timeout;
'#--------------------FN_DYNVARS_186_01-------------------------#'
-## Creating new connection test_con1 ##
-## Setting value of variable to 5 ##
-SET @@session.wait_timeout = 5;
-## Inserting record in table t1 ##
-INSERT into t1(name) values('Record_1');
-## Using sleep to check timeout ##
-'#--------------------FN_DYNVARS_186_02-------------------------#'
-## Setting value of variable ##
-SET @@global.wait_timeout = 5;
-## Creating new connection test_con2 ##
-INSERT into t1(name) values('Record_2');
-## Using sleep to check timeout ##
+SET @start_time= CURTIME();
+connect (test_con1, localhost, root,,);
+SET @@session.wait_timeout = 2;
+connect (test_con2, localhost, root,,);
+SET @@session.wait_timeout = 1;
+SELECT info FROM information_schema.processlist;
+info
+SELECT info FROM information_schema.processlist
'#--------------------FN_DYNVARS_186_03-------------------------#'
-## Setting value of variable to 1 ##
-SET @@global.wait_timeout = 1;
-## Creating new connection ##
-INSERT into t1(name) values('Record_3');
-## Using sleep to check timeout ##
-## We cannot test it further because the server stops due to wait_timeout ##
-SELECT * from t1;
-ERROR HY000: MySQL server has gone away
+SET @@global.wait_timeout = 2;
+connect (test_con3, localhost, root,,);
+connection default;
+SELECT info FROM information_schema.processlist;
+info
+SELECT info FROM information_schema.processlist
+SELECT TIMEDIFF(@start_time,CURTIME()) >= 4;
+TIMEDIFF(@start_time,CURTIME()) >= 4
+1
+SET @@global.wait_timeout= @start_value;
=== modified file 'mysql-test/t/wait_timeout_func.test'
--- a/mysql-test/t/wait_timeout_func.test 2008-04-11 19:59:33 +0000
+++ b/mysql-test/t/wait_timeout_func.test 2008-08-28 14:46:48 +0000
@@ -11,6 +11,8 @@
# Creation Date: 2008-03-07 #
# Author: Salman Rawala #
# #
+# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
+# #
# Description: Test Cases of Dynamic System Variable wait_timeout #
# that checks the functionality of this variable #
# #
@@ -21,83 +23,48 @@
--source include/not_embedded.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-##############################
-# Creating two new tables #
-##############################
-
---echo ## Creating new table t1 ##
-CREATE TABLE t1
-(
-id INT NOT NULL auto_increment,
-PRIMARY KEY (id),
-name VARCHAR(30)
-);
-
+SET @start_value= @@global.wait_timeout;
--echo '#--------------------FN_DYNVARS_186_01-------------------------#'
#######################################################################
-# Setting initial value of interactive_timeout greater than sleep and
-# verifying its behavior on session scope
+# 1. test of scope session
#######################################################################
---echo ## Creating new connection test_con1 ##
+SET @start_time= CURTIME();
+--echo connect (test_con1, localhost, root,,);
connect (test_con1, localhost, root,,);
connection test_con1;
---echo ## Setting value of variable to 5 ##
-SET @@session.wait_timeout = 5;
-
---echo ## Inserting record in table t1 ##
-INSERT into t1(name) values('Record_1');
-
---echo ## Using sleep to check timeout ##
-sleep 4;
+SET @@session.wait_timeout = 2;
-
---echo '#--------------------FN_DYNVARS_186_02-------------------------#'
-#######################################################################
-# Setting initial value of interactive_timeout greater than sleep and
-# verifying its behavior on global scope
-#######################################################################
-
---echo ## Setting value of variable ##
-SET @@global.wait_timeout = 5;
-
---echo ## Creating new connection test_con2 ##
+--echo connect (test_con2, localhost, root,,);
connect (test_con2, localhost, root,,);
connection test_con2;
-INSERT into t1(name) values('Record_2');
-
---echo ## Using sleep to check timeout ##
-sleep 4;
-
-
+SET @@session.wait_timeout = 1;
+connection default;
+let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
--echo '#--------------------FN_DYNVARS_186_03-------------------------#'
#######################################################################
-# Setting initial value of interactive_timeout less than sleep and
-# verifying its behavior on global scope
+# 2. test of scope global
#######################################################################
---echo ## Setting value of variable to 1 ##
-SET @@global.wait_timeout = 1;
+SET @@global.wait_timeout = 2;
---echo ## Creating new connection ##
+--echo connect (test_con3, localhost, root,,);
connect (test_con3, localhost, root,,);
connection test_con3;
-INSERT into t1(name) values('Record_3');
-
---echo ## Using sleep to check timeout ##
-sleep 5;
+--echo connection default;
+connection default;
+let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
---echo ## We cannot test it further because the server stops due to wait_timeout ##
---Error 2006
-SELECT * from t1;
+SELECT TIMEDIFF(@start_time,CURTIME()) >= 4;
+SET @@global.wait_timeout= @start_value;
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (horst:2730) Bug#36873 | Horst Hunger | 28 Aug |