Browse Source

MDEV-37483 - fix output differences Linux vs Windows in the test

- Do not mix latin1 and utf8 in the test and result file.
  Not only it looks strange, and it does not work on Windows either.

- Fix --default-character-set usage in mariadb-import.
  Prior to patch   it was just using platform default when communicating
  with server. Now, it uses the charset provided by the option.

- Use --default-character-set=utf8mb4 in test, to have
  uniform output across different OSes.
bb-10.6-MDEV-35511
Vladislav Vaintroub 1 month ago
committed by Oleksandr Byelkin
parent
commit
2ccf6a245f
  1. 6
      client/mysqlimport.c
  2. 23
      mysql-test/main/mysqldump.result
  3. 23
      mysql-test/main/mysqldump.test

6
client/mysqlimport.c

@ -343,8 +343,8 @@ static int write_to_table(char *filename, MYSQL *mysql)
if (strchr(tablename, '@'))
{
uint errors, len;
const char *csname= my_default_csname(); /* see MYSQL_SET_CHARSET_NAME */
CHARSET_INFO *cs= get_charset_by_csname(csname, MY_CS_PRIMARY, MYF(0));
CHARSET_INFO *cs=
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
(uint32)strlen(tablename), &my_charset_filename, &errors);
if (!errors)
@ -498,7 +498,7 @@ static MYSQL *db_connect(char *host, char *database,
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
default_charset= (char *)my_default_csname();
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
"program_name", "mysqlimport");

23
mysql-test/main/mysqldump.result

@ -6627,33 +6627,32 @@ drop table t1;
#
# MDEV-37483 mariadb-dump -T doesn't convert table names
#
set names latin1;
create database foo;
use foo;
create table `con_schöne_grüße` (a int) select 1 as a;
create table `con_schöne_grüße` (a int) select 1 as a;
create table `con` (b int) select 2 as b;
create table `con/bar` (c int) select 3 as c;
create table `con@home` (d int) select 4 as d;
create table `con@fame` (d int) select 4 as d;
drop database foo;
use test;
con@002fbar.sql
con@002fbar.txt
con@@@.sql
con@@@.txt
con@home.sql
con@home.txt
con@fame.sql
con@fame.txt
con_sch@1ine_gr@1o@1je.sql
con_sch@1ine_gr@1o@1je.txt
show tables;
Tables_in_test
con
con/bar
con@home
con_schöne_grüße
con@fame
con_schöne_grüße
test.con: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
test.con/bar: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
test.con@home: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
select * from `con_schöne_grüße`;
test.con@fame: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
select * from `con_schöne_grüße`;
a
1
select * from `con`;
@ -6662,11 +6661,11 @@ b
select * from `con/bar`;
c
3
select * from `con@home`;
select * from `con@fame`;
d
4
drop table `con_schöne_grüße`;
drop table `con_schöne_grüße`;
drop table `con`;
drop table `con/bar`;
drop table `con@home`;
drop table `con@fame`;
# End of 10.6 tests

23
mysql-test/main/mysqldump.test

@ -3039,24 +3039,23 @@ drop table t1;
--echo #
--echo # MDEV-37483 mariadb-dump -T doesn't convert table names
--echo #
set names latin1;
create database foo;
use foo;
create table `con_schöne_grüße` (a int) select 1 as a;
create table `con_schöne_grüße` (a int) select 1 as a;
create table `con` (b int) select 2 as b;
create table `con/bar` (c int) select 3 as c;
create table `con@home` (d int) select 4 as d;
create table `con@fame` (d int) select 4 as d;
exec $MYSQL_DUMP foo --tab $MYSQLTEST_VARDIR/tmp;
drop database foo;
use test;
move_file $MYSQLTEST_VARDIR/tmp/con@0040home.sql $MYSQLTEST_VARDIR/tmp/con@home.sql;
move_file $MYSQLTEST_VARDIR/tmp/con@0040home.txt $MYSQLTEST_VARDIR/tmp/con@home.txt;
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.sql $MYSQLTEST_VARDIR/tmp/con@fame.sql;
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.txt $MYSQLTEST_VARDIR/tmp/con@fame.txt;
list_files $MYSQLTEST_VARDIR/tmp con*;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@@@.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@002fbar.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@home.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@fame.sql;
show tables;
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@@@.txt;
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@002fbar.txt;
@ -3064,16 +3063,16 @@ if (`select @@version like '10.6.%'`) {
# utf8 console output on Windows is fixed in MDEV-26713, until then
--disable_result_log
}
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.txt;
exec $MYSQL_IMPORT --default-character-set=utf8mb4 test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.txt;
--enable_result_log
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@home.txt;
select * from `con_schöne_grüße`;
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@fame.txt;
select * from `con_schöne_grüße`;
select * from `con`;
select * from `con/bar`;
select * from `con@home`;
drop table `con_schöne_grüße`;
select * from `con@fame`;
drop table `con_schöne_grüße`;
drop table `con`;
drop table `con/bar`;
drop table `con@home`;
drop table `con@fame`;
--echo # End of 10.6 tests
Loading…
Cancel
Save