|
| 1 | + |
| 2 | +# Checking if perl Expect module is installed on the system. |
| 3 | +# If not, the test will be skipped. |
| 4 | +--source include/have_expect.inc |
| 5 | +--source include/not_windows.inc |
| 6 | + |
| 7 | +--echo # |
| 8 | +--echo # Bug#33619511: MySQL server exits in debug build when -p parameter used |
| 9 | +--echo # |
| 10 | + |
| 11 | +# No $ sign before the name to make it visible in Perl code below |
| 12 | +--let MYSQLD_ARGS = --datadir=$MYSQLD_DATADIR --secure-file-priv="" -p |
| 13 | +--let MYSQLD_LOG = $MYSQL_TMP_DIR/bug33619511_log.txt |
| 14 | + |
| 15 | +# Start a custom mysqld instance and interactively fill up the dummy password. |
| 16 | +# Server should exit with "[Server] Aborting" |
| 17 | +--perl |
| 18 | + |
| 19 | +use strict; |
| 20 | +require Expect; |
| 21 | + |
| 22 | +# 1. Start the server |
| 23 | +# The server should enter password prompt, we'll type a password 'a'. |
| 24 | +# Use "log_stdout(0)" to avoid leaking output to record file because it contains timestamps and custom paths. |
| 25 | +my $texp = new Expect(); |
| 26 | +$texp->raw_pty(1); |
| 27 | +$texp->log_stdout(0); |
| 28 | +$texp->log_file("$ENV{MYSQLD_LOG}", "w"); |
| 29 | +$texp->spawn("$ENV{MYSQLD} $ENV{MYSQLD_ARGS}"); |
| 30 | +$texp->expect(15,' -re ',[ 'Enter password:' => sub { |
| 31 | + $texp->send("a\n");}]) or die "Error sending the password"; |
| 32 | + |
| 33 | +$texp->soft_close(); |
| 34 | + |
| 35 | +EOF |
| 36 | + |
| 37 | +--echo # Expect log that proves the server clean exit |
| 38 | +--let SEARCH_FILE = $MYSQLD_LOG |
| 39 | +--let SEARCH_PATTERN=\[ERROR\] \[MY-[0-9]+] \[Server\] Aborting |
| 40 | +--source include/search_pattern.inc |
| 41 | + |
| 42 | +# Cleanup |
| 43 | +--remove_file $MYSQLD_LOG |
0 commit comments