MySQL 8.3.0
Source Code Documentation
mysqltest.cc File Reference

mysqltest client - Tool used for executing a .test file. More...

#include "client/client_query_attributes.h"
#include "client/mysqltest/error_names.h"
#include "client/mysqltest/expected_errors.h"
#include "client/mysqltest/expected_warnings.h"
#include "client/mysqltest/logfile.h"
#include "client/mysqltest/regular_expressions.h"
#include "client/mysqltest/secondary_engine.h"
#include "client/mysqltest/utils.h"
#include "compression.h"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <limits>
#include <new>
#include <sstream>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <mysql_async.h>
#include <mysql_version.h>
#include <mysqld_error.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <poll.h>
#include <sys/time.h>
#include <sys/wait.h>
#include "caching_sha2_passwordopt-vars.h"
#include "client/client_priv.h"
#include "m_string.h"
#include "map_helpers.h"
#include "mf_wcomp.h"
#include "my_compiler.h"
#include "my_config.h"
#include "my_dbug.h"
#include "my_default.h"
#include "my_dir.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_openssl_fips.h"
#include "my_pointer_arithmetic.h"
#include "my_stacktrace.h"
#include "my_systime.h"
#include "my_thread_local.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "nulls.h"
#include "prealloced_array.h"
#include "print_version.h"
#include "sql_common.h"
#include "str2int.h"
#include "strmake.h"
#include "strxmov.h"
#include "template_utils.h"
#include "typelib.h"
#include "violite.h"
#include "welcome_copyright_notice.h"
#include "sslopt-vars.h"
#include "caching_sha2_passwordopt-longopts.h"
#include "sslopt-longopts.h"
#include "sslopt-case.h"

Classes

struct  Property
 Info on properties that can be set with '–disable_X' and '–disable_X' commands. More...
 
struct  st_block
 
struct  st_test_file
 
struct  Parser
 
struct  MasterPos
 
struct  VAR
 
struct  var_free
 
struct  st_connection
 
struct  st_command
 
class  AsyncTimer
 
struct  command_arg
 
struct  POINTER_ARRAY
 
struct  REPLACE
 
struct  REPLACE_STRING
 
struct  REP_SET
 
struct  REP_SETS
 
struct  FOUND_SET
 
struct  FOLLOWS
 
class  Comp_lines
 

Macros

#define SIGNAL_FMT   "signal %d"
 
#define MAX_VAR_NAME_LENGTH   256
 
#define MAX_COLUMNS   256
 
#define MAX_DELIMITER_LENGTH   16
 
#define DEFAULT_MAX_CONN   128
 
#define REPLACE_ROUND_MAX   16
 
#define QUERY_SEND_FLAG   1
 
#define QUERY_REAP_FLAG   2
 
#define APPEND_TYPE(type)
 
#define MAX_QUERY   (256 * 1024 * 2)
 
#define PARSE_REGEX_ARG
 
#define WORD_BIT   (8 * sizeof(uint))
 
#define SET_MALLOC_HUNC   64
 
#define LAST_CHAR_CODE   259
 
#define PC_MALLOC   256 /* Bytes for pointers */
 
#define PS_MALLOC   512 /* Bytes for data */
 

Typedefs

typedef Prealloced_array< st_command *, 1024 > Q_lines
 

Enumerations

enum  {
  OPT_COLORED_DIFF = OPT_MAX_CLIENT_OPTION , OPT_CURSOR_PROTOCOL , OPT_EXPLAIN_PROTOCOL , OPT_HYPERGRAPH ,
  OPT_JSON_EXPLAIN_PROTOCOL , OPT_LOG_DIR , OPT_MARK_PROGRESS , OPT_MAX_CONNECT_RETRIES ,
  OPT_MAX_CONNECTIONS , OPT_NO_SKIP , OPT_OFFLOAD_COUNT_FILE , OPT_PS_PROTOCOL ,
  OPT_RESULT_FORMAT_VERSION , OPT_SP_PROTOCOL , OPT_TAIL_LINES , OPT_TRACE_EXEC ,
  OPT_TRACE_PROTOCOL , OPT_VIEW_PROTOCOL
}
 
enum  enum_prop {
  P_ABORT = 0 , P_CONNECT , P_INFO , P_SESSION_TRACK ,
  P_META , P_PS , P_QUERY , P_RESULT ,
  P_WARN , P_ASYNC , P_MAX
}
 
enum  block_cmd { cmd_none , cmd_if , cmd_while , cmd_assert }
 
enum  enum_commands {
  Q_CONNECTION = 1 , Q_QUERY , Q_CONNECT , Q_SLEEP ,
  Q_INC , Q_DEC , Q_SOURCE , Q_DISCONNECT ,
  Q_LET , Q_ECHO , Q_EXPR , Q_WHILE ,
  Q_END_BLOCK , Q_SAVE_MASTER_POS , Q_SYNC_WITH_MASTER , Q_SYNC_SLAVE_WITH_MASTER ,
  Q_ERROR , Q_SEND , Q_REAP , Q_DIRTY_CLOSE ,
  Q_REPLACE , Q_REPLACE_COLUMN , Q_PING , Q_EVAL ,
  Q_ENABLE_QUERY_LOG , Q_DISABLE_QUERY_LOG , Q_ENABLE_RESULT_LOG , Q_DISABLE_RESULT_LOG ,
  Q_ENABLE_CONNECT_LOG , Q_DISABLE_CONNECT_LOG , Q_WAIT_FOR_SLAVE_TO_STOP , Q_ENABLE_WARNINGS ,
  Q_DISABLE_WARNINGS , Q_ENABLE_INFO , Q_DISABLE_INFO , Q_ENABLE_SESSION_TRACK_INFO ,
  Q_DISABLE_SESSION_TRACK_INFO , Q_ENABLE_METADATA , Q_DISABLE_METADATA , Q_ENABLE_ASYNC_CLIENT ,
  Q_DISABLE_ASYNC_CLIENT , Q_EXEC , Q_EXECW , Q_EXEC_BACKGROUND ,
  Q_DELIMITER , Q_DISABLE_ABORT_ON_ERROR , Q_ENABLE_ABORT_ON_ERROR , Q_DISPLAY_VERTICAL_RESULTS ,
  Q_DISPLAY_HORIZONTAL_RESULTS , Q_QUERY_VERTICAL , Q_QUERY_HORIZONTAL , Q_SORTED_RESULT ,
  Q_PARTIALLY_SORTED_RESULT , Q_LOWERCASE , Q_SKIP_IF_HYPERGRAPH , Q_START_TIMER ,
  Q_END_TIMER , Q_CHARACTER_SET , Q_DISABLE_PS_PROTOCOL , Q_ENABLE_PS_PROTOCOL ,
  Q_DISABLE_RECONNECT , Q_ENABLE_RECONNECT , Q_IF , Q_DISABLE_TESTCASE ,
  Q_ENABLE_TESTCASE , Q_REPLACE_REGEX , Q_REPLACE_NUMERIC_ROUND , Q_REMOVE_FILE ,
  Q_FILE_EXIST , Q_WRITE_FILE , Q_COPY_FILE , Q_PERL ,
  Q_DIE , Q_ASSERT , Q_EXIT , Q_SKIP ,
  Q_CHMOD_FILE , Q_APPEND_FILE , Q_CAT_FILE , Q_DIFF_FILES ,
  Q_SEND_QUIT , Q_CHANGE_USER , Q_MKDIR , Q_RMDIR ,
  Q_FORCE_RMDIR , Q_FORCE_CPDIR , Q_LIST_FILES , Q_LIST_FILES_WRITE_FILE ,
  Q_LIST_FILES_APPEND_FILE , Q_SEND_SHUTDOWN , Q_SHUTDOWN_SERVER , Q_RESULT_FORMAT_VERSION ,
  Q_MOVE_FILE , Q_REMOVE_FILES_WILDCARD , Q_COPY_FILES_WILDCARD , Q_SEND_EVAL ,
  Q_OUTPUT , Q_RESET_CONNECTION , Q_QUERY_ATTRIBUTES , Q_UNKNOWN ,
  Q_COMMENT , Q_COMMENT_WITH_COMMAND , Q_EMPTY_LINE
}
 
enum  arg_type {
  ARG_STRING , ARG_REST , a_int , a_long ,
  a_uint , a_ulong , a_ulong_long , a_float ,
  a_double , a_void , a_string , a_end
}
 
enum  compare_files_result_enum { RESULT_OK = 0 , RESULT_CONTENT_MISMATCH = 1 , RESULT_LENGTH_MISMATCH = 2 }
 
enum  block_op {
  EQ_OP , NE_OP , GT_OP , GE_OP ,
  LT_OP , LE_OP , ILLEG_OP
}
 
enum  enum_operator { DO_DEC , DO_INC }
 

Functions

static void timer_output (void)
 
static ulonglong timer_now (void)
 
const char * get_filename_from_path (const char *path)
 
void replace_strings_append (REPLACE *rep, DYNAMIC_STRING *ds, const char *from, size_t len)
 
static void cleanup_and_exit (int exit_code)
 
void die (const char *fmt,...)
 
void abort_not_supported_test (const char *fmt,...)
 
void verbose_msg (const char *fmt,...)
 
void log_msg (const char *fmt,...)
 
void flush_ds_res ()
 
VARvar_from_env (const char *, const char *)
 
VARvar_init (VAR *v, const char *name, size_t name_len, const char *val, size_t val_len)
 
VARvar_get (const char *var_name, const char **var_name_end, bool raw, bool ignore_not_existing)
 
void eval_expr (VAR *v, const char *p, const char **p_end, bool open_end=false, bool do_eval=true)
 
bool match_delimiter (int c, const char *delim, size_t length)
 
void do_eval (DYNAMIC_STRING *query_eval, const char *query, const char *query_end, bool pass_through_escape_chars)
 
void str_to_file (const char *fname, char *str, size_t size)
 
void str_to_file2 (const char *fname, char *str, size_t size, bool append)
 
void fix_win_paths (const char *val, size_t len)
 
void do_get_replace_column (struct st_command *)
 
void free_replace_column ()
 
static void do_query_attributes (struct st_command *command)
 Set string query attributes for the next query. More...
 
void do_get_replace (struct st_command *command)
 
void free_replace ()
 
void do_get_replace_regex (struct st_command *command)
 
void free_replace_regex ()
 
void do_get_replace_numeric_round (struct st_command *command)
 
void free_replace_numeric_round ()
 
void replace_numeric_round_append (int round, DYNAMIC_STRING *ds, const char *from, size_t len)
 
void check_eol_junk_line (const char *eol)
 
static void var_set (const char *var_name, const char *var_name_end, const char *var_val, const char *var_val_end)
 
static void free_all_replace ()
 
static int socket_event_listen (my_socket fd)
 
static MYSQL_ROW async_mysql_fetch_row_wrapper (MYSQL_RES *res)
 
static MYSQL_RESasync_mysql_store_result_wrapper (MYSQL *mysql)
 
