# this would need an instrumented ncurses library
source include/not_msan.inc;
source include/not_embedded.inc;
source include/not_windows.inc;
source include/have_innodb.inc;
--echo #
--echo # regression introduced by MDEV-14448
--echo #

write_file $MYSQL_TMP_DIR/mysql_in;
delimiter $
select 1;
$
exit
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
error 0,127;
exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127)
{
  remove_file $MYSQL_TMP_DIR/mysql_in;
  skip no socat;
}
remove_file $MYSQL_TMP_DIR/mysql_in;

--echo # End of 10.4 tests

--echo #
--echo # MDEV-36701 command line client doesn't check session_track information
--echo #
# test old behavior (make sure session tracking didn't break it)
# and new one, that didn't work before
write_file $MYSQL_TMP_DIR/mysql_in;
create database db1;
use db1;
drop database db1;
create database db1;
execute immediate "use db1";
execute immediate "drop database db1";
exit
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
error 0,127;
exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
remove_file $MYSQL_TMP_DIR/mysql_in;

--echo # End of 10.11 tests

--echo #
--echo # MDEV-38922 CLI incorrectly adds "stage done" on REPAIR TABLE output
--echo #
write_file $MYSQL_TMP_DIR/mysql_in;
CREATE TABLE t (c INT) ENGINE=InnoDB;
REPAIR TABLE t;
DROP TABLE t;
exit
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)// /Stage: \d+ of \d+ '.*?'\s+[0-9.]+% of stage done/Stage: X of Y 'Z' P% of stage done/ / +\r//;
error 0,127;
exec socat -t30 EXEC:"$MYSQL test",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127)
{
  remove_file $MYSQL_TMP_DIR/mysql_in;
  skip no socat;
}
remove_file $MYSQL_TMP_DIR/mysql_in;

--echo #
--echo # repair table output in unbuffered (--quick) mode
--echo #
write_file $MYSQL_TMP_DIR/mysql_in;
CREATE TABLE t (c INT) ENGINE=InnoDB;
INSERT INTO t SELECT * FROM seq_1_to_10;
REPAIR TABLE t;
DROP TABLE t;
exit
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)// /Stage: \d+ of \d+ '.*?'\s+[0-9.]+% of stage done/Stage: X of Y 'Z' P% of stage done/ / +\r//;
error 0,127;
exec socat -t30 EXEC:"$MYSQL test -q --quick-max-column-width 6",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127)
{
  remove_file $MYSQL_TMP_DIR/mysql_in;
  skip no socat;
}
remove_file $MYSQL_TMP_DIR/mysql_in;

--echo # End of 11.8 tests
