summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/check_utf8_cli.inc3
-rw-r--r--mysql-test/include/check_windows_admin.inc3
-rw-r--r--mysql-test/include/no_utf8_cli.inc3
-rw-r--r--mysql-test/main/charset_client_win.test1
-rw-r--r--mysql-test/main/charset_client_win_utf8mb4.result6
-rw-r--r--mysql-test/main/charset_client_win_utf8mb4.test22
-rw-r--r--mysql-test/main/grant_utf8_cli.result (renamed from mysql-test/main/grant_not_windows.result)0
-rw-r--r--mysql-test/main/grant_utf8_cli.test (renamed from mysql-test/main/grant_not_windows.test)3
-rw-r--r--mysql-test/main/mysql_install_db_win_utf8.result14
-rw-r--r--mysql-test/main/mysql_install_db_win_utf8.test35
-rw-r--r--mysql-test/main/winservice.inc75
-rw-r--r--mysql-test/main/winservice_basic.result12
-rw-r--r--mysql-test/main/winservice_basic.test5
-rw-r--r--mysql-test/main/winservice_i18n.result12
-rw-r--r--mysql-test/main/winservice_i18n.test7
-rw-r--r--mysql-test/suite.pm25
16 files changed, 224 insertions, 2 deletions
diff --git a/mysql-test/include/check_utf8_cli.inc b/mysql-test/include/check_utf8_cli.inc
new file mode 100644
index 00000000000..a1fac216446
--- /dev/null
+++ b/mysql-test/include/check_utf8_cli.inc
@@ -0,0 +1,3 @@
+# Check if utf8 can be used on the command line for --exec
+# The real check is done in the suite.pm
+#
diff --git a/mysql-test/include/check_windows_admin.inc b/mysql-test/include/check_windows_admin.inc
new file mode 100644
index 00000000000..44a8b71a19f
--- /dev/null
+++ b/mysql-test/include/check_windows_admin.inc
@@ -0,0 +1,3 @@
+# Check if current user is Windows admin
+# Used for testing services with mysql_install_db.exe
+# Actual value is set by suite.pm
diff --git a/mysql-test/include/no_utf8_cli.inc b/mysql-test/include/no_utf8_cli.inc
new file mode 100644
index 00000000000..19f9aa6df42
--- /dev/null
+++ b/mysql-test/include/no_utf8_cli.inc
@@ -0,0 +1,3 @@
+# Check if utf8 can't be used on the command line for --exec
+# The real check is done in the suite.pm
+#
diff --git a/mysql-test/main/charset_client_win.test b/mysql-test/main/charset_client_win.test
index b4a21d4f0a4..c3f649cb7d4 100644
--- a/mysql-test/main/charset_client_win.test
+++ b/mysql-test/main/charset_client_win.test
@@ -1,2 +1,3 @@
--source include/windows.inc
+--source include/no_utf8_cli.inc
--exec chcp 1257 > NUL && $MYSQL --default-character-set=auto -e "select @@character_set_client"
diff --git a/mysql-test/main/charset_client_win_utf8mb4.result b/mysql-test/main/charset_client_win_utf8mb4.result
new file mode 100644
index 00000000000..9bbf751e45c
--- /dev/null
+++ b/mysql-test/main/charset_client_win_utf8mb4.result
@@ -0,0 +1,6 @@
+@@character_set_client
+utf8mb4
+ERROR 1045 (28000): Access denied for user 'u'@'localhost' (using password: YES)
+2
+2
+DROP user u;
diff --git a/mysql-test/main/charset_client_win_utf8mb4.test b/mysql-test/main/charset_client_win_utf8mb4.test
new file mode 100644
index 00000000000..e08afa250bd
--- /dev/null
+++ b/mysql-test/main/charset_client_win_utf8mb4.test
@@ -0,0 +1,22 @@
+--source include/windows.inc
+--source include/check_utf8_cli.inc
+--exec $MYSQL --default-character-set=auto -e "select @@character_set_client"
+
+# Test that a user with old, non-UTF8 password can still connect
+# by setting setting non-auto --default-character-set
+# This is important for backward compatibility
+
+# Emulate creating password in an interactive client session, with older clients
+# which communicates with the server using with something like cp850
+
+exec chcp 850 > NUL && echo CREATE USER 'u' IDENTIFIED by 'ü' | $MYSQL --default-character-set=cp850;
+
+
+# Can't connect with UTF8
+--error 1
+exec $MYSQL --default-character-set=auto --user=u --password=ü -e "select 1" 2>&1;
+
+# Can connect with tweaked --default-character-set
+exec $MYSQL --default-character-set=cp850 --user=u --password=ü -e "select 2";
+DROP user u;
+
diff --git a/mysql-test/main/grant_not_windows.result b/mysql-test/main/grant_utf8_cli.result
index fedfaf984b2..fedfaf984b2 100644
--- a/mysql-test/main/grant_not_windows.result
+++ b/mysql-test/main/grant_utf8_cli.result
diff --git a/mysql-test/main/grant_not_windows.test b/mysql-test/main/grant_utf8_cli.test
index 55b09232edc..bc811d5298e 100644
--- a/mysql-test/main/grant_not_windows.test
+++ b/mysql-test/main/grant_utf8_cli.test
@@ -1,6 +1,5 @@
- # UTF8 parameters to mysql client do not work on Windows
---source include/not_windows.inc
--source include/not_embedded.inc
+--source include/check_utf8_cli.inc
#
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
diff --git a/mysql-test/main/mysql_install_db_win_utf8.result b/mysql-test/main/mysql_install_db_win_utf8.result
new file mode 100644
index 00000000000..744c982b291
--- /dev/null
+++ b/mysql-test/main/mysql_install_db_win_utf8.result
@@ -0,0 +1,14 @@
+Running bootstrap
+Creating my.ini file
+Removing default user
+Allowing remote access for user root
+Setting root password
+Creation of the database was successful
+# Kill the server
+connect con1,localhost,root,パスワード,mysql;
+SELECT @@datadir;
+@@datadir
+DATADIR/
+# Kill the server
+connection default;
+# restart
diff --git a/mysql-test/main/mysql_install_db_win_utf8.test b/mysql-test/main/mysql_install_db_win_utf8.test
new file mode 100644
index 00000000000..fc67b66d3ca
--- /dev/null
+++ b/mysql-test/main/mysql_install_db_win_utf8.test
@@ -0,0 +1,35 @@
+--source include/windows.inc
+--source include/check_utf8_cli.inc
+
+# Create database in tmp directory using mysql_install_db.exe,
+# and start server from this directory.
+let $ddir= $MYSQLTEST_VARDIR/tmp/датадир;
+--error 0,1
+rmdir $ddir;
+exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=パスワード -R;
+--source include/kill_mysqld.inc
+
+# Note "restart" via MTR does not work, if server's command line has
+# non-ASCII characters used (or, characters outside of ANSI codepage).
+# This is a perl limitation, which is worked around in this test -
+# the server started in background, via exec $MYSQLD
+
+--replace_result $MYSQLD MYSQLD $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --datadir=$ddir --loose-innodb > NUL 2>&1 &;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+connect (con1,localhost,root,パスワード,mysql);
+
+# Smoke test - check that we're actually using datadir
+# we've created (i.e restart_parameters worked)
+--replace_result $ddir DATADIR
+SELECT @@datadir;
+# restart in the original datadir again
+--source include/kill_mysqld.inc
+rmdir $ddir;
+
+connection default;
+--source include/start_mysqld.inc
+
diff --git a/mysql-test/main/winservice.inc b/mysql-test/main/winservice.inc
new file mode 100644
index 00000000000..42aab645cc8
--- /dev/null
+++ b/mysql-test/main/winservice.inc
@@ -0,0 +1,75 @@
+source include/check_windows_admin.inc;
+
+# The test uses return code from sc.exe utility, which are as follows
+let $ERROR_SERVICE_DOES_NOT_EXIST= 1060;
+let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop
+let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped
+
+let $sc_exe= C:\Windows\System32\sc.exe;
+let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name;
+let $service_name=$service_name_prefix$MASTER_MYPORT;
+
+
+error 0,1;
+rmdir $ddir;
+
+--disable_result_log
+error 0,$ERROR_SERVICE_DOES_NOT_EXIST;
+exec $sc_exe delete $service_name;
+--enable_result_log
+
+source include/kill_mysqld.inc;
+echo # run mysql_install_db with --service parameter;
+--disable_result_log
+exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name -R;
+--enable_result_log
+
+echo # Start service;
+--disable_result_log
+exec $sc_exe start $service_name;
+--enable_result_log
+
+enable_reconnect;
+source include/wait_until_connected_again.inc;
+disable_reconnect;
+
+echo # Connect with root user password=$password;
+connect (con1,localhost,root,$password,mysql);
+
+# Smoke test - check that we're actually using datadir
+# we've created (i.e restart_parameters worked)
+replace_result $ddir DATADIR;
+select @@datadir;
+
+echo # Stop service and wait until it is down;
+
+# stop service
+--disable_result_log
+exec $sc_exe stop $service_name;
+# Wait until stopped
+let $sys_errno=0;
+while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
+{
+ --error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE
+ exec $sc_exe stop $service_name;
+ if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
+ {
+ --real_sleep 0.1
+ }
+}
+--enable_result_log
+
+echo # Delete service;
+let $sys_errno=0;
+--disable_result_log
+exec $sc_exe delete $service_name;
+--enable_result_log
+
+# Cleanup
+source include/wait_until_disconnected.inc;
+rmdir $ddir;
+
+#restart original server
+connection default;
+source include/start_mysqld.inc;
+
diff --git a/mysql-test/main/winservice_basic.result b/mysql-test/main/winservice_basic.result
new file mode 100644
index 00000000000..a4de0080207
--- /dev/null
+++ b/mysql-test/main/winservice_basic.result
@@ -0,0 +1,12 @@
+# Kill the server
+# run mysql_install_db with --service parameter
+# Start service
+# Connect with root user password=password
+connect con1,localhost,root,$password,mysql;
+select @@datadir;
+@@datadir
+DATADIR/
+# Stop service and wait until it is down
+# Delete service
+connection default;
+# restart
diff --git a/mysql-test/main/winservice_basic.test b/mysql-test/main/winservice_basic.test
new file mode 100644
index 00000000000..33d072b4f70
--- /dev/null
+++ b/mysql-test/main/winservice_basic.test
@@ -0,0 +1,5 @@
+source include/windows.inc;
+let $datadir_name=data;
+let $service_name_prefix=mariadb;
+let $password=password;
+source winservice.inc;
diff --git a/mysql-test/main/winservice_i18n.result b/mysql-test/main/winservice_i18n.result
new file mode 100644
index 00000000000..873f0828b1f
--- /dev/null
+++ b/mysql-test/main/winservice_i18n.result
@@ -0,0 +1,12 @@
+# Kill the server
+# run mysql_install_db with --service parameter
+# Start service
+# Connect with root user password=パスワード
+connect con1,localhost,root,$password,mysql;
+select @@datadir;
+@@datadir
+DATADIR/
+# Stop service and wait until it is down
+# Delete service
+connection default;
+# restart
diff --git a/mysql-test/main/winservice_i18n.test b/mysql-test/main/winservice_i18n.test
new file mode 100644
index 00000000000..c63b38fd2b8
--- /dev/null
+++ b/mysql-test/main/winservice_i18n.test
@@ -0,0 +1,7 @@
+source include/windows.inc;
+source include/check_utf8_cli.inc;
+
+let $datadir_name=датадир;
+let $service_name_prefix=mariadb_sörvis;
+let $password=パスワード;
+source winservice.inc;
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index 4cc6b410fa1..f30cc5ec431 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -87,6 +87,31 @@ sub skip_combinations {
$skip{'main/ssl_verify_ip.test'} = 'x509v3 support required'
unless $openssl_ver ge "1.0.2";
+ sub utf8_command_line_ok() {
+ if (IS_WINDOWS) {
+ # Can use UTF8 on command line since Windows 10 1903 (10.0.18362)
+ # or if OS codepage is set to UTF8
+ my($os_name, $os_major, $os_minor, $os_build, $os_id) = Win32::GetOSVersion();
+ if($os_major lt 10){
+ return 0;
+ } elsif($os_major gt 10 or $os_minor gt 0 or $os_build ge 18362){
+ return 1;
+ } elsif(Win32::GetACP() eq 65001) {
+ return 1;
+ }
+ return 0;
+ }
+ return 1;
+ }
+
+ $skip{'include/check_utf8_cli.inc'} = 'No utf8 command line support'
+ unless utf8_command_line_ok();
+
+ $skip{'include/no_utf8_cli.inc'} = 'Not tested with utf8 command line support'
+ unless !utf8_command_line_ok();
+
+ $skip{'include/check_windows_admin.inc'} = 'Requires admin privileges'
+ unless IS_WINDOWS and Win32::IsAdminUser();
%skip;
}