static int async_mysql_real_query_wrapper (MYSQL *mysql, const char *query, ulong length)
 
static int async_mysql_send_query_wrapper (MYSQL *mysql, const char *query, ulong length)
 
static bool async_mysql_read_query_result_wrapper (MYSQL *mysql)
 
static int async_mysql_next_result_wrapper (MYSQL *mysql)
 
static MYSQLasync_mysql_real_connect_wrapper (MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket, ulong client_flag)
 
static int async_mysql_query_wrapper (MYSQL *mysql, const char *query)
 
static void async_mysql_free_result_wrapper (MYSQL_RES *result)
 
static MYSQL_ROW mysql_fetch_row_wrapper (MYSQL_RES *res)
 
static MYSQL_RESmysql_store_result_wrapper (MYSQL *mysql)
 
static int mysql_real_query_wrapper (MYSQL *mysql, const char *query, ulong length)
 
static int mysql_send_query_wrapper (MYSQL *mysql, const char *query, ulong length)
 
static bool mysql_read_query_result_wrapper (MYSQL *mysql)
 
static int mysql_query_wrapper (MYSQL *mysql, const char *query)
 
static int mysql_next_result_wrapper (MYSQL *mysql)
 
static MYSQLmysql_real_connect_wrapper (MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket, ulong client_flag)
 
static void mysql_free_result_wrapper (MYSQL_RES *result)
 
void replace_dynstr_append_mem (DYNAMIC_STRING *ds, const char *val, size_t len)
 
void replace_dynstr_append (DYNAMIC_STRING *ds, const char *val)
 
void replace_dynstr_append_uint (DYNAMIC_STRING *ds, uint val)
 
void dynstr_append_sorted (DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_input, int start_sort_column)
 
void revert_properties ()
 Reset property value to the old value for all properties which are set for the next statement only, i.e properties specified using keyword "ONCE" argument. More...
 
static void show_query (MYSQL *mysql, const char *query)
 
static void show_warnings_before_error (MYSQL *mysql)
 
static void check_command_args (struct st_command *command, char *arguments, const struct command_arg *args, int num_args, const char delimiter_arg)
 
static int match_expected_error (struct st_command *command, std::uint32_t err_errno, const char *err_sqlstate)
 Check whether given error is in list of expected errors. More...
 
void handle_error (struct st_command *command, std::uint32_t err_errno, const char *err_error, const char *err_sqlstate, DYNAMIC_STRING *ds)
 Handle errors which occurred during execution of a query. More...
 
void handle_no_error (struct st_command *command)
 Handle absence of errors after execution. More...
 
static void save_error_code (std::uint32_t error)
 Save error code returned by a mysqltest command in '$__error' variable. More...
 
static void handle_command_error (struct st_command *command, std::uint32_t error)
 Handle errors which occurred during execution of mysqltest commands like 'move_file', 'remove_file' etc which are used to perform file system operations. More...
 
static void close_connections ()
 
static void close_statements ()
 
static void close_files ()
 
static void free_used_memory ()
 
static void print_file_stack ()
 
static int cat_file (DYNAMIC_STRING *ds, const char *filename)
 
static int run_command (char *cmd, DYNAMIC_STRING *ds_res)
 
static int run_tool (const char *tool_path, DYNAMIC_STRING *ds_res,...)
 
static bool is_diff_clean_except_hypergraph (DYNAMIC_STRING *ds)
 See if the diff consists solely of hunks that are due to output lines being replaced with the special hypergraph error text. More...
 
static bool show_diff (DYNAMIC_STRING *ds, const char *filename1, const char *filename2)
 Show the diff of two files using the systems builtin diff command. More...
 
static int compare_files2 (File fd, const char *filename2)
 
static int compare_files (const char *filename1, const char *filename2)
 
static void check_result ()
 
static int strip_surrounding (char *str, char c1, char c2)
 
static void strip_parentheses (struct st_command *command)
 
static void var_check_int (VAR *v)
 
static VARvar_obtain (const char *name, int len)
 
static void var_set_string (const char *name, const char *value)
 
static void var_set_int (const char *name, int value)
 
static void var_set_errno (int sql_errno)
 
static void update_disabled_enabled_warnings_list_var ()
 Variable '$DISABLED_WARNINGS_LIST' contains comma separated list of disabled warnings and variable '$ENABLED_WARNINGS_LIST' contains comma separated list of enabled warnings. More...
 
static void set_once_property (enum_prop property, bool value)
 Set a property value to either 0 or 1 for a disable_X or a enable_X command, and the new value set will be applicable for next statement only. More...
 
static void set_property (st_command *command, enum_prop property, bool value)
 Set a property value to either 0 or 1 for a disable_X or a enable_X command. More...
 
static enum block_op find_operand (const char *start)
 
static void var_query_set (VAR *var, const char *query, const char **query_end)
 
static void set_result_format_version (ulong new_version)
 
static void do_result_format_version (struct st_command *command)
 
static void var_set_convert_error (struct st_command *command, VAR *var)
 Convert between error numbers and error names/strings. More...
 
static void alloc_var (VAR *var, size_t length)
 Allocate memory for the buffer holding the string value of a variable. More...
 
static void var_set_escape (struct st_command *command, VAR *dst)
 Process a "let $variable = escape(CHARACTERS,TEXT)" command. More...
 
static void var_set_query_get_value (struct st_command *command, VAR *var)
 
static void var_copy (VAR *dest, VAR *src)
 
static int open_file (const char *name)
 
static void do_source (struct st_command *command)
 
static FILE * my_popen (DYNAMIC_STRING *ds_cmd, const char *mode, struct st_command *command)
 
static void init_builtin_echo (void)
 
static int replace (DYNAMIC_STRING *ds_str, const char *search_str, size_t search_len, const char *replace_str, size_t replace_len)
 
static void do_exec (struct st_command *command, bool run_in_background)
 Execute the shell command using the popen() library call. More...
 
template<typename T >
static void free_dynamic_strings (T *val)
 Template function that frees memory of the dynamic string passed to the function. More...
 
template<typename T1 , typename... T2>
static void free_dynamic_strings (T1 *first, T2 *... rest)
 Frees the memory of dynamic strings passed to the function. More...
 
static int do_modify_var (struct st_command *command, enum enum_operator op)
 
static void do_remove_file (struct st_command *command)
 Removes the file passed as the argument and retries a specified number of times, if it is unsuccessful. More...
 
static void do_remove_files_wildcard (struct st_command *command)
 Removes the files in the specified directory, by matching the file name pattern. More...
 
static void do_copy_file (struct st_command *command)
 Copy the source file to destination file. More...
 
static int recursive_copy (DYNAMIC_STRING *ds_source, DYNAMIC_STRING *ds_destination)
 
static void do_force_cpdir (struct st_command *command)
 
static void do_copy_files_wildcard (struct st_command *command)
 Copy files from source directory to destination directory, by matching a specified file name pattern. More...
 
static int move_file_by_copy_delete (const char *from, const char *to)
 
static void do_move_file (struct st_command *command)
 Moves a file to destination file. More...
 
static void do_chmod_file (struct st_command *command)
 
static void do_file_exist (struct st_command *command)
 Check if specified file exists. More...
 
static void do_mkdir (struct st_command *command)
 
void do_force_rmdir (struct st_command *command, DYNAMIC_STRING *ds_dirname)
 
static void do_rmdir (struct st_command *command, bool force)
 
static int get_list_files (DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, const DYNAMIC_STRING *ds_wild)
 
static void do_list_files (struct st_command *command)
 
static void do_list_files_write_file_command (struct st_command *command, bool append)
 
static int my_getc (FILE *file)
 
static void my_ungetc (int c)
 
static void read_until_delimiter (DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_delimiter)
 
static void do_write_file_command (struct st_command *command, bool append)
 
static void do_write_file (struct st_command *command)
 
static void do_append_file (struct st_command *command)
 
static void do_cat_file (struct st_command *command)
 
static void do_diff_files (struct st_command *command)
 Compare the two files. More...
 
static struct st_connectionfind_connection_by_name (const char *name)
 
static void do_send_quit (struct st_command *command)
 
static void do_change_user (struct st_command *command)
 
static void do_perl (struct st_command *command)
 
static int do_echo (struct st_command *command)
 
static void do_wait_for_slave_to_stop (struct st_command *c)
 
static void do_sync_with_master2 (struct st_command *command, long offset)
 
static void do_sync_with_master (struct st_command *command)
 
static void ndb_wait_for_binlog_injector (void)
 
static int do_save_master_pos ()
 
static void check_variable_name (const char *var_name, const char *var_name_end, const bool dollar_flag)
 
static bool is_operator (const char *op)
 
static void do_expr (struct st_command *command)
 
static void do_let (struct st_command *command)
 
static int do_sleep (struct st_command *command)
 
static void do_set_charset (struct st_command *command)
 
static bool validate_bug_number_argument (std::string bug_number)
 Check if the bug number argument to disable_testcase is in a proper format. More...
 
static void do_disable_testcase (struct st_command *command)
 Disable or don't execute the statements or commands appear after this command until the execution is enabled by 'enable_testcase' command. More...
 
static bool is_process_active (int pid)
 Check if process is active. More...
 
static bool kill_process (int pid)
 kill process. More...
 
static void abort_process (int pid, const char *path)
 Abort process. More...
 
static void do_shutdown_server (struct st_command *command)
 Shutdown or kill the server. More...
 
const char * eval_warning_argument (struct st_command *command, DYNAMIC_STRING *ds_warnings)
 Evaluate the warning list argument specified with either disable_warnings or enable_warnings command and replace the variables with actual values if there exist any. More...
 
static bool check_and_filter_once_property (DYNAMIC_STRING ds_property, std::string *warn_argument)
 Check if second argument "ONCE" to disable_warnings or enable_warnings command is specified. More...
 
static void handle_disable_warnings (std::uint32_t warning_code, std::string warning, bool once_prop)
 Handle disabling of warnings. More...
 
static void handle_enable_warnings (std::uint32_t warning_code, std::string warning, bool once_prop)
 Handle enabling of warnings. More...
 
static void get_warning_codes (struct st_command *command, std::string warn_argument, bool once_prop)
 Get an error code corresponding to a warning name. More...
 
static bool parse_warning_list_argument (struct st_command *command)
 Parse the warning list argument specified with disable_warnings or enable_warnings command. More...
 
static void do_disable_warnings (struct st_command *command)
 Create a list of disabled warnings that should be suppressed for the next statements until enabled by enable_warnings command. More...
 
static void do_enable_warnings (struct st_command *command)
 Create a list of enabled warnings that should be enabled for the next statements until disabled by disable_warnings command. More...
 
static void do_error (struct st_command *command)
 Create a list of error values that the next statement is expected to return. More...
 
static char * get_string (char **to_ptr, const char **from_ptr, struct st_command *command)
 
static void set_reconnect (MYSQL *mysql, int val)
 
static void set_current_connection (struct st_connection *con)
 Change the current connection to the given st_connection, and update $mysql_get_server_version and $CURRENT_CONNECTION accordingly. More...
 
