List:Commits« Previous MessageNext Message »
From:Horst.Hunger Date:January 25 2010 9:06am
Subject:bzr commit into mysql-6.0-codebase branch (horst.hunger:3244)
View as plain text  
#At file:///home/horst/bzr/mysql-6.0-serverqa/ based on revid:horst.hunger@stripped

 3244 Horst.Hunger	2010-01-25
      For testing in main.

    added:
      mysql-test/r/mysql_auto_charset_win.result
      mysql-test/t/mysql_auto_charset_win.test
    modified:
      mysql-test/include/charset_map_unix.inc
=== modified file 'mysql-test/include/charset_map_unix.inc'
--- a/mysql-test/include/charset_map_unix.inc	2010-01-22 15:26:45 +0000
+++ b/mysql-test/include/charset_map_unix.inc	2010-01-25 09:06:00 +0000
@@ -14,6 +14,8 @@ INSERT INTO charset_map_unix values ('bi
 INSERT INTO charset_map_unix values ('big5hkscs',NULL);
 INSERT INTO charset_map_unix values ('cp1251','cp1251');
 INSERT INTO charset_map_unix values ('cp1255','cp1255');
+# Not specified in WL#1349, but on a Linux machine
+INSERT INTO charset_map_unix values ('cp1255','hebrew');
 INSERT INTO charset_map_unix values ('cp866','cp866');
 INSERT INTO charset_map_unix values ('euccn','gb2312');
 INSERT INTO charset_map_unix values ('euccp','ujis');

=== added file 'mysql-test/r/mysql_auto_charset_win.result'

=== added file 'mysql-test/t/mysql_auto_charset_win.test'
--- a/mysql-test/t/mysql_auto_charset_win.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_auto_charset_win.test	2010-01-25 09:06:00 +0000
@@ -0,0 +1,77 @@
+#########################################################################################
+# Test of charset setting in mode auto for mysql on Windows
+# Created: hhunger 2009-04-16
+# The test only checks the charsets which are available in the OS using 
+# the "chcp" (change codepage) commandand that may differ from installation to installation. 
+# The result file of the test is empty if the test succeeds and contains the charset infos
+# of each charset not mapped as specified in the mapping table (see WL#1349). 
+# So, it may run in pushbuild. 
+##########################################################################################
+--source include/windows.inc
+
+# Includes a table containing the charset mapping of  Windows codepage to MySQL charsets
+# (see WL#1349), e.g.
+# INSERT INTO charset_map_windows values ('cp1252','latin1');
+--source include/charset_map_windows.inc
+
+--disable_query_log
+--disable_abort_on_error
+
+# Table that contains the installed codepage/mysql charset combinations.
+CREATE TABLE t_map_check (w_cs varchar(50) key, m_cs varchar(50));
+
+# Determine the installed codepages and insert them into the map check table.
+let $nb_cs=`SELECT count(*) FROM t_charsets`;
+--disable_warnings
+DROP TABLE IF EXISTS t_log;
+--enable_warnings
+CREATE TABLE t_log (c1 varchar(80));
+WHILE ($nb_cs)
+{
+  let $cs= query_get_value(select * from t_charsets, w_cs, $nb_cs);
+  # The message produced by chcp will be put into a table. If the message has the length zero
+  # the chcp command failed (invalid codepage), means the codepage is not installed.
+  --error 0,1
+  --exec chcp $cs > $MYSQLTEST_VARDIR/chcplog.out
+  --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+  --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/chcplog.out' INTO TABLE t_log;
+  --remove_file $MYSQLTEST_VARDIR/chcplog.out
+  # Check if the chcp command was successful and insert the codepage number into 
+  # the map check table.
+  let $tlen = `SELECT length(c1) FROM t_log`;
+  if ($tlen)
+  {
+    --eval INSERT INTO t_map_check VALUES ('$cs', NULL);
+  }
+  DELETE FROM t_log;
+  --dec $nb_cs
+}
+
+# Put the corresponding by MySQL set charset into the map check table.
+let $nb_cs=`SELECT count(*) FROM t_map_check`;
+WHILE ($nb_cs)
+{
+  let $cs= query_get_value(select * from t_map_check, w_cs, $nb_cs);
+  # Suppress out put of chcp.
+  --exec chcp $cs > $MYSQLTEST_VARDIR/chcplog.out
+  --replace_result $MYSQL MYSQL
+  --exec $MYSQL --default-character-set=auto test -e "update t_map_check set m_cs= @@character_set_client where w_cs='$cs'" || true
+ --dec $nb_cs
+}
+--remove_file $MYSQLTEST_VARDIR/chcplog.out
+
+# This SELECT compares the found Windows/MySQL charset combination with those in the included mapping
+# table to find invalid combinations. Only those will be put into the resuklt file, so that the
+# result is empty in case of having a passed test.
+SELECT t_charsets.w_cs, t_charsets.m_cs, t_map_check.w_cs, t_map_check.m_cs  FROM t_charsets, t_map_check WHERE t_charsets.w_cs = t_map_check.w_cs AND t_charsets.m_cs != t_map_check.m_cs;
+
+
+DROP TABLE t_map_check;
+DROP TABLE t_charsets;
+DROP TABLE t_log;
+
+--enable_abort_on_error
+--enable_query_log
+exit;
+
+


Attachment: [text/bzr-bundle] bzr/horst.hunger@sun.com-20100125090600-qu5lk6wu6jp3lpwt.bundle
Thread
bzr commit into mysql-6.0-codebase branch (horst.hunger:3244) Horst.Hunger25 Jan