1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

merge: 5.1 -> 5.1-rpl

conflicts:
  Text conflict in client/mysqltest.cc
  Text conflict in mysql-test/include/wait_until_connected_again.inc
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
  Text conflict in mysql-test/r/events_bugs.result
  Text conflict in mysql-test/r/log_state.result
  Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
  Text conflict in mysql-test/r/mysqlcheck.result
  Text conflict in mysql-test/r/query_cache.result
  Text conflict in mysql-test/r/status.result
  Text conflict in mysql-test/suite/binlog/r/binlog_index.result
  Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
  Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
  Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
  Text conflict in mysql-test/t/disabled.def
  Text conflict in mysql-test/t/events_bugs.test
  Text conflict in mysql-test/t/log_state.test
  Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
  Text conflict in mysql-test/t/mysqlcheck.test
  Text conflict in mysql-test/t/query_cache.test
  Text conflict in mysql-test/t/rpl_init_slave_func.test
  Text conflict in mysql-test/t/status.test
This commit is contained in:
Luis Soares
2009-01-23 13:22:05 +01:00
265 changed files with 7144 additions and 4058 deletions

View File

@@ -1441,6 +1441,36 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
}
/*
Test if diff is present. This is needed on Windows systems
as the OS returns 1 whether diff is successful or if it is
not present.
We run diff -v and look for output in stdout.
We don't redirect stderr to stdout to make for a simplified check
Windows will output '"diff"' is not recognized... to stderr if it is
not present.
*/
int diff_check()
{
char buf[512]= {0};
FILE *res_file;
const char *cmd = "diff -v";
int have_diff = 0;
if (!(res_file= popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd);
/* if diff is not present, nothing will be in stdout to increment have_diff */
if (fgets(buf, sizeof(buf), res_file))
{
have_diff += 1;
}
pclose(res_file);
return have_diff;
}
/*
Show the diff of two files using the systems builtin diff
command. If no such diff command exist, just dump the content
@@ -1457,28 +1487,28 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
void show_diff(DYNAMIC_STRING* ds,
const char* filename1, const char* filename2)
{
const char* diff_failed= 0;
DYNAMIC_STRING ds_tmp;
int have_diff = 0;
if (init_dynamic_string(&ds_tmp, "", 256, 256))
die("Out of memory");
/* First try with unified diff */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"-u",
filename1,
filename2,
"2>&1",
NULL) > 1) /* Most "diff" tools return >1 if error */
{
dynstr_set(&ds_tmp, "");
/* determine if we have diff on Windows
needs special processing due to return values
on that OS
*/
#ifdef __WIN__
have_diff = diff_check();
#else
have_diff = 1;
#endif
/* Fallback to context diff with "diff -c" */
if (have_diff)
{
/* First try with unified diff */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"-c",
"-u",
filename1,
filename2,
"2>&1",
@@ -1486,29 +1516,38 @@ void show_diff(DYNAMIC_STRING* ds,
{
dynstr_set(&ds_tmp, "");
/* Fallback to plain "diff" */
/* Fallback to context diff with "diff -c" */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"-c",
filename1,
filename2,
"2>&1",
NULL) > 1) /* Most "diff" tools return >1 if error */
{
dynstr_set(&ds_tmp, "");
dynstr_set(&ds_tmp, "");
diff_failed= "Could not execute 'diff -u', 'diff -c' or 'diff'";
/* Fallback to simple diff with "diff" */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
filename1,
filename2,
"2>&1",
NULL) > 1) /* Most "diff" tools return >1 if error */
{
have_diff= 0;
}
}
}
}
}
if (diff_failed)
if (! have_diff)
{
/*
Fallback to dump both files to result file and inform
about installing "diff"
*/
dynstr_append(&ds_tmp, "\n");
dynstr_append(&ds_tmp, diff_failed);
dynstr_append(&ds_tmp,
"\n"
"The two files differ but it was not possible to execute 'diff' in\n"
@@ -7326,6 +7365,13 @@ static sig_handler signal_handler(int sig)
{
fprintf(stderr, "mysqltest got " SIGNAL_FMT "\n", sig);
dump_backtrace();
fprintf(stderr, "Writing a core file...\n");
fflush(stderr);
my_write_core(sig);
#ifndef __WIN__
exit(1); // Shouldn't get here but just in case
#endif
}
#ifdef __WIN__