static void select_connection_name (const char *name)
 
static void select_connection (struct st_command *command)
 
static void do_close_connection (struct st_command *command)
 
static void safe_connect (MYSQL *mysql, const char *name, const char *host, const char *user, const char *pass, const char *db, int port, const char *sock)
 
static int connect_n_handle_errors (struct st_command *command, MYSQL *con, const char *host, const char *user, const char *pass, const char *db, int port, const char *sock)
 Connect to a server and handle connection errors in case they occur. More...
 
static void do_connect (struct st_command *command)
 
static int do_done (struct st_command *command)
 
static void do_block (enum block_cmd cmd, struct st_command *command)
 
static void do_delimiter (struct st_command *command)
 
static void do_reset_connection ()
 
static bool end_of_query (int c)
 
static int read_line (char *buf, int size)
 
static void convert_to_format_v1 (char *query)
 
static void check_eol_junk (const char *eol)
 
static bool is_delimiter (const char *p)
 
static int read_command (struct st_command **command_ptr)
 Create a command from a set of lines. More...
 
static void usage ()
 
static bool get_one_option (int optid, const struct my_option *opt, char *argument)
 
static void validate_filename (const char *file_name)
 Test case or the result file names may use alphanumeric characters (A-Z, a-z, 0-9), dash ('-') or underscore ('_'), but should not start with dash or underscore. More...
 
static int parse_args (int argc, char **argv)
 
static void append_field (DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD *field, char *val, size_t len, bool is_null)
 
static void append_result (DYNAMIC_STRING *ds, MYSQL_RES *res)
 
static void append_stmt_result (DYNAMIC_STRING *ds, MYSQL_STMT *stmt, MYSQL_FIELD *fields, uint num_fields)
 
static void append_metadata (DYNAMIC_STRING *ds, MYSQL_FIELD *field, uint num_fields)
 
static void append_info (DYNAMIC_STRING *ds, ulonglong affected_rows, const char *info)
 
static void append_session_track_info (DYNAMIC_STRING *ds, MYSQL *mysql)
 Append state change information (received through Ok packet) to the output. More...
 
static void append_table_headings (DYNAMIC_STRING *ds, MYSQL_FIELD *field, uint num_fields)
 
static bool match_warnings (Expected_warnings *warnings, std::uint32_t error, bool *warning_found)
 Check whether a given warning is in list of disabled or enabled warnings. More...
 
static bool handle_one_warning (DYNAMIC_STRING *ds, std::string warning)
 Handle one warning which occurred during execution of a query. More...
 
static void handle_warnings (DYNAMIC_STRING *ds, const char *ds_warnings)
 Handle warnings which occurred during execution of a query. More...
 
static int append_warnings (DYNAMIC_STRING *ds, MYSQL *mysql)
 Fetch warnings generated by server while executing a query and append them to warnings buffer 'ds'. More...
 
