MySQL 9.1.0
Source Code Documentation
|
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 "client/include/caching_sha2_passwordopt-vars.h"
#include "client/include/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 "client/include/sslopt-vars.h"
#include "client/include/caching_sha2_passwordopt-longopts.h"
#include "client/include/sslopt-longopts.h"
#include "client/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 512 |
#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 |
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 () |
VAR * | var_from_env (const char *, const char *) |
VAR * | var_init (VAR *v, const char *name, size_t name_len, const char *val, size_t val_len) |
VAR * | var_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_RES * | async_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 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 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_RES * | mysql_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 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 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 VAR * | var_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_connection * | find_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_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 bool | enable_hypergraph_optimizer (st_connection *con) |
Enable the hypergraph optimizer in a connection. 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) |
REPLACE * | init_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_regex * | init_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_SET * | make_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) |
mysqltest client - Tool used for executing a .test file.
See The MySQL Test Framework for more information.
#define APPEND_TYPE | ( | type | ) |
#define DEFAULT_MAX_CONN 512 |
#define LAST_CHAR_CODE 259 |
#define MAX_COLUMNS 256 |
#define MAX_DELIMITER_LENGTH 16 |
#define MAX_QUERY (256 * 1024 * 2) |
#define MAX_VAR_NAME_LENGTH 256 |
#define PARSE_REGEX_ARG |
#define PC_MALLOC 256 /* Bytes for pointers */ |
#define PS_MALLOC 512 /* Bytes for data */ |
#define QUERY_REAP_FLAG 2 |
#define QUERY_SEND_FLAG 1 |
#define REPLACE_ROUND_MAX 16 |
#define SET_MALLOC_HUNC 64 |
#define SIGNAL_FMT "signal %d" |
#define WORD_BIT (8 * sizeof(uint)) |
typedef Prealloced_array<st_command *, 1024> Q_lines |
anonymous enum |
enum arg_type |
enum block_cmd |
enum block_op |
enum enum_commands |
enum enum_operator |
enum enum_prop |
void abort_not_supported_test | ( | const char * | fmt, |
... | |||
) |
|
static |
Abort process.
pid | Process id. |
path | Path to create minidump file in. |
|
static |
Allocate memory for the buffer holding the string value of a variable.
var | The variable |
length | The number of string characters, not counting the \0. |
|
static |
|
static |
|
static |
|
static |
|
static |
Append state change information (received through Ok packet) to the output.
[in,out] | ds | Dynamic string to hold the content to be printed. |
[in] | mysql | Connection handle. |
|
static |
|
static |
|
static |
Fetch warnings generated by server while executing a query and append them to warnings buffer 'ds'.
ds | DYNAMIC_STRING object to store the warnings |
mysql | mysql handle object |
Number | of warnings appended to ds |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
ds_property | DYNAMIC_STRING object containing the second argument |
warn_argument | String to store the argument string containing only the list of warnings. |
True | if the second argument is specified, false otherwise. |
|
static |
|
static |
void check_eol_junk_line | ( | const char * | eol | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
con | Connection structure to be used |
host | Host name |
user | User name |
pass | Password |
db | Database name |
port | Port number |
sock | Socket value |
1 | if connection succeeds, 0 otherwise |
|
static |
void die | ( | const char * | fmt, |
... | |||
) |
|
static |
Display the optimizer trace produced by the last executed statement.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the 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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
|
static |
Compare the two files.
Success if 2 files are same, failure if the files are different or either file does not exist.
command | Pointer to the st_command structure which holds the arguments and information for the 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.
command | Pointer to the st_command structure which holds the arguments and information for the 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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the 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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
void do_eval | ( | DYNAMIC_STRING * | query_eval, |
const char * | query, | ||
const char * | query_end, | ||
bool | pass_through_escape_chars | ||
) |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
run_in_background | Specifies if command should be run in background. In such case we don't wait nor attempt to read the output. |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
void do_force_rmdir | ( | struct st_command * | command, |
DYNAMIC_STRING * | ds_dirname | ||
) |
void do_get_replace | ( | struct st_command * | command | ) |
void do_get_replace_column | ( | struct st_command * | command | ) |
void do_get_replace_numeric_round | ( | struct st_command * | command | ) |
void do_get_replace_regex | ( | struct st_command * | command | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
|
static |
Set string query attributes for the next query.
command | Pointer to the st_command structure which holds the arguments and information for the command. Optionally including a timeout else the default of 60 seconds |
|
static |
Removes the file passed as the argument and retries a specified number of times, if it is unsuccessful.
command | Pointer to the st_command structure which holds the arguments and information for the 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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. Optionally including a timeout else the default of 60 seconds |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void dynstr_append_sorted | ( | DYNAMIC_STRING * | ds, |
DYNAMIC_STRING * | ds_input, | ||
int | start_sort_column | ||
) |
|
static |
Enable the hypergraph optimizer in a connection.
Set it as a session variable in order to take effect in the current session, but also as a global variable so that a test case can do "SET optimizer_switch = DEFAULT;" without switching to the old optimizer for the rest of the session.
|
static |
uint end_of_word | ( | const char * | pos | ) |
void eval_expr | ( | VAR * | v, |
const char * | p, | ||
const char ** | p_end, | ||
bool | open_end = false , |
||
bool | do_eval = true |
||
) |
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
ds_warnings | DYNAMIC_STRING object containing the argument. |
Evaluated | string after replacing the variables with values. |
|
static |
int find_found | ( | FOUND_SET * | found_set, |
uint | table_offset, | ||
int | found_offset | ||
) |
|
static |
void fix_win_paths | ( | const char * | val, |
size_t | len | ||
) |
void flush_ds_res | ( | ) |
|
static |
|
static |
Template function that frees memory of the dynamic string passed to the function.
val | Dynamic string whose memory needs to be freed. |
|
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.
first | The dynamic string passed to the function which gets freed using dynstr_free(). |
rest | Rest of the dynamic strings which are passed to the function, through recursion, end up being freed by dynstr_free(). |
void free_last_set | ( | REP_SETS * | sets | ) |
void free_pointer_array | ( | POINTER_ARRAY * | pa | ) |
void free_replace | ( | ) |
void free_replace_column | ( | ) |
void free_replace_numeric_round | ( | ) |
void free_replace_regex | ( | ) |
void free_sets | ( | REP_SETS * | sets | ) |
|
static |
|
static |
const char * get_filename_from_path | ( | const char * | path | ) |
|
static |
int get_next_bit | ( | REP_SET * | set, |
uint | lastpos | ||
) |
|
static |
|
static |
|
static |
Get an error code corresponding to a warning name.
The warning name specified is in symbolic error name format.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
warn_argument | String containing warning argument |
once_prop | Flag specifying whether a property should be set for next statement only. |
|
static |
Handle errors which occurred during execution of mysqltest commands like 'move_file', 'remove_file' etc which are used to perform file system operations.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
error | Error number |
|
static |
Handle disabling of warnings.
warning_code | Warning code |
warning | Warning string |
once_prop | Flag specifying whether a property should be set for next statement only. |
|
static |
Handle enabling of warnings.
warning_code | Warning code |
warning | Warning string |
once_prop | Flag specifying whether a property should be set for next statement only. |
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
err_errno | Error number |
err_error | Error message |
err_sqlstate | SQLSTATE that was thrown |
ds | Dynamic string to store the result. |
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
|
static |
Handle one warning which occurred during execution of a query.
ds | DYNAMIC_STRING object to store the warnings. |
warning | Warning string |
True | if a warning is found in the list of disabled or enabled warnings, false otherwise. |
|
static |
Handle warnings which occurred during execution of a query.
ds | DYNAMIC_STRING object to store the warnings. |
ds_warnings | String containing all the generated warnings. |
|
static |
REPLACE * init_replace | ( | const char ** | from, |
const char ** | to, | ||
uint | count, | ||
const char * | word_end_chars | ||
) |
|
static |
Initializes the regular substitution expression to be used in the result output of test.
expr | Pointer to string having regular expression to be used for substitution. |
st_replace_regex | structure with pairs of substitutions. |
int init_sets | ( | REP_SETS * | sets, |
uint | states | ||
) |
|
static |
int insert_pointer_name | ( | POINTER_ARRAY * | pa, |
char * | name | ||
) |
void internal_clear_bit | ( | REP_SET * | set, |
uint | bit | ||
) |
void internal_set_bit | ( | REP_SET * | set, |
uint | bit | ||
) |
|
static |
|
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 ...
|
static |
|
static |
Check if process is active.
pid | Process id. |
|
static |
kill process.
pid | Process id. |
|
static |
void log_msg | ( | const char * | fmt, |
... | |||
) |
int main | ( | int | argc, |
char ** | argv | ||
) |
void make_sets_invisible | ( | REP_SETS * | sets | ) |
|
static |
Record how many milliseconds it took to execute the test file up until the current line and write it to .progress file.
progress_file | Logfile object to store the progress information |
line | Line number of the progress file where the progress information should be recorded. |
bool match_delimiter | ( | int | c, |
const char * | delim, | ||
size_t | length | ||
) |
|
static |
Check whether given error is in list of expected errors.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
err_errno | Error number of the error that actually occurred. |
err_sqlstate | SQLSTATE that was thrown, or NULL for impossible (file-ops, diff, etc.) |
-1 | if the given error is not in the list, index in the list of expected errors otherwise. |
|
static |
Check whether a given warning is in list of disabled or enabled warnings.
warnings | List of either disabled or enabled warnings. |
error | Error number |
warning_found | Boolean value, should be set to true if warning is found in the list, false otherwise. |
True | if the given warning is present in the list, and ignore flag for that warning is not set, false otherwise. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
True | if second argument "ONCE" is specified, false otherwise. |
|
static |
|
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.
[in] | command_ptr | pointer where to return the new query |
0 | on success, else 1 |
|
static |
|
static |
|
static |
|
static |
void replace_dynstr_append | ( | DYNAMIC_STRING * | ds, |
const char * | val | ||
) |
void replace_dynstr_append_mem | ( | DYNAMIC_STRING * | ds, |
const char * | val, | ||
size_t | len | ||
) |
void replace_dynstr_append_uint | ( | DYNAMIC_STRING * | ds, |
uint | val | ||
) |
|
static |
void replace_numeric_round_append | ( | int | round, |
DYNAMIC_STRING * | ds, | ||
const char * | from, | ||
size_t | len | ||
) |
void replace_strings_append | ( | REPLACE * | rep, |
DYNAMIC_STRING * | ds, | ||
const char * | from, | ||
size_t | len | ||
) |
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.
|
static |
|
static |
|
static |
|
static |
Run query using MySQL C API.
cn | Connection object |
command | Pointer to the st_command structure which holds the arguments and information for the command. |
flags | Flags indicating if we should SEND and/or REAP. |
query | Query string |
query_len | Length of the query string |
ds | Output buffer to store the query result. |
ds_warnings | Buffer to store the warnings generated while executing the query. |
|
static |
Run query using prepared statement C API.
mysql | mysql handle |
command | Pointer to the st_command structure which holds the arguments and information for the command. |
query | Query string |
query_len | Length of the query string |
ds | Output buffer to store the query result. |
ds_warnings | Buffer to store the warnings generated while executing the query. |
|
static |
|
static |
|
static |
Save error code returned by a mysqltest command in '$__error' variable.
error | Error code |
|
static |
|
static |
|
static |
Change the current connection to the given st_connection, and update $mysql_get_server_version and $CURRENT_CONNECTION accordingly.
|
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.
property | Enum value representing a Property |
value | Value for the property, either 0 or 1 |
|
static |
Set a property value to either 0 or 1 for a disable_X or a enable_X command.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
property | Enum value representing a Property |
value | Value for the property, either 0 or 1 |
|
static |
|
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"
ds | Pointer to dynamic string where to add the diff. If NULL, print the diff to stderr. |
filename1 | Name of the first file |
filename2 | Name of the second file |
|
static |
|
static |
|
static |
|
static |
uint start_at_word | ( | const char * | pos | ) |
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 | ||
) |
|
static |
|
static |
|
static |
|
static |
|
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.
|
static |
|
static |
|
static |
Check if the bug number argument to disable_testcase is in a proper format.
Bug number argument should follow 'BUG::XXXX' format
bug_number | String representing a bug number |
True | if the bug number argument is in correct format, false otherwise. |
|
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.
[in] | file_name | File name |
|
static |
VAR * var_from_env | ( | const char * | name, |
const char * | def_val | ||
) |
VAR * var_get | ( | const char * | var_name, |
const char ** | var_name_end, | ||
bool | raw, | ||
bool | ignore_not_existing | ||
) |
|
static |
|
static |
|
static |
|
static |
Convert between error numbers and error names/strings.
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.
command | Pointer to the st_command structure which holds the arguments and information for the command. |
var | Pointer to VAR object containing a variable information. |
|
static |
|
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.
command | The st_command structure, where the 'first_argument' member points to the character just after 'escape'. |
dst | VAR object representing $variable |
|
static |
|
static |
|
static |
void verbose_msg | ( | const char * | fmt, |
... | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
char builtin_echo[FN_REFLEN] |
|
static |
CHARSET_INFO* charset_info |
const char* command_names[] |
TYPELIB command_typelib |
|
static |
struct st_connection* connections = nullptr |
struct st_connection * connections_end |
|
static |
struct st_connection* cur_con = nullptr |
|
static |
struct st_command* curr_command = nullptr |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Expected_warnings* disabled_warnings = new Expected_warnings() |
|
static |
|
static |
|
static |
|
static |
|
static |
DYNAMIC_STRING ds_res |
DYNAMIC_STRING ds_result |
DYNAMIC_STRING* ds_warn = nullptr |
|
static |
Expected_warnings* enabled_warnings = new Expected_warnings() |
const char* excluded_string = nullptr |
Expected_errors* expected_errors = new Expected_errors() |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
struct st_replace_regex* glob_replace_regex = nullptr |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Logfile log_file |
struct MasterPos master_pos |
|
static |
|
static |
|
static |
struct st_connection * next_con |
|
static |
|
static |
const char * opt_basedir = "./" |
const char * opt_charsets_dir |
|
static |
|
static |
|
static |
|
static |
|
static |
const char * opt_host = nullptr |
|
static |
const char* opt_include = nullptr |
|
static |
const char* opt_logdir = "" |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const char* opt_user = nullptr |
|
static |
struct Parser parser |
Logfile progress_file |
|
static |
|
static |
|
static |
Q_lines* q_lines |
|
static |
|
static |
|
static |
const char* result_file_name = nullptr |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const char * unix_sock = nullptr |
|
static |
collation_unordered_map<std::string, std::unique_ptr<VAR, var_free> >* var_hash |
VAR var_reg[10] |
|
static |
|
static |
|
static |