This patch makes the key_cache test platform independent and not rely on
listing individually all the values for all the platforms.
I've brought this into Drizzle with the mtr2 merge, but this patch is
against latest mysql-5.1 bzr tree.
---
mysql-test/r/key_cache.result | 15 ++++++---------
mysql-test/t/key_cache.test | 13 +++++++------
2 files changed, 13 insertions(+), 15 deletions(-)
Index: mysql-5.1/mysql-test/r/key_cache.result
===================================================================
--- mysql-5.1.orig/mysql-test/r/key_cache.result 2009-06-23 14:58:18.808582542 +1000
+++ mysql-5.1/mysql-test/r/key_cache.result 2009-06-23 14:58:23.839585621 +1000
@@ -88,9 +88,6 @@ create table t2 (p int primary key, i in
show status like 'key_blocks_used';
Variable_name Value
Key_blocks_used 0
-show status like 'key_blocks_unused';
-Variable_name Value
-Key_blocks_unused KEY_BLOCKS_UNUSED
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
(3, 1, 'yyyy'), (4, 3, 'zzzz');
@@ -109,9 +106,9 @@ update t2 set i=2 where i=1;
show status like 'key_blocks_used';
Variable_name Value
Key_blocks_used 4
-show status like 'key_blocks_unused';
-Variable_name Value
-Key_blocks_unused KEY_BLOCKS_UNUSED
+SELECT 4;;
+4
+4
cache index t1 key (`primary`) in keycache1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
@@ -271,9 +268,9 @@ drop table t1,t2,t3;
show status like 'key_blocks_used';
Variable_name Value
Key_blocks_used 4
-show status like 'key_blocks_unused';
-Variable_name Value
-Key_blocks_unused KEY_BLOCKS_UNUSED
+SELECT 0;;
+0
+0
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
Index: mysql-5.1/mysql-test/t/key_cache.test
===================================================================
--- mysql-5.1.orig/mysql-test/t/key_cache.test 2009-06-23 14:58:13.427583518 +1000
+++ mysql-5.1/mysql-test/t/key_cache.test 2009-06-23 14:58:23.839585621 +1000
@@ -71,8 +71,7 @@ show status like 'key_blocks_used';
# Following results differs on 64 and 32 bit systems because of different
# pointer sizes, which takes up different amount of space in key cache
---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED
1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
-show status like 'key_blocks_unused';
+let $initial_key_blocks_unused = `show status like 'key_blocks_unused'`;
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
@@ -84,8 +83,9 @@ update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
show status like 'key_blocks_used';
---replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED
1814 KEY_BLOCKS_UNUSED 1820 KEY_BLOCKS_UNUSED
-show status like 'key_blocks_unused';
+let $used_key_blocks_unused = `show status like 'key_blocks_unused'`;
+let $r = `SELECT REPLACE('$initial_key_blocks_unused','Key_blocks_unused','') -
REPLACE('$used_key_blocks_unused','Key_blocks_unused','') as r`;
+--eval SELECT $r;
cache index t1 key (`primary`) in keycache1;
@@ -146,8 +146,9 @@ cache index t1,t2 in default;
drop table t1,t2,t3;
show status like 'key_blocks_used';
---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED
1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
-show status like 'key_blocks_unused';
+let $final_key_blocks_unused = `show status like 'key_blocks_unused'`;
+let $r = `SELECT REPLACE('$initial_key_blocks_unused','Key_blocks_unused','') -
REPLACE('$final_key_blocks_unused','Key_blocks_unused','') AS r`;
+--eval SELECT $r;
# Cleanup
--
Stewart Smith