static void run_query_normal (struct st_connection *cn, struct st_command *command, int flags, const char *query, size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
 Run query using MySQL C API. More...
 
static void run_query_stmt (MYSQL *mysql, struct st_command *command, const char *query, size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
 Run query using prepared statement C API. More...
 
static int util_query (MYSQL *org_mysql, const char *query)
 
static void run_query (struct st_connection *cn, struct st_command *command, int flags)
 
static void display_opt_trace (struct st_connection *cn, struct st_command *command, int flags)
 Display the optimizer trace produced by the last executed statement. More...
 
static void run_explain (struct st_connection *cn, struct st_command *command, int flags, bool json)
 
static void get_command_type (struct st_command *command)
 
static void mark_progress (Logfile *progress_file, int line)
 Record how many milliseconds it took to execute the test file up until the current line and write it to .progress file. More...
 
static void dump_backtrace ()
 
static void signal_handler (int sig)
 
static void init_signal_handling (void)
 
int main (int argc, char **argv)
 
REPLACEinit_replace (const char **from, const char **to, uint count, const char *word_end_chars)
 
int insert_pointer_name (POINTER_ARRAY *pa, char *name)
 
void free_pointer_array (POINTER_ARRAY *pa)
 
static struct st_replace_regexinit_replace_regex (const char *expr)
 Initializes the regular substitution expression to be used in the result output of test. More...
 
int init_sets (REP_SETS *sets, uint states)
 
REP_SETmake_new_set (REP_SETS *sets)
 
void make_sets_invisible (REP_SETS *sets)
 
void free_last_set (REP_SETS *sets)
 
void free_sets (REP_SETS *sets)
 
void internal_set_bit (REP_SET *set, uint bit)
 
void internal_clear_bit (REP_SET *set, uint bit)
 
void or_bits (REP_SET *to, REP_SET *from)
 
void copy_bits (REP_SET *to, REP_SET *from)
 
int cmp_bits (REP_SET *set1, REP_SET *set2)
 
int get_next_bit (REP_SET *set, uint lastpos)
 
int find_set (REP_SETS *sets, REP_SET *find)
 
int find_found (FOUND_SET *found_set, uint table_offset, int found_offset)
 
uint start_at_word (const char *pos)
 
uint end_of_word (const char *pos)
 
static uint replace_len (const char *str)
 
static size_t length_of_n_first_columns (std::string str, int start_sort_column)
 

Variables

CHARSET_INFO my_charset_utf16le_bin
 
Expected_errorsexpected_errors = new Expected_errors()
 
Expected_warningsdisabled_warnings = new Expected_warnings()
 
Expected_warningsenabled_warnings = new Expected_warnings()
 
static int record = 0
 
static char * opt_db = nullptr
 
static char * opt_pass = nullptr
 
const char * opt_user = nullptr
 
const char * opt_host = nullptr
 
const char * unix_sock = nullptr
 
const char * opt_basedir = "./"
 
const char * excluded_string = nullptr
 
static char * shared_memory_base_name = nullptr
 
const char * opt_logdir = ""
 
const char * opt_include = nullptr
 
const char * opt_charsets_dir
 
static int opt_port = 0
 
static int opt_max_connect_retries
 
static int opt_result_format_version
 
static int opt_max_connections = DEFAULT_MAX_CONN
 
static bool backtick_lhs = false
 
static char * opt_init_command = nullptr
 
static bool opt_colored_diff = false
 
static bool opt_compress = false
 
static bool silent = false
 
static bool verbose = false
 
static bool trace_exec = false
 
static bool debug_info_flag = false
 
static bool debug_check_flag = false
 
static bool tty_password = false
 
static bool opt_mark_progress = false
 
static bool ps_protocol = false
 
static bool ps_protocol_enabled = false
 
static bool sp_protocol = false
 
static bool sp_protocol_enabled = false
 
static bool no_skip = false
 
static bool skip_ignored = false
 
static bool view_protocol = false
 
static bool view_protocol_enabled = false
 
static bool opt_trace_protocol = false
 
static bool opt_trace_protocol_enabled = false
 
static bool explain_protocol = false
 
static bool explain_protocol_enabled = false
 
static bool json_explain_protocol = false
 
static bool json_explain_protocol_enabled = false
 
static bool cursor_protocol = false
 
static bool cursor_protocol_enabled = false
 
static bool testcase_disabled = false
 
static bool display_result_vertically = false
 
static bool display_result_lower = false
 
static bool display_metadata = false
 
static bool display_result_sorted = false
 
static bool display_session_track_info = false
 
static bool skip_if_hypergraph = false
 
static int start_sort_column = 0
 
static bool disable_query_log = false
 
static bool disable_result_log = false
 
static bool disable_connect_log = true
 
static bool disable_warnings = false
 
static bool disable_info = true
 
static bool abort_on_error = true
 
static bool server_initialized = false
 
static bool is_windows = false
 
static MEM_ROOT argv_alloc {PSI_NOT_INSTRUMENTED, 512}
 
static const char * load_default_groups [] = {"mysqltest", "client", nullptr}
 
static char line_buffer [MAX_DELIMITER_LENGTH]
 
static char * line_buffer_pos = line_buffer
 
static bool can_handle_expired_passwords = true
 
static bool opt_hypergraph = false
 
static bool use_async_client = false
 
static bool enable_async_client = false
 
static const char * opt_offload_count_file
 
static Secondary_enginesecondary_engine = nullptr
 
static uint opt_zstd_compress_level = default_zstd_compression_level
 
static char * opt_compress_algorithm = nullptr
 
static uint opt_test_ssl_fips_mode = 0
 
Logfile log_file
 
Logfile progress_file
 
static struct Property prop_list []
 
static bool once_property = false
 
static uint start_lineno = 0
 
static uint my_end_arg = 0
 
static uint opt_tail_lines = 0
 
static uint opt_connect_timeout = 0
 
static char delimiter [MAX_DELIMITER_LENGTH] = ";"
 
static size_t delimiter_length = 1
 
static char TMPDIR [FN_REFLEN]
 
static struct st_block block_stack [32]
 
static struct st_blockcur_block
 
static struct st_blockblock_stack_end
 
static struct st_test_file file_stack [16]
 
static struct st_test_filecur_file
 
static struct st_test_filefile_stack_end
 
static const char * default_charset = MYSQL_DEFAULT_CHARSET_NAME
 
CHARSET_INFOcharset_info
 
static char * timer_file = nullptr
 
static ulonglong timer_start
 
static ulong connection_retry_sleep = 100000
 
static char * opt_plugin_dir = nullptr
 
static uint opt_protocol = 0
 
Q_linesq_lines
 
struct Parser parser
 
struct MasterPos master_pos
 
const char * result_file_name = nullptr
 
VAR var_reg [10]
 
collation_unordered_map< std::string, std::unique_ptr< VAR, var_free > > * var_hash
 
struct st_connectionconnections = nullptr
 
struct st_connectioncur_con = nullptr
 
struct st_connectionnext_con
 
struct st_connectionconnections_end
 
const char * command_names []
 
TYPELIB command_typelib
 
DYNAMIC_STRING ds_res
 
DYNAMIC_STRING ds_result
 
DYNAMIC_STRINGds_warn = nullptr
 
struct st_commandcurr_command = nullptr
 
char builtin_echo [FN_REFLEN]
 
struct st_replace_regexglob_replace_regex = nullptr
 
REPLACEglob_replace = nullptr
 
static char * replace_column [MAX_COLUMNS]
 
static uint max_replace_column = 0
 
static int glob_replace_numeric_round = -1
 
static char read_command_buf [MAX_QUERY]
 
static struct my_option my_long_options []
 
static uint found_sets = 0
 

Detailed Description

mysqltest client - Tool used for executing a .test file.

See The MySQL Test Framework for more information.

Macro Definition Documentation

◆ APPEND_TYPE

#define APPEND_TYPE (   type)
Value:
{ \
dynstr_append(ds, "-- "); \
switch (type) { \
dynstr_append(ds, "Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n"); \
break; \
dynstr_append(ds, "Tracker : SESSION_TRACK_SCHEMA\n"); \
break; \
dynstr_append(ds, "Tracker : SESSION_TRACK_STATE_CHANGE\n"); \
break; \
dynstr_append(ds, "Tracker : SESSION_TRACK_GTIDS\n"); \
break; \
dynstr_append( \
ds, "Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n"); \
break; \
dynstr_append(ds, "Tracker : SESSION_TRACK_TRANSACTION_STATE\n"); \
break; \
default: \
dynstr_append(ds, "\n"); \
} \
}
@ SESSION_TRACK_GTIDS
See also: session_track_gtids.
Definition: mysql_com.h:1079
@ SESSION_TRACK_SCHEMA
Current schema.
Definition: mysql_com.h:1077
@ SESSION_TRACK_TRANSACTION_CHARACTERISTICS
Transaction chistics.
Definition: mysql_com.h:1080
@ SESSION_TRACK_TRANSACTION_STATE
Transaction state.
Definition: mysql_com.h:1081
@ SESSION_TRACK_STATE_CHANGE
track session state changes
Definition: mysql_com.h:1078
@ SESSION_TRACK_SYSTEM_VARIABLES
Session system variables.
Definition: mysql_com.h:1076
required string type
Definition: replication_group_member_actions.proto:33

◆ DEFAULT_MAX_CONN

#define DEFAULT_MAX_CONN   128

◆ LAST_CHAR_CODE

#define LAST_CHAR_CODE   259

◆ MAX_COLUMNS

#define MAX_COLUMNS   256

◆ MAX_DELIMITER_LENGTH

#define MAX_DELIMITER_LENGTH   16

◆ MAX_QUERY

#define MAX_QUERY   (256 * 1024 * 2)

◆ MAX_VAR_NAME_LENGTH

#define MAX_VAR_NAME_LENGTH   256

◆ PARSE_REGEX_ARG

#define PARSE_REGEX_ARG
Value:
while (p < expr_end) { \
const char c = *p; \
if (c == '/') { \
if (last_c == '\\') { \
buf_p[-1] = '/'; \
} else { \
*buf_p++ = 0; \
break; \
} \
} else \
*buf_p++ = c; \
\
last_c = c; \
p++; \
}
const char * p
Definition: ctype-mb.cc:1234

◆ PC_MALLOC

#define PC_MALLOC   256 /* Bytes for pointers */

◆ PS_MALLOC

#define PS_MALLOC   512 /* Bytes for data */

◆ QUERY_REAP_FLAG

#define QUERY_REAP_FLAG   2

◆ QUERY_SEND_FLAG

#define QUERY_SEND_FLAG   1

◆ REPLACE_ROUND_MAX

#define REPLACE_ROUND_MAX   16

◆ SET_MALLOC_HUNC

#define SET_MALLOC_HUNC   64

◆ SIGNAL_FMT

#define SIGNAL_FMT   "signal %d"

◆ WORD_BIT

#define WORD_BIT   (8 * sizeof(uint))

Typedef Documentation

◆ Q_lines

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OPT_COLORED_DIFF 
OPT_CURSOR_PROTOCOL 
OPT_EXPLAIN_PROTOCOL 
OPT_HYPERGRAPH 
OPT_JSON_EXPLAIN_PROTOCOL 
OPT_LOG_DIR 
OPT_MARK_PROGRESS 
OPT_MAX_CONNECT_RETRIES 
OPT_MAX_CONNECTIONS 
OPT_NO_SKIP 
OPT_OFFLOAD_COUNT_FILE 
OPT_PS_PROTOCOL 
OPT_RESULT_FORMAT_VERSION 
OPT_SP_PROTOCOL 
OPT_TAIL_LINES 
OPT_TRACE_EXEC 
OPT_TRACE_PROTOCOL 
OPT_VIEW_PROTOCOL 

◆ arg_type

enum arg_type
Enumerator
ARG_STRING 
ARG_REST 
a_int 
a_long 
a_uint 
a_ulong 
a_ulong_long 
a_float 
a_double 
a_void 
a_string 
a_end 

◆ block_cmd

enum block_cmd
Enumerator
cmd_none 
cmd_if 
cmd_while 
cmd_assert 

◆ block_op

enum block_op
Enumerator
EQ_OP 
NE_OP 
GT_OP 
GE_OP 
LT_OP 
LE_OP 
ILLEG_OP 

◆ compare_files_result_enum

Enumerator
RESULT_OK 
RESULT_CONTENT_MISMATCH 
RESULT_LENGTH_MISMATCH 

◆ enum_commands

Enumerator
Q_CONNECTION 
Q_QUERY 
Q_CONNECT 
Q_SLEEP 
Q_INC 
Q_DEC 
Q_SOURCE 
Q_DISCONNECT 
Q_LET 
Q_ECHO 
Q_EXPR 
Q_WHILE 
Q_END_BLOCK 
Q_SAVE_MASTER_POS 
Q_SYNC_WITH_MASTER 
Q_SYNC_SLAVE_WITH_MASTER 
Q_ERROR 
Q_SEND 
Q_REAP 
Q_DIRTY_CLOSE 
Q_REPLACE 
Q_REPLACE_COLUMN 
Q_PING 
Q_EVAL 
Q_ENABLE_QUERY_LOG 
Q_DISABLE_QUERY_LOG 
Q_ENABLE_RESULT_LOG 
Q_DISABLE_RESULT_LOG 
Q_ENABLE_CONNECT_LOG 
Q_DISABLE_CONNECT_LOG 
Q_WAIT_FOR_SLAVE_TO_STOP 
Q_ENABLE_WARNINGS 
Q_DISABLE_WARNINGS 
Q_ENABLE_INFO 
Q_DISABLE_INFO 
Q_ENABLE_SESSION_TRACK_INFO 
Q_DISABLE_SESSION_TRACK_INFO 
Q_ENABLE_METADATA 
Q_DISABLE_METADATA 
Q_ENABLE_ASYNC_CLIENT 
Q_DISABLE_ASYNC_CLIENT 
Q_EXEC 
Q_EXECW 
Q_EXEC_BACKGROUND 
Q_DELIMITER 
Q_DISABLE_ABORT_ON_ERROR 
Q_ENABLE_ABORT_ON_ERROR 
Q_DISPLAY_VERTICAL_RESULTS 
Q_DISPLAY_HORIZONTAL_RESULTS 
Q_QUERY_VERTICAL 
Q_QUERY_HORIZONTAL 
Q_SORTED_RESULT 
Q_PARTIALLY_SORTED_RESULT 
Q_LOWERCASE 
Q_SKIP_IF_HYPERGRAPH 
Q_START_TIMER 
Q_END_TIMER 
Q_CHARACTER_SET 
Q_DISABLE_PS_PROTOCOL 
Q_ENABLE_PS_PROTOCOL 
Q_DISABLE_RECONNECT 
Q_ENABLE_RECONNECT 
Q_IF 
Q_DISABLE_TESTCASE 
Q_ENABLE_TESTCASE 
Q_REPLACE_REGEX 
Q_REPLACE_NUMERIC_ROUND 
Q_REMOVE_FILE 
Q_FILE_EXIST 
Q_WRITE_FILE 
Q_COPY_FILE 
Q_PERL 
Q_DIE 
Q_ASSERT 
Q_EXIT 
Q_SKIP 
Q_CHMOD_FILE 
Q_APPEND_FILE 
Q_CAT_FILE 
Q_DIFF_FILES 
Q_SEND_QUIT 
Q_CHANGE_USER 
Q_MKDIR 
Q_RMDIR 
Q_FORCE_RMDIR 
Q_FORCE_CPDIR 
Q_LIST_FILES 
Q_LIST_FILES_WRITE_FILE 
Q_LIST_FILES_APPEND_FILE 
Q_SEND_SHUTDOWN 
Q_SHUTDOWN_SERVER 
Q_RESULT_FORMAT_VERSION 
Q_MOVE_FILE 
Q_REMOVE_FILES_WILDCARD 
Q_COPY_FILES_WILDCARD 
Q_SEND_EVAL 
Q_OUTPUT 
Q_RESET_CONNECTION 
Q_QUERY_ATTRIBUTES 
Q_UNKNOWN 
Q_COMMENT 
Q_COMMENT_WITH_COMMAND 
Q_EMPTY_LINE 

◆ enum_operator

Enumerator
DO_DEC 
DO_INC 

◆ enum_prop

enum enum_prop
Enumerator
P_ABORT 
P_CONNECT 
P_INFO 
P_SESSION_TRACK 
P_META 
P_PS 
P_QUERY 
P_RESULT 
P_WARN 
P_ASYNC 
P_MAX 

Function Documentation

◆ abort_not_supported_test()

void abort_not_supported_test ( const char *  fmt,
  ... 
)

◆ abort_process()

static void abort_process ( int  pid,
const char *  path 
)
static

Abort process.

Parameters
pidProcess id.
pathPath to create minidump file in.

◆ alloc_var()

static void alloc_var ( VAR var,
size_t  length 
)
static

Allocate memory for the buffer holding the string value of a variable.

Parameters
varThe variable
lengthThe number of string characters, not counting the \0.

◆ append_field()

static void append_field ( DYNAMIC_STRING ds,
uint  col_idx,
MYSQL_FIELD field,
char *  val,
size_t  len,
bool  is_null 
)
static

◆ append_info()

static void append_info ( DYNAMIC_STRING ds,
ulonglong  affected_rows,
const char *  info 
)
static

◆ append_metadata()

static void append_metadata ( DYNAMIC_STRING ds,
MYSQL_FIELD field,
uint  num_fields 
)
static

◆ append_result()

static void append_result ( DYNAMIC_STRING ds,
MYSQL_RES res 
)
static

◆ append_session_track_info()

static void append_session_track_info ( DYNAMIC_STRING ds,
MYSQL mysql 
)
static

Append state change information (received through Ok packet) to the output.

Parameters
[in,out]dsDynamic string to hold the content to be printed.
[in]mysqlConnection handle.

◆ append_stmt_result()

static void append_stmt_result ( DYNAMIC_STRING ds,
MYSQL_STMT stmt,
MYSQL_FIELD fields,
uint  num_fields 
)
static

◆ append_table_headings()

static void append_table_headings ( DYNAMIC_STRING ds,
MYSQL_FIELD field,
uint  num_fields 
)
static

◆ append_warnings()

static int append_warnings ( DYNAMIC_STRING ds,
MYSQL mysql 
)
static

Fetch warnings generated by server while executing a query and append them to warnings buffer 'ds'.

Parameters
dsDYNAMIC_STRING object to store the warnings
mysqlmysql handle object
Return values
Numberof warnings appended to ds

◆ async_mysql_fetch_row_wrapper()

static MYSQL_ROW async_mysql_fetch_row_wrapper ( MYSQL_RES res)
static

◆ async_mysql_free_result_wrapper()

static void async_mysql_free_result_wrapper ( MYSQL_RES result)
static

◆ async_mysql_next_result_wrapper()

static int async_mysql_next_result_wrapper ( MYSQL mysql)
static

◆ async_mysql_query_wrapper()

static int async_mysql_query_wrapper ( MYSQL mysql,
const char *  query 
)
static

◆ async_mysql_read_query_result_wrapper()

static bool async_mysql_read_query_result_wrapper ( MYSQL mysql)
static

◆ async_mysql_real_connect_wrapper()

static MYSQL * async_mysql_real_connect_wrapper ( MYSQL mysql,
const char *  host,
const char *  user,
const char *  passwd,
const char *  db,
uint  port,
const char *  unix_socket,
ulong  client_flag 
)
static

◆ async_mysql_real_query_wrapper()

static int async_mysql_real_query_wrapper ( MYSQL mysql,
const char *  query,
ulong  length 
)
static

◆ async_mysql_send_query_wrapper()

static int async_mysql_send_query_wrapper ( MYSQL mysql,
const char *  query,
ulong  length 
)
static

◆ async_mysql_store_result_wrapper()

static MYSQL_RES * async_mysql_store_result_wrapper ( MYSQL mysql)
static

◆ cat_file()

static int cat_file ( DYNAMIC_STRING ds,
const char *  filename 
)
static

◆ check_and_filter_once_property()

static bool check_and_filter_once_property ( DYNAMIC_STRING  ds_property,
std::string *  warn_argument 
)
static

Check if second argument "ONCE" to disable_warnings or enable_warnings command is specified.

If yes, filter out the keyword "ONCE" from the argument string.

Parameters
ds_propertyDYNAMIC_STRING object containing the second argument
warn_argumentString to store the argument string containing only the list of warnings.
Return values
Trueif the second argument is specified, false otherwise.

◆ check_command_args()

static void check_command_args ( struct st_command command,
char *  arguments,
const struct command_arg args,
int  num_args,
const char  delimiter_arg 
)
static

◆ check_eol_junk()

static void check_eol_junk ( const char *  eol)
static

◆ check_eol_junk_line()

void check_eol_junk_line ( const char *  eol)

◆ check_result()

static void check_result ( )
static

◆ check_variable_name()

static void check_variable_name ( const char *  var_name,
const char *  var_name_end,
const bool  dollar_flag 
)
static

◆ cleanup_and_exit()

static void cleanup_and_exit ( int  exit_code)
static

◆ close_connections()

static void close_connections ( void  )
static

◆ close_files()

static void close_files ( )
static

◆ close_statements()

static void close_statements ( )
static

◆ cmp_bits()

int cmp_bits ( REP_SET set1,
REP_SET set2 
)

◆ compare_files()

static int compare_files ( const char *  filename1,
const char *  filename2 
)
static

◆ compare_files2()

static int compare_files2 ( File  fd,
const char *  filename2 
)
static

◆ connect_n_handle_errors()

static int connect_n_handle_errors ( struct st_command command,
MYSQL con,
const char *  host,
const char *  user,
const char *  pass,
const char *  db,
int  port,
const char *  sock 
)
static

Connect to a server and handle connection errors in case they occur.

This function will try to establish a connection to server and handle possible errors in the same manner as if "connect" was usual SQL-statement. If an error is expected it will ignore it once it occurs and log the "statement" to the query log. Unlike safe_connect() it won't do several attempts.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
conConnection structure to be used
hostHost name
userUser name
passPassword
dbDatabase name
portPort number
sockSocket value
Return values
1if connection succeeds, 0 otherwise

◆ convert_to_format_v1()

static void convert_to_format_v1 ( char *  query)
static

◆ copy_bits()

void copy_bits ( REP_SET to,
REP_SET from 
)

◆ die()

void die ( const char *  fmt,
  ... 
)

◆ display_opt_trace()

static void display_opt_trace ( struct st_connection cn,
struct st_command command,
int  flags 
)
static

Display the optimizer trace produced by the last executed statement.

◆ do_append_file()

static void do_append_file ( struct st_command command)
static

◆ do_block()

static void do_block ( enum block_cmd  cmd,
struct st_command command 
)
static

◆ do_cat_file()

static void do_cat_file ( struct st_command command)
static

◆ do_change_user()

static void do_change_user ( struct st_command command)
static

◆ do_chmod_file()

static void do_chmod_file ( struct st_command command)
static

◆ do_close_connection()

static void do_close_connection ( struct st_command command)
static

◆ do_connect()

static void do_connect ( struct st_command command)
static

◆ do_copy_file()

static void do_copy_file ( struct st_command command)
static

Copy the source file to destination file.

Copy will fail if the destination file exists. Retry of the command can happen optionally with an interval of one second between each retry if the command fails.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_copy_files_wildcard()

static void do_copy_files_wildcard ( struct st_command command)
static

Copy files from source directory to destination directory, by matching a specified file name pattern.

Copy will fail if no files match the pattern. It will fail if source directory is empty and/or there are no files in it. Copy will also fail if source directory or destination directory or both do not exist. Retry of the command can happen optionally with an interval of one second between each retry if the command fails.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_delimiter()

static void do_delimiter ( struct st_command command)
static

◆ do_diff_files()

static void do_diff_files ( struct st_command command)
static

Compare the two files.

Success if 2 files are same, failure if the files are different or either file does not exist.

diff_files <file1> <file2>;
Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_disable_testcase()

static void do_disable_testcase ( struct st_command command)
static

Disable or don't execute the statements or commands appear after this command until the execution is enabled by 'enable_testcase' command.

If test cases are already disabled, then throw an error and abort the test execution.

This command also takes a mandatory parameter specifying the bug number.

--disable_testcase BUG#XXXX
statements or commands
--enable_testcase
commands
Definition: mysql_config_editor.cc:116
Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

Check if the bug number argument to disable_testcase is in a proper format.

◆ do_disable_warnings()

static void do_disable_warnings ( struct st_command command)
static

Create a list of disabled warnings that should be suppressed for the next statements until enabled by enable_warnings command.

disable_warnings command can take an optional argument specifying a warning or a comma separated list of warnings to be disabled. The warnings specified should be in symbolic error name format.

disable_warnings command can also take a second optional argument, which when specified will suppress the warnings for next statement only. The second argument must be a "ONCE" keyword.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_done()

static int do_done ( struct st_command command)
static

◆ do_echo()

static int do_echo ( struct st_command command)
static

◆ do_enable_warnings()

static void do_enable_warnings ( struct st_command command)
static

Create a list of enabled warnings that should be enabled for the next statements until disabled by disable_warnings command.

enable_warnings command can take an optional argument specifying a warning or a comma separated list of warnings to be enabled. The warnings specified should be in symbolic error name format.

enable_warnings command can also take a second optional argument, which when specified will enable the warnings for next statement only. The second argument must be a "ONCE" keyword.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_error()

static void do_error ( struct st_command command)
static

Create a list of error values that the next statement is expected to return.

Each error must be an error number or an SQLSTATE value or a symbolic error name representing an error.

SQLSTATE value must start with 'S'. It is also possible to specify client errors with 'error' command.

--error 1064
--error S42S01
--error ER_TABLE_EXISTS_ERROR,ER_PARSE_ERROR
#define CR_SERVER_GONE_ERROR
Definition: errmsg.h:64
Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_eval()

void do_eval ( DYNAMIC_STRING query_eval,
const char *  query,
const char *  query_end,
bool  pass_through_escape_chars 
)

◆ do_exec()

static void do_exec ( struct st_command command,
bool  run_in_background 
)
static

Execute the shell command using the popen() library call.

References to variables within the command are replaced with the corresponding values. Use “\$” to specify a literal “$” character.

The error code returned from the subprocess is checked against the expected error array, previously set with the –error command. It can thus be used to execute a command that shall fail.

exec command [args]
command
Definition: version_token.cc:279
Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
run_in_backgroundSpecifies if command should be run in background. In such case we don't wait nor attempt to read the output.
Note
It is recommended to use mysqltest command(s) like "remove_file" instead of executing the shell commands using 'exec' command.

◆ do_expr()

static void do_expr ( struct st_command command)
static

◆ do_file_exist()

static void do_file_exist ( struct st_command command)
static

Check if specified file exists.

Retry of the command can happen optionally with an interval of one second between each retry if the command fails.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_force_cpdir()

static void do_force_cpdir ( struct st_command command)
static

◆ do_force_rmdir()

void do_force_rmdir ( struct st_command command,
DYNAMIC_STRING ds_dirname 
)

◆ do_get_replace()

void do_get_replace ( struct st_command command)

◆ do_get_replace_column()

void do_get_replace_column ( struct st_command command)

◆ do_get_replace_numeric_round()

void do_get_replace_numeric_round ( struct st_command command)

◆ do_get_replace_regex()

void do_get_replace_regex ( struct st_command command)

◆ do_let()

static void do_let ( struct st_command command)
static

◆ do_list_files()

static void do_list_files ( struct st_command command)
static

◆ do_list_files_write_file_command()

static void do_list_files_write_file_command ( struct st_command command,
bool  append 
)
static

◆ do_mkdir()

static void do_mkdir ( struct st_command command)
static

◆ do_modify_var()

static int do_modify_var ( struct st_command command,
enum enum_operator  op 
)
static

◆ do_move_file()

static void do_move_file ( struct st_command command)
static

Moves a file to destination file.

Retry of the command can happen optionally with an interval of one second between each retry if the command fails.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_perl()

static void do_perl ( struct st_command command)
static

◆ do_query_attributes()

static void do_query_attributes ( struct st_command command)
static

Set string query attributes for the next query.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command. Optionally including a timeout else the default of 60 seconds

◆ do_remove_file()

static void do_remove_file ( struct st_command command)
static

Removes the file passed as the argument and retries a specified number of times, if it is unsuccessful.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_remove_files_wildcard()

static void do_remove_files_wildcard ( struct st_command command)
static

Removes the files in the specified directory, by matching the file name pattern.

Retry of the command can happen optionally with an interval of one second between each retry if the command fails.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ do_reset_connection()

static void do_reset_connection ( )
static

◆ do_result_format_version()

static void do_result_format_version ( struct st_command command)
static

◆ do_rmdir()

static void do_rmdir ( struct st_command command,
bool  force 
)
static

◆ do_save_master_pos()

static int do_save_master_pos ( )
static

◆ do_send_quit()

static void do_send_quit ( struct st_command command)
static

◆ do_set_charset()

static void do_set_charset ( struct st_command command)
static

◆ do_shutdown_server()

static void do_shutdown_server ( struct st_command command)
static

Shutdown or kill the server.

If timeout is set to 0 the server is killed or terminated immediately. Otherwise the shutdown command is first sent and then it waits for the server to terminate within 'timeout' seconds. If it has not terminated before 'timeout' seconds the command will fail.

Note
Currently only works with local server
Parameters
commandPointer to the st_command structure which holds the arguments and information for the command. Optionally including a timeout else the default of 60 seconds

◆ do_sleep()

static int do_sleep ( struct st_command command)
static

◆ do_source()

static void do_source ( struct st_command command)
static

◆ do_sync_with_master()

static void do_sync_with_master ( struct st_command command)
static

◆ do_sync_with_master2()

static void do_sync_with_master2 ( struct st_command command,
long  offset 
)
static

◆ do_wait_for_slave_to_stop()

static void do_wait_for_slave_to_stop ( struct st_command c)
static

◆ do_write_file()

static void do_write_file ( struct st_command command)
static

◆ do_write_file_command()

static void do_write_file_command ( struct st_command command,
bool  append 
)
static

◆ dump_backtrace()

static void dump_backtrace ( )
static

◆ dynstr_append_sorted()

void dynstr_append_sorted ( DYNAMIC_STRING ds,
DYNAMIC_STRING ds_input,
int  start_sort_column 
)

◆ end_of_query()

static bool end_of_query ( int  c)
static

◆ end_of_word()

uint end_of_word ( const char *  pos)

◆ eval_expr()

void eval_expr ( VAR v,
const char *  p,
const char **  p_end,
bool  open_end = false,
bool  do_eval = true 
)

◆ eval_warning_argument()

const char * eval_warning_argument ( struct st_command command,
DYNAMIC_STRING ds_warnings 
)

Evaluate the warning list argument specified with either disable_warnings or enable_warnings command and replace the variables with actual values if there exist any.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
ds_warningsDYNAMIC_STRING object containing the argument.
Return values
Evaluatedstring after replacing the variables with values.

◆ find_connection_by_name()

static struct st_connection * find_connection_by_name ( const char *  name)
static

◆ find_found()

int find_found ( FOUND_SET found_set,
uint  table_offset,
int  found_offset 
)

◆ find_operand()

static enum block_op find_operand ( const char *  start)
static

◆ find_set()

int find_set ( REP_SETS sets,
REP_SET find 
)

◆ fix_win_paths()

void fix_win_paths ( const char *  val,
size_t  len 
)

◆ flush_ds_res()

void flush_ds_res ( )

◆ free_all_replace()

static void free_all_replace ( )
static

◆ free_dynamic_strings() [1/2]

template<typename T >
static void free_dynamic_strings ( T *  val)
static

Template function that frees memory of the dynamic string passed to the function.

Parameters
valDynamic string whose memory needs to be freed.

◆ free_dynamic_strings() [2/2]

template<typename T1 , typename... T2>
static void free_dynamic_strings ( T1 *  first,
T2 *...  rest 
)
static

Frees the memory of dynamic strings passed to the function.

It accepts a variable number of dynamic strings, and through recursion, frees the memory. The other template function which calls dynstr_free() is called here.

Parameters
firstThe dynamic string passed to the function which gets freed using dynstr_free().
restRest of the dynamic strings which are passed to the function, through recursion, end up being freed by dynstr_free().

◆ free_last_set()

void free_last_set ( REP_SETS sets)

◆ free_pointer_array()

void free_pointer_array ( POINTER_ARRAY pa)

◆ free_replace()

void free_replace ( )

◆ free_replace_column()

void free_replace_column ( )

◆ free_replace_numeric_round()

void free_replace_numeric_round ( )

◆ free_replace_regex()

void free_replace_regex ( )

◆ free_sets()

void free_sets ( REP_SETS sets)

◆ free_used_memory()

static void free_used_memory ( )
static

◆ get_command_type()

static void get_command_type ( struct st_command command)
static

◆ get_filename_from_path()

const char * get_filename_from_path ( const char *  path)

◆ get_list_files()

static int get_list_files ( DYNAMIC_STRING ds,
const DYNAMIC_STRING ds_dirname,
const DYNAMIC_STRING ds_wild 
)
static

◆ get_next_bit()

int get_next_bit ( REP_SET set,
uint  lastpos 
)

◆ get_one_option()

static bool get_one_option ( int  optid,
const struct my_option opt,
char *  argument 
)
static

◆ get_string()

static char * get_string ( char **  to_ptr,
const char **  from_ptr,
struct st_command command 
)
static

◆ get_warning_codes()

static void get_warning_codes ( struct st_command command,
std::string  warn_argument,
bool  once_prop 
)
static

Get an error code corresponding to a warning name.

The warning name specified is in symbolic error name format.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
warn_argumentString containing warning argument
once_propFlag specifying whether a property should be set for next statement only.

◆ handle_command_error()

static void handle_command_error ( struct st_command command,
std::uint32_t  error 
)
static

Handle errors which occurred during execution of mysqltest commands like 'move_file', 'remove_file' etc which are used to perform file system operations.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
errorError number
Note
If there is an unexpected error, this function will abort mysqltest client immediately.

◆ handle_disable_warnings()

static void handle_disable_warnings ( std::uint32_t  warning_code,
std::string  warning,
bool  once_prop 
)
static

Handle disabling of warnings.

  • If all warnings are disabled, don't add the warning to disabled warning list.
  • If there exist enabled warnings, remove the disabled warning from the list of enabled warnings.
  • If all the warnings are enabled or if there exist disabled warnings, add or append the new warning to the list of disabled warnings.
Parameters
warning_codeWarning code
warningWarning string
once_propFlag specifying whether a property should be set for next statement only.

◆ handle_enable_warnings()

static void handle_enable_warnings ( std::uint32_t  warning_code,
std::string  warning,
bool  once_prop 
)
static

Handle enabling of warnings.

  • If all the warnings are enabled, don't add the warning to enabled warning list.
  • If there exist disabled warnings, remove the enabled warning from the list of disabled warnings.
  • If all the warnings are disabled or if there exist enabled warnings, add or append the new warning to the list of enabled warnings.
Parameters
warning_codeWarning code
warningWarning string
once_propFlag specifying whether a property should be set for next statement only.

◆ handle_error()

void handle_error ( struct st_command command,
std::uint32_t  err_errno,
const char *  err_error,
const char *  err_sqlstate,
DYNAMIC_STRING ds 
)

Handle errors which occurred during execution of a query.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
err_errnoError number
err_errorError message
err_sqlstateSQLSTATE that was thrown
dsDynamic string to store the result.
Note
If there is an unexpected error, this function will abort mysqltest immediately.

◆ handle_no_error()

void handle_no_error ( struct st_command command)

Handle absence of errors after execution.

Abort test run if the query succeeds and was expected to fail with an error.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.

◆ handle_one_warning()

static bool handle_one_warning ( DYNAMIC_STRING ds,
std::string  warning 
)
static

Handle one warning which occurred during execution of a query.

Parameters
dsDYNAMIC_STRING object to store the warnings.
warningWarning string
Return values
Trueif a warning is found in the list of disabled or enabled warnings, false otherwise.

◆ handle_warnings()

static void handle_warnings ( DYNAMIC_STRING ds,
const char *  ds_warnings 
)
static

Handle warnings which occurred during execution of a query.

Parameters
dsDYNAMIC_STRING object to store the warnings.
ds_warningsString containing all the generated warnings.

◆ init_builtin_echo()

static void init_builtin_echo ( void  )
static

◆ init_replace()

REPLACE * init_replace ( const char **  from,
const char **  to,
uint  count,
const char *  word_end_chars 
)

◆ init_replace_regex()

static struct st_replace_regex * init_replace_regex ( const char *  expr)
static

Initializes the regular substitution expression to be used in the result output of test.

Parameters
exprPointer to string having regular expression to be used for substitution.
Return values
st_replace_regexstructure with pairs of substitutions.

◆ init_sets()

int init_sets ( REP_SETS sets,
uint  states 
)

◆ init_signal_handling()

static void init_signal_handling ( void  )
static

◆ insert_pointer_name()

int insert_pointer_name ( POINTER_ARRAY pa,
char *  name 
)

◆ internal_clear_bit()

void internal_clear_bit ( REP_SET set,
uint  bit 
)

◆ internal_set_bit()

void internal_set_bit ( REP_SET set,
uint  bit 
)

◆ is_delimiter()

static bool is_delimiter ( const char *  p)
static

◆ is_diff_clean_except_hypergraph()

static bool is_diff_clean_except_hypergraph ( DYNAMIC_STRING ds)
static

See if the diff consists solely of hunks that are due to output lines being replaced with the special hypergraph error text.

If so, return true. An example hunk:

@ -315,45 +211,25 @ SELECT * FROM articles WHERE MATCH(title, body) AGAINST('a' IN BOOLEAN MODE); -id title body -3 foo bar -2 bar baz +<ignored hypergraph optimizer error: The hypergraph optimizer does not yet support 'fulltext search'> SELECT ...

◆ is_operator()

static bool is_operator ( const char *  op)
static

◆ is_process_active()

static bool is_process_active ( int  pid)
static

Check if process is active.

Parameters
pidProcess id.
Returns
true if process is active, false otherwise.

◆ kill_process()

static bool kill_process ( int  pid)
static

kill process.

Parameters
pidProcess id.
Returns
true if process is terminated, false otherwise.

◆ length_of_n_first_columns()

static size_t length_of_n_first_columns ( std::string  str,
int  start_sort_column 
)
static

◆ log_msg()

void log_msg ( const char *  fmt,
  ... 
)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ make_new_set()

REP_SET * make_new_set ( REP_SETS sets)

◆ make_sets_invisible()

void make_sets_invisible ( REP_SETS sets)

◆ mark_progress()

static void mark_progress ( Logfile progress_file,
int  line 
)
static

Record how many milliseconds it took to execute the test file up until the current line and write it to .progress file.

Parameters
progress_fileLogfile object to store the progress information
lineLine number of the progress file where the progress information should be recorded.

◆ match_delimiter()

bool match_delimiter ( int  c,
const char *  delim,
size_t  length 
)

◆ match_expected_error()

static int match_expected_error ( struct st_command command,
std::uint32_t  err_errno,
const char *  err_sqlstate 
)
static

Check whether given error is in list of expected errors.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
err_errnoError number of the error that actually occurred.
err_sqlstateSQLSTATE that was thrown, or NULL for impossible (file-ops, diff, etc.)
Return values
-1if the given error is not in the list, index in the list of expected errors otherwise.
Note
If caller needs to know whether the list was empty, they should check the value of expected_errors.count.

◆ match_warnings()

static bool match_warnings ( Expected_warnings warnings,
std::uint32_t  error,
bool *  warning_found 
)
static

Check whether a given warning is in list of disabled or enabled warnings.

Parameters
warningsList of either disabled or enabled warnings.
errorError number
warning_foundBoolean value, should be set to true if warning is found in the list, false otherwise.
Return values
Trueif the given warning is present in the list, and ignore flag for that warning is not set, false otherwise.

◆ move_file_by_copy_delete()

static int move_file_by_copy_delete ( const char *  from,
const char *  to 
)
static

◆ my_getc()

static int my_getc ( FILE *  file)
static

◆ my_popen()

static FILE * my_popen ( DYNAMIC_STRING ds_cmd,
const char *  mode,
struct st_command command 
)
static

◆ my_ungetc()

static void my_ungetc ( int  c)
static

◆ mysql_fetch_row_wrapper()

static MYSQL_ROW mysql_fetch_row_wrapper ( MYSQL_RES res)
static

◆ mysql_free_result_wrapper()

static void mysql_free_result_wrapper ( MYSQL_RES result)
static

◆ mysql_next_result_wrapper()

static int mysql_next_result_wrapper ( MYSQL mysql)
static

◆ mysql_query_wrapper()

static int mysql_query_wrapper ( MYSQL mysql,
const char *  query 
)
static

◆ mysql_read_query_result_wrapper()

static bool mysql_read_query_result_wrapper ( MYSQL mysql)
static

◆ mysql_real_connect_wrapper()

static MYSQL * mysql_real_connect_wrapper ( MYSQL mysql,
const char *  host,
const char *  user,
const char *  passwd,
const char *  db,
uint  port,
const char *  unix_socket,
ulong  client_flag 
)
static

◆ mysql_real_query_wrapper()

static int mysql_real_query_wrapper ( MYSQL mysql,
const char *  query,
ulong  length 
)
static

◆ mysql_send_query_wrapper()

static int mysql_send_query_wrapper ( MYSQL mysql,
const char *  query,
ulong  length 
)
static

◆ mysql_store_result_wrapper()

static MYSQL_RES * mysql_store_result_wrapper ( MYSQL mysql)
static

◆ ndb_wait_for_binlog_injector()

static void ndb_wait_for_binlog_injector ( void  )
static

◆ open_file()

static int open_file ( const char *  name)
static

◆ or_bits()

void or_bits ( REP_SET to,
REP_SET from 
)

◆ parse_args()

static int parse_args ( int  argc,
char **  argv 
)
static

◆ parse_warning_list_argument()

static bool parse_warning_list_argument ( struct st_command command)
static

Parse the warning list argument specified with disable_warnings or enable_warnings command.

Check if the second argument "ONCE" is specified, if yes, set once_property flag.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
Return values
Trueif second argument "ONCE" is specified, false otherwise.

◆ print_file_stack()

static void print_file_stack ( )
static

◆ read_command()

static int read_command ( struct st_command **  command_ptr)
static

Create a command from a set of lines.

Converts lines returned by read_line into a command, this involves parsing the first word in the read line to find the command type.

A '--' comment may contain a valid query as the first word after the comment start. Thus it's always checked to see if that is the case. The advantage with this approach is to be able to execute commands terminated by new line '
' regardless how many "delimiter" it contain.

Parameters
[in]command_ptrpointer where to return the new query
Return values
0on success, else 1

◆ read_line()

static int read_line ( char *  buf,
int  size 
)
static

◆ read_until_delimiter()

static void read_until_delimiter ( DYNAMIC_STRING ds,
DYNAMIC_STRING ds_delimiter 
)
static

◆ recursive_copy()

static int recursive_copy ( DYNAMIC_STRING ds_source,
DYNAMIC_STRING ds_destination 
)
static

◆ replace()

static int replace ( DYNAMIC_STRING ds_str,
const char *  search_str,
size_t  search_len,
const char *  replace_str,
size_t  replace_len 
)
static

◆ replace_dynstr_append()

void replace_dynstr_append ( DYNAMIC_STRING ds,
const char *  val 
)

◆ replace_dynstr_append_mem()

void replace_dynstr_append_mem ( DYNAMIC_STRING ds,
const char *  val,
size_t  len 
)

◆ replace_dynstr_append_uint()

void replace_dynstr_append_uint ( DYNAMIC_STRING ds,
uint  val 
)

◆ replace_len()

static uint replace_len ( const char *  str)
static

◆ replace_numeric_round_append()

void replace_numeric_round_append ( int  round,
DYNAMIC_STRING ds,
const char *  from,
size_t  len 
)

◆ replace_strings_append()

void replace_strings_append ( REPLACE rep,
DYNAMIC_STRING ds,
const char *  from,
size_t  len 
)

◆ revert_properties()

void revert_properties ( )

Reset property value to the old value for all properties which are set for the next statement only, i.e properties specified using keyword "ONCE" argument.

◆ run_command()

static int run_command ( char *  cmd,
DYNAMIC_STRING ds_res 
)
static

◆ run_explain()

static void run_explain ( struct st_connection cn,
struct st_command command,
int  flags,
bool  json 
)
static

◆ run_query()

static void run_query ( struct st_connection cn,
struct st_command command,
int  flags 
)
static

◆ run_query_normal()

static void run_query_normal ( struct st_connection cn,
struct st_command command,
int  flags,
const char *  query,
size_t  query_len,
DYNAMIC_STRING ds,
DYNAMIC_STRING ds_warnings 
)
static

Run query using MySQL C API.

Parameters
cnConnection object
commandPointer to the st_command structure which holds the arguments and information for the command.
flagsFlags indicating if we should SEND and/or REAP.
queryQuery string
query_lenLength of the query string
dsOutput buffer to store the query result.
ds_warningsBuffer to store the warnings generated while executing the query.

◆ run_query_stmt()

static void run_query_stmt ( MYSQL mysql,
struct st_command command,
const char *  query,
size_t  query_len,
DYNAMIC_STRING ds,
DYNAMIC_STRING ds_warnings 
)
static

Run query using prepared statement C API.

Parameters
mysqlmysql handle
commandPointer to the st_command structure which holds the arguments and information for the command.
queryQuery string
query_lenLength of the query string
dsOutput buffer to store the query result.
ds_warningsBuffer to store the warnings generated while executing the query.

◆ run_tool()

static int run_tool ( const char *  tool_path,
DYNAMIC_STRING ds_res,
  ... 
)
static

◆ safe_connect()

static void safe_connect ( MYSQL mysql,
const char *  name,
const char *  host,
const char *  user,
const char *  pass,
const char *  db,
int  port,
const char *  sock 
)
static

◆ save_error_code()

static void save_error_code ( std::uint32_t  error)
static

Save error code returned by a mysqltest command in '$__error' variable.

Parameters
errorError code

◆ select_connection()

static void select_connection ( struct st_command command)
static

◆ select_connection_name()

static void select_connection_name ( const char *  name)
static

◆ set_current_connection()

static void set_current_connection ( struct st_connection con)
static

Change the current connection to the given st_connection, and update $mysql_get_server_version and $CURRENT_CONNECTION accordingly.

◆ set_once_property()

static void set_once_property ( enum_prop  property,
bool  value 
)
static

Set a property value to either 0 or 1 for a disable_X or a enable_X command, and the new value set will be applicable for next statement only.

After that, property value will be reset back to the old value.

Parameters
propertyEnum value representing a Property
valueValue for the property, either 0 or 1

◆ set_property()

static void set_property ( st_command command,
enum_prop  property,
bool  value 
)
static

Set a property value to either 0 or 1 for a disable_X or a enable_X command.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
propertyEnum value representing a Property
valueValue for the property, either 0 or 1

◆ set_reconnect()

static void set_reconnect ( MYSQL mysql,
int  val 
)
static

◆ set_result_format_version()

static void set_result_format_version ( ulong  new_version)
static

◆ show_diff()

static bool show_diff ( DYNAMIC_STRING ds,
const char *  filename1,
const char *  filename2 
)
static

Show the diff of two files using the systems builtin diff command.

If no such diff command exist, just dump the content of the two files and inform about how to get "diff"

Parameters
dsPointer to dynamic string where to add the diff. If NULL, print the diff to stderr.
filename1Name of the first file
filename2Name of the second file
Returns
true if the diff should be ignored

◆ show_query()

static void show_query ( MYSQL mysql,
const char *  query 
)
static

◆ show_warnings_before_error()

static void show_warnings_before_error ( MYSQL mysql)
static

◆ signal_handler()

static void signal_handler ( int  sig)
static

◆ socket_event_listen()

static int socket_event_listen ( my_socket  fd)
static

◆ start_at_word()

uint start_at_word ( const char *  pos)

◆ str_to_file()

void str_to_file ( const char *  fname,
char *  str,
size_t  size 
)

◆ str_to_file2()

void str_to_file2 ( const char *  fname,
char *  str,
size_t  size,
bool  append 
)

◆ strip_parentheses()

static void strip_parentheses ( struct st_command command)
static

◆ strip_surrounding()

static int strip_surrounding ( char *  str,
char  c1,
char  c2 
)
static

◆ timer_now()

ulonglong timer_now ( void  )
static

◆ timer_output()

void timer_output ( void  )
static

◆ update_disabled_enabled_warnings_list_var()

static void update_disabled_enabled_warnings_list_var ( )
static

Variable '$DISABLED_WARNINGS_LIST' contains comma separated list of disabled warnings and variable '$ENABLED_WARNINGS_LIST' contains comma separated list of enabled warnings.

Update the value of these two variables with the latest list of disabled and enabled warnings. The value of these variables will be empty if there are no disabled or enabled warnings.

These variables will always contain the latest list of disabled and enabled warnings, and can be referenced inside a test or inside a test utility file to access the current list of disabled or enabled warnings.

◆ usage()

static void usage ( void  )
static

◆ util_query()

static int util_query ( MYSQL org_mysql,
const char *  query 
)
static

◆ validate_bug_number_argument()

static bool validate_bug_number_argument ( std::string  bug_number)
static

Check if the bug number argument to disable_testcase is in a proper format.

Bug number argument should follow 'BUG::XXXX' format

  • Keyword 'BUG" is case-insensitive
  • XXXX should contain only digits
Parameters
bug_numberString representing a bug number
Return values
Trueif the bug number argument is in correct format, false otherwise.

◆ validate_filename()

static void validate_filename ( const char *  file_name)
static

Test case or the result file names may use alphanumeric characters (A-Z, a-z, 0-9), dash ('-') or underscore ('_'), but should not start with dash or underscore.

Check if a file name contains any other special characters. If yes, throw an error and abort the test run.

Parameters
[in]file_nameFile name

◆ var_check_int()

static void var_check_int ( VAR v)
static

◆ var_copy()

static void var_copy ( VAR dest,
VAR src 
)
static

◆ var_from_env()

VAR * var_from_env ( const char *  name,
const char *  def_val 
)

◆ var_get()

VAR * var_get ( const char *  var_name,
const char **  var_name_end,
bool  raw,
bool  ignore_not_existing 
)

◆ var_init()

VAR * var_init ( VAR v,
const char *  name,
size_t  name_len,
const char *  val,
size_t  val_len 
)

◆ var_obtain()

static VAR * var_obtain ( const char *  name,
int  len 
)
static

◆ var_query_set()

static void var_query_set ( VAR var,
const char *  query,
const char **  query_end 
)
static

◆ var_set()

void var_set ( const char *  var_name,
const char *  var_name_end,
const char *  var_val,
const char *  var_val_end 
)
static

◆ var_set_convert_error()

static void var_set_convert_error ( struct st_command command,
VAR var 
)
static

Convert between error numbers and error names/strings.

let $var = convert_error(ER_UNKNOWN_ERROR);
let $var = convert_error(1234);

The variable '$var' will be populated with error number if the argument is string. The variable var will be populated with error string if the argument is number.

Parameters
commandPointer to the st_command structure which holds the arguments and information for the command.
varPointer to VAR object containing a variable information.

◆ var_set_errno()

static void var_set_errno ( int  sql_errno)
static

◆ var_set_escape()

static void var_set_escape ( struct st_command command,
VAR dst 
)
static

Process a "let $variable = escape(CHARACTERS,TEXT)" command.

This will parse the text starting after 'escape'. If parsing is successful, it inserts a backslash character before each character in 'TEXT' that occurs in 'CHARACTERS' and stores the result in $variable. If parsing fails, it prints an error message and aborts the program.

CHARACTERS is a string of at least one character, where ',' must not occur except as the first character. Newlines are not allowed. Backslashes are not treated as escape characters when parsing CHARACTERS, so escape(\',$x) will replace both backslashes and single quotes in $x.

Parameters
commandThe st_command structure, where the 'first_argument' member points to the character just after 'escape'.
dstVAR object representing $variable

◆ var_set_int()

static void var_set_int ( const char *  name,
int  value 
)
static

◆ var_set_query_get_value()

static void var_set_query_get_value ( struct st_command command,
VAR var 
)
static

◆ var_set_string()

static void var_set_string ( const char *  name,
const char *  value 
)
static

◆ verbose_msg()

void verbose_msg ( const char *  fmt,
  ... 
)

Variable Documentation

◆ abort_on_error

bool abort_on_error = true
static

◆ argv_alloc

MEM_ROOT argv_alloc {PSI_NOT_INSTRUMENTED, 512}
static

◆ backtick_lhs

bool backtick_lhs = false
static

◆ block_stack

struct st_block block_stack[32]
static

◆ block_stack_end

struct st_block * block_stack_end
static

◆ builtin_echo

char builtin_echo[FN_REFLEN]

◆ can_handle_expired_passwords

bool can_handle_expired_passwords = true
static

◆ charset_info

CHARSET_INFO* charset_info
Initial value:
=
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_0900_ai_ci
Definition: ctype-uca.cc:9610

◆ command_names

const char* command_names[]

◆ command_typelib

TYPELIB command_typelib
Initial value:
nullptr}
const char * command_names[]
Definition: mysqltest.cc:549
#define array_elements(A)
Definition: validate_password_imp.cc:47

◆ connection_retry_sleep

ulong connection_retry_sleep = 100000
static

◆ connections

struct st_connection* connections = nullptr

◆ connections_end

struct st_connection * connections_end

◆ cur_block

struct st_block* cur_block
static

◆ cur_con

struct st_connection* cur_con = nullptr

◆ cur_file

struct st_test_file* cur_file
static

◆ curr_command

struct st_command* curr_command = nullptr

◆ cursor_protocol

bool cursor_protocol = false
static

◆ cursor_protocol_enabled

bool cursor_protocol_enabled = false
static

◆ debug_check_flag

bool debug_check_flag = false
static

◆ debug_info_flag

bool debug_info_flag = false
static

◆ default_charset

const char* default_charset = MYSQL_DEFAULT_CHARSET_NAME
static

◆ delimiter

char delimiter[MAX_DELIMITER_LENGTH] = ";"
static

◆ delimiter_length

size_t delimiter_length = 1
static

◆ disable_connect_log

bool disable_connect_log = true
static

◆ disable_info

bool disable_info = true
static

◆ disable_query_log

bool disable_query_log = false
static

◆ disable_result_log

bool disable_result_log = false
static

◆ disable_warnings

bool disable_warnings = false
static

◆ disabled_warnings

Expected_warnings* disabled_warnings = new Expected_warnings()

◆ display_metadata

bool display_metadata = false
static

◆ display_result_lower

bool display_result_lower = false
static

◆ display_result_sorted

bool display_result_sorted = false
static

◆ display_result_vertically

bool display_result_vertically = false
static

◆ display_session_track_info

bool display_session_track_info = false
static

◆ ds_res

◆ ds_result

DYNAMIC_STRING ds_result

◆ ds_warn

DYNAMIC_STRING* ds_warn = nullptr

◆ enable_async_client

bool enable_async_client = false
static

◆ enabled_warnings

Expected_warnings* enabled_warnings = new Expected_warnings()

◆ excluded_string

const char* excluded_string = nullptr

◆ expected_errors

Expected_errors* expected_errors = new Expected_errors()

◆ explain_protocol

bool explain_protocol = false
static

◆ explain_protocol_enabled

bool explain_protocol_enabled = false
static

◆ file_stack

struct st_test_file file_stack[16]
static

◆ file_stack_end

struct st_test_file* file_stack_end
static

◆ found_sets

uint found_sets = 0
static

◆ glob_replace

REPLACE* glob_replace = nullptr

◆ glob_replace_numeric_round

int glob_replace_numeric_round = -1
static

◆ glob_replace_regex

struct st_replace_regex* glob_replace_regex = nullptr

◆ is_windows

bool is_windows = false
static

◆ json_explain_protocol

bool json_explain_protocol = false
static

◆ json_explain_protocol_enabled

bool json_explain_protocol_enabled = false
static

◆ line_buffer

char line_buffer[MAX_DELIMITER_LENGTH]
static

◆ line_buffer_pos

char * line_buffer_pos = line_buffer
static

◆ load_default_groups

const char* load_default_groups[] = {"mysqltest", "client", nullptr}
static

◆ log_file

Logfile log_file

◆ master_pos

struct MasterPos master_pos

◆ max_replace_column

uint max_replace_column = 0
static

◆ my_charset_utf16le_bin

CHARSET_INFO my_charset_utf16le_bin
extern

◆ my_end_arg

uint my_end_arg = 0
static

◆ my_long_options

struct my_option my_long_options[]
static

◆ next_con

struct st_connection * next_con

◆ no_skip

bool no_skip = false
static

◆ once_property

bool once_property = false
static

◆ opt_basedir

const char * opt_basedir = "./"

◆ opt_charsets_dir

const char * opt_charsets_dir

◆ opt_colored_diff

bool opt_colored_diff = false
static

◆ opt_compress

bool opt_compress = false
static

◆ opt_compress_algorithm

char* opt_compress_algorithm = nullptr
static

◆ opt_connect_timeout

uint opt_connect_timeout = 0
static

◆ opt_db

char* opt_db = nullptr
static

◆ opt_host

const char * opt_host = nullptr

◆ opt_hypergraph

bool opt_hypergraph = false
static

◆ opt_include

const char* opt_include = nullptr

◆ opt_init_command

char* opt_init_command = nullptr
static

◆ opt_logdir

const char* opt_logdir = ""

◆ opt_mark_progress

bool opt_mark_progress = false
static

◆ opt_max_connect_retries

int opt_max_connect_retries
static

◆ opt_max_connections

int opt_max_connections = DEFAULT_MAX_CONN
static

◆ opt_offload_count_file

const char* opt_offload_count_file
static

◆ opt_pass

char * opt_pass = nullptr
static

◆ opt_plugin_dir

char* opt_plugin_dir = nullptr
static

◆ opt_port

int opt_port = 0
static

◆ opt_protocol

uint opt_protocol = 0
static

◆ opt_result_format_version

int opt_result_format_version
static

◆ opt_tail_lines

uint opt_tail_lines = 0
static

◆ opt_test_ssl_fips_mode

uint opt_test_ssl_fips_mode = 0
static

◆ opt_trace_protocol

bool opt_trace_protocol = false
static

◆ opt_trace_protocol_enabled

bool opt_trace_protocol_enabled = false
static

◆ opt_user

const char* opt_user = nullptr

◆ opt_zstd_compress_level

uint opt_zstd_compress_level = default_zstd_compression_level
static

◆ parser

struct Parser parser

◆ progress_file

Logfile progress_file

◆ prop_list

struct Property prop_list[]
static
Initial value:
= {
{&abort_on_error, false, true, false, "$ENABLE_ABORT_ON_ERROR"},
{&disable_connect_log, false, true, true, "$ENABLE_CONNECT_LOG"},
{&disable_info, false, true, true, "$ENABLE_INFO"},
{&display_session_track_info, false, true, true,
"$ENABLE_STATE_CHANGE_INFO"},
{&display_metadata, false, false, false, "$ENABLE_METADATA"},
{&ps_protocol_enabled, false, false, false, "$ENABLE_PS_PROTOCOL"},
{&disable_query_log, false, false, true, "$ENABLE_QUERY_LOG"},
{&disable_result_log, false, false, true, "$ENABLE_RESULT_LOG"},
{&disable_warnings, false, false, true, "$ENABLE_WARNINGS"},
{&enable_async_client, false, false, false, "$ENABLE_ASYNC_CLIENT"}}
static bool display_session_track_info
Definition: mysqltest.cc:227
static bool disable_info
Definition: mysqltest.cc:233
static bool enable_async_client
Definition: mysqltest.cc:250
static bool ps_protocol_enabled
Definition: mysqltest.cc:214
static bool disable_query_log
Definition: mysqltest.cc:230
static bool abort_on_error
Definition: mysqltest.cc:234
static bool disable_connect_log
Definition: mysqltest.cc:231
static bool disable_warnings
Definition: mysqltest.cc:232
static bool disable_result_log
Definition: mysqltest.cc:230
static bool display_metadata
Definition: mysqltest.cc:226

◆ ps_protocol

bool ps_protocol = false
static

◆ ps_protocol_enabled

bool ps_protocol_enabled = false
static

◆ q_lines

Q_lines* q_lines

◆ read_command_buf

char read_command_buf[MAX_QUERY]
static

◆ record

int record = 0
static

◆ replace_column

char* replace_column[MAX_COLUMNS]
static

◆ result_file_name

const char* result_file_name = nullptr

◆ secondary_engine

Secondary_engine* secondary_engine = nullptr
static

◆ server_initialized

bool server_initialized = false
static

◆ shared_memory_base_name

char* shared_memory_base_name = nullptr
static

◆ silent

bool silent = false
static

◆ skip_if_hypergraph

bool skip_if_hypergraph = false
static

◆ skip_ignored

bool skip_ignored = false
static

◆ sp_protocol

bool sp_protocol = false
static

◆ sp_protocol_enabled

bool sp_protocol_enabled = false
static

◆ start_lineno

uint start_lineno = 0
static

◆ start_sort_column

int start_sort_column = 0
static

◆ testcase_disabled

bool testcase_disabled = false
static

◆ timer_file

char* timer_file = nullptr
static

◆ timer_start

ulonglong timer_start
static

◆ TMPDIR

char TMPDIR[FN_REFLEN]
static

◆ trace_exec

bool trace_exec = false
static

◆ tty_password

bool tty_password = false
static

◆ unix_sock

const char * unix_sock = nullptr

◆ use_async_client

bool use_async_client = false
static

◆ var_hash

collation_unordered_map<std::string, std::unique_ptr<VAR, var_free> >* var_hash

◆ var_reg

VAR var_reg[10]

◆ verbose

bool verbose = false
static

◆ view_protocol

bool view_protocol = false
static

◆ view_protocol_enabled

bool view_protocol_enabled = false
static