Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f7cfb8ea
Commit
f7cfb8ea
authored
Mar 23, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merged 5.1-main -> 5.1-bugteam
parents
06cb0ec4
fb87fe81
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
client/mysqltest.cc
client/mysqltest.cc
+20
-12
mysql-test/lib/My/SafeProcess/safe_process.cc
mysql-test/lib/My/SafeProcess/safe_process.cc
+1
-0
No files found.
client/mysqltest.cc
View file @
f7cfb8ea
...
...
@@ -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
...
...
@@ -2653,7 +2660,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\n
Output from before failure:
\n
%s
\n
"
,
command
->
first_argument
,
ds_res
.
str
);
}
DBUG_PRINT
(
"info"
,
...
...
mysql-test/lib/My/SafeProcess/safe_process.cc
View file @
f7cfb8ea
...
...
@@ -45,6 +45,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdarg.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment