mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
upmerge 35543,48367,48671,48806,48808
This commit is contained in:
@ -3632,49 +3632,58 @@ void do_perl(struct st_command *command)
|
|||||||
sizeof(perl_args)/sizeof(struct command_arg),
|
sizeof(perl_args)/sizeof(struct command_arg),
|
||||||
' ');
|
' ');
|
||||||
|
|
||||||
/* If no delimiter was provided, use EOF */
|
ds_script= command->content;
|
||||||
if (ds_delimiter.length == 0)
|
/* If it hasn't been done already by a loop iteration, fill it in */
|
||||||
dynstr_set(&ds_delimiter, "EOF");
|
if (! ds_script.str)
|
||||||
|
|
||||||
init_dynamic_string(&ds_script, "", 1024, 1024);
|
|
||||||
read_until_delimiter(&ds_script, &ds_delimiter);
|
|
||||||
|
|
||||||
DBUG_PRINT("info", ("Executing perl: %s", ds_script.str));
|
|
||||||
|
|
||||||
/* Create temporary file name */
|
|
||||||
if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"),
|
|
||||||
"tmp", O_CREAT | O_SHARE | O_RDWR,
|
|
||||||
MYF(MY_WME))) < 0)
|
|
||||||
die("Failed to create temporary file for perl command");
|
|
||||||
my_close(fd, MYF(0));
|
|
||||||
|
|
||||||
str_to_file(temp_file_path, ds_script.str, ds_script.length);
|
|
||||||
|
|
||||||
/* Format the "perl <filename>" command */
|
|
||||||
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
|
|
||||||
|
|
||||||
if (!(res_file= popen(buf, "r")) && command->abort_on_error)
|
|
||||||
die("popen(\"%s\", \"r\") failed", buf);
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), res_file))
|
|
||||||
{
|
{
|
||||||
if (disable_result_log)
|
/* If no delimiter was provided, use EOF */
|
||||||
{
|
if (ds_delimiter.length == 0)
|
||||||
buf[strlen(buf)-1]=0;
|
dynstr_set(&ds_delimiter, "EOF");
|
||||||
DBUG_PRINT("exec_result",("%s", buf));
|
|
||||||
}
|
init_dynamic_string(&ds_script, "", 1024, 1024);
|
||||||
else
|
read_until_delimiter(&ds_script, &ds_delimiter);
|
||||||
{
|
command->content= ds_script;
|
||||||
replace_dynstr_append(&ds_res, buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
error= pclose(res_file);
|
|
||||||
|
|
||||||
/* Remove the temporary file */
|
/* This function could be called even if "false", so check before doing */
|
||||||
my_delete(temp_file_path, MYF(0));
|
if (cur_block->ok)
|
||||||
|
{
|
||||||
|
DBUG_PRINT("info", ("Executing perl: %s", ds_script.str));
|
||||||
|
|
||||||
handle_command_error(command, WEXITSTATUS(error));
|
/* Create temporary file name */
|
||||||
dynstr_free(&ds_script);
|
if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"),
|
||||||
|
"tmp", O_CREAT | O_SHARE | O_RDWR,
|
||||||
|
MYF(MY_WME))) < 0)
|
||||||
|
die("Failed to create temporary file for perl command");
|
||||||
|
my_close(fd, MYF(0));
|
||||||
|
|
||||||
|
str_to_file(temp_file_path, ds_script.str, ds_script.length);
|
||||||
|
|
||||||
|
/* Format the "perl <filename>" command */
|
||||||
|
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
|
||||||
|
|
||||||
|
if (!(res_file= popen(buf, "r")) && command->abort_on_error)
|
||||||
|
die("popen(\"%s\", \"r\") failed", buf);
|
||||||
|
|
||||||
|
while (fgets(buf, sizeof(buf), res_file))
|
||||||
|
{
|
||||||
|
if (disable_result_log)
|
||||||
|
{
|
||||||
|
buf[strlen(buf)-1]=0;
|
||||||
|
DBUG_PRINT("exec_result",("%s", buf));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
replace_dynstr_append(&ds_res, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
error= pclose(res_file);
|
||||||
|
|
||||||
|
/* Remove the temporary file */
|
||||||
|
my_delete(temp_file_path, MYF(0));
|
||||||
|
|
||||||
|
handle_command_error(command, WEXITSTATUS(error));
|
||||||
|
}
|
||||||
dynstr_free(&ds_delimiter);
|
dynstr_free(&ds_delimiter);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -81,24 +81,28 @@ sub is_child {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Find the safe process binary or script
|
|
||||||
my @safe_process_cmd;
|
my @safe_process_cmd;
|
||||||
my $safe_kill;
|
my $safe_kill;
|
||||||
if (IS_WIN32PERL or IS_CYGWIN){
|
|
||||||
# Use my_safe_process.exe
|
|
||||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
|
||||||
"my_safe_process");
|
|
||||||
push(@safe_process_cmd, $exe);
|
|
||||||
|
|
||||||
# Use my_safe_kill.exe
|
# Find the safe process binary or script
|
||||||
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
|
sub find_bin {
|
||||||
}
|
if (IS_WIN32PERL or IS_CYGWIN)
|
||||||
else
|
{
|
||||||
{
|
# Use my_safe_process.exe
|
||||||
# Use my_safe_process
|
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
"my_safe_process");
|
||||||
"my_safe_process");
|
push(@safe_process_cmd, $exe);
|
||||||
push(@safe_process_cmd, $exe);
|
|
||||||
|
# Use my_safe_kill.exe
|
||||||
|
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Use my_safe_process
|
||||||
|
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||||
|
"my_safe_process");
|
||||||
|
push(@safe_process_cmd, $exe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -266,6 +266,9 @@ sub main {
|
|||||||
|
|
||||||
command_line_setup();
|
command_line_setup();
|
||||||
|
|
||||||
|
# --help will not reach here, so now it's safe to assume we have binaries
|
||||||
|
My::SafeProcess::find_bin();
|
||||||
|
|
||||||
if ( $opt_gcov ) {
|
if ( $opt_gcov ) {
|
||||||
gcov_prepare($basedir);
|
gcov_prepare($basedir);
|
||||||
}
|
}
|
||||||
@ -2519,6 +2522,7 @@ sub create_config_file_for_extern {
|
|||||||
# binlog reads from [client] and [mysqlbinlog]
|
# binlog reads from [client] and [mysqlbinlog]
|
||||||
[mysqlbinlog]
|
[mysqlbinlog]
|
||||||
character-sets-dir= $path_charsetsdir
|
character-sets-dir= $path_charsetsdir
|
||||||
|
local-load= $opt_tmpdir
|
||||||
|
|
||||||
# mysql_fix_privilege_tables.sh don't read from [client]
|
# mysql_fix_privilege_tables.sh don't read from [client]
|
||||||
[mysql_fix_privilege_tables]
|
[mysql_fix_privilege_tables]
|
||||||
@ -3503,6 +3507,14 @@ sub run_testcase ($) {
|
|||||||
run_on_all($tinfo, "analyze-$analyze");
|
run_on_all($tinfo, "analyze-$analyze");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Wait a bit and see if a server died, if so report that instead
|
||||||
|
mtr_milli_sleep(100);
|
||||||
|
my $srvproc= My::SafeProcess::check_any();
|
||||||
|
if ($srvproc && grep($srvproc eq $_, started(all_servers()))) {
|
||||||
|
$proc= $srvproc;
|
||||||
|
goto SRVDIED;
|
||||||
|
}
|
||||||
|
|
||||||
# Test case failure reported by mysqltest
|
# Test case failure reported by mysqltest
|
||||||
report_failure_and_restart($tinfo);
|
report_failure_and_restart($tinfo);
|
||||||
}
|
}
|
||||||
@ -3528,6 +3540,7 @@ sub run_testcase ($) {
|
|||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Check if it was an expected crash
|
# Check if it was an expected crash
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
|
SRVDIED:
|
||||||
my $check_crash = check_expected_crash_and_restart($proc);
|
my $check_crash = check_expected_crash_and_restart($proc);
|
||||||
if ($check_crash)
|
if ($check_crash)
|
||||||
{
|
{
|
||||||
@ -5094,9 +5107,9 @@ sub debugger_arguments {
|
|||||||
{
|
{
|
||||||
# vc[express] /debugexe exe arg1 .. argn
|
# vc[express] /debugexe exe arg1 .. argn
|
||||||
|
|
||||||
# Add /debugexe and name of the exe before args
|
# Add name of the exe and /debugexe before args
|
||||||
unshift(@$$args, "/debugexe");
|
|
||||||
unshift(@$$args, "$$exe");
|
unshift(@$$args, "$$exe");
|
||||||
|
unshift(@$$args, "/debugexe");
|
||||||
|
|
||||||
# Set exe to debuggername
|
# Set exe to debuggername
|
||||||
$$exe= $debugger;
|
$$exe= $debugger;
|
||||||
|
@ -553,6 +553,8 @@ hello
|
|||||||
mysqltest: At line 1: Max delimiter length(16) exceeded
|
mysqltest: At line 1: Max delimiter length(16) exceeded
|
||||||
hello
|
hello
|
||||||
hello
|
hello
|
||||||
|
val is 5
|
||||||
|
val is 5
|
||||||
mysqltest: At line 1: test of die
|
mysqltest: At line 1: test of die
|
||||||
Some output
|
Some output
|
||||||
create table t1( a int, b char(255), c timestamp);
|
create table t1( a int, b char(255), c timestamp);
|
||||||
|
@ -1905,6 +1905,20 @@ perl;
|
|||||||
print "hello\n";
|
print "hello\n";
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Test perl within while, also with if being false first iteration
|
||||||
|
let $outer= 3;
|
||||||
|
let $ifval= 0;
|
||||||
|
while ($outer) {
|
||||||
|
if ($ifval) {
|
||||||
|
perl UNTIL;
|
||||||
|
my $val= 5;
|
||||||
|
print "val is $val\n";
|
||||||
|
UNTIL
|
||||||
|
}
|
||||||
|
inc $ifval;
|
||||||
|
dec $outer;
|
||||||
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# test for die
|
# test for die
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user