← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2793: Make test case deterministic by replacing sleep with include/wait_condition.inc

 

------------------------------------------------------------
revno: 2793
committer: knielsen@xxxxxxxxxxxxxxx
branch nick: work
timestamp: Mon 2010-01-11 23:27:39 +0100
message:
  Make test case deterministic by replacing sleep with include/wait_condition.inc
modified:
  mysql-test/t/trigger.test


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'mysql-test/t/trigger.test'
--- mysql-test/t/trigger.test	2009-06-22 12:51:33 +0000
+++ mysql-test/t/trigger.test	2010-01-11 22:27:39 +0000
@@ -1789,18 +1789,28 @@
 SELECT GET_LOCK('B26162',120);
 
 CONNECTION rl_acquirer;
+let $rl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
 --send
 SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
 
 CONNECTION wl_acquirer;
+let $wl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
 SET SESSION LOW_PRIORITY_UPDATES=1;
 SET GLOBAL LOW_PRIORITY_UPDATES=1;
 #need to wait for rl_acquirer to lock on the B26162 lock 
-sleep 2;
+let $wait_condition=
+  SELECT STATE = 'User lock' FROM INFORMATION_SCHEMA.PROCESSLIST
+   WHERE ID = $rl_acquirer_thread_id;
+--source include/wait_condition.inc
 --send
 INSERT INTO t1 VALUES (5);
 
 CONNECTION rl_contender;
+# Wait until wl_acquirer is waiting for the read lock on t2 to be released.
+let $wait_condition=
+  SELECT STATE = 'Locked' FROM INFORMATION_SCHEMA.PROCESSLIST
+   WHERE ID = $wl_acquirer_thread_id;
+--source include/wait_condition.inc
 # must not "see" the row inserted by the INSERT (as it must run before the
 # INSERT)
 --send