From 5e566b8effbcf992ccd077eb1ddee499cd98b057 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 11 Mar 2009 14:52:50 +0100 Subject: [PATCH 1/4] Bug #43532 mtr should not rely on diff to report test results mtr on Windows does not give decent diff due to missing diff install Modified to look for 'mtrdiff' if diff not available. --- client/mysqltest.cc | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 89b9c78a049..1dae7c4c90c 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1445,6 +1445,7 @@ 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. + Takes name of diff program as argument We run diff -v and look for output in stdout. We don't redirect stderr to stdout to make for a simplified check @@ -1452,11 +1453,12 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...) not present. */ -int diff_check() +int diff_check (const char *diff_name) { char buf[512]= {0}; FILE *res_file; - const char *cmd = "diff -v"; + char cmd[128]; + my_snprintf (cmd, sizeof(cmd), "%s -v", diff_name); int have_diff = 0; if (!(res_file= popen(cmd, "r"))) @@ -1488,7 +1490,7 @@ void show_diff(DYNAMIC_STRING* ds, const char* filename1, const char* filename2) { DYNAMIC_STRING ds_tmp; - int have_diff = 0; + const char *diff_name = 0; if (init_dynamic_string(&ds_tmp, "", 256, 256)) die("Out of memory"); @@ -1501,15 +1503,20 @@ void show_diff(DYNAMIC_STRING* ds, the way it's implemented does not work with default 'diff' on Solaris. */ #ifdef __WIN__ - have_diff = diff_check(); + if (diff_check("diff")) + diff_name = "diff"; + else if (diff_check("mtrdiff")) + diff_name = "mtrdiff"; + else + diff_name = 0; #else - have_diff = 1; + diff_name = "diff"; // Otherwise always assume it's called diff #endif - if (have_diff) + if (diff_name) { /* First try with unified diff */ - if (run_tool("diff", + if (run_tool(diff_name, &ds_tmp, /* Get output from diff in ds_tmp */ "-u", filename1, @@ -1520,7 +1527,7 @@ void show_diff(DYNAMIC_STRING* ds, dynstr_set(&ds_tmp, ""); /* Fallback to context diff with "diff -c" */ - if (run_tool("diff", + if (run_tool(diff_name, &ds_tmp, /* Get output from diff in ds_tmp */ "-c", filename1, @@ -1531,20 +1538,20 @@ void show_diff(DYNAMIC_STRING* ds, dynstr_set(&ds_tmp, ""); /* Fallback to simple diff with "diff" */ - if (run_tool("diff", + if (run_tool(diff_name, &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; + diff_name= 0; } } } } - if (! have_diff) + if (! diff_name) { /* Fallback to dump both files to result file and inform From 8b9502ae58fad3857c6c0567700d158415f2d4c0 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 12 Mar 2009 16:07:13 +0100 Subject: [PATCH 2/4] Bug #43597 Fix for Bug 43410 breaks build on Power Mac due to incomplete sys/resource.h Added include of sys/time.h --- mysql-test/lib/My/SafeProcess/safe_process.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 6ad45a3226e..dc7b7da28c7 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -45,6 +45,7 @@ #include #include +#include #include #include #include From aa640b7d0b2f490a972e252d5e783c96d0b0f916 Mon Sep 17 00:00:00 2001 From: Magnus Svensson Date: Fri, 13 Mar 2009 16:06:50 +0100 Subject: [PATCH 3/4] Bug#43361 msyql_client_test output lost - Print the output(if any) from the command that failed, in many cases this will make it possible to immediately see what went wrong. --- client/mysqltest.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 89b9c78a049..3dcffada2fb 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2653,7 +2653,8 @@ void do_exec(struct st_command *command) log_msg("exec of '%s' failed, error: %d, status: %d, errno: %d", ds_cmd.str, error, status, errno); dynstr_free(&ds_cmd); - die("command \"%s\" failed", command->first_argument); + die("command \"%s\" failed\n\nOutput from before failure:\n%s\n", + command->first_argument, ds_res.str); } DBUG_PRINT("info", From eb5ef513271a23a06aa7369175fbdbf799218446 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 19 Mar 2009 15:19:53 +0300 Subject: [PATCH 4/4] Fix default.conf --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 63057f42ac6..f044f8e62da 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1-mtr" +tree_name = "mysql-5.1"