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
6010bd18
Commit
6010bd18
authored
Jun 05, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
automerge
parents
07f33a21
9c7d7d4e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
48 deletions
+55
-48
client/mysqltest.c
client/mysqltest.c
+55
-48
No files found.
client/mysqltest.c
View file @
6010bd18
...
@@ -1340,17 +1340,19 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
...
@@ -1340,17 +1340,19 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
not present.
not present.
*/
*/
int
diff_check
()
int
diff_check
(
const
char
*
diff_name
)
{
{
char
buf
[
512
]
=
{
0
};
char
buf
[
512
]
=
{
0
};
FILE
*
res_file
;
FILE
*
res_file
;
const
char
*
cmd
=
"diff -v"
;
char
cmd
[
128
];
my_snprintf
(
cmd
,
sizeof
(
cmd
),
"%s -v"
,
diff_name
);
int
have_diff
=
0
;
int
have_diff
=
0
;
if
(
!
(
res_file
=
popen
(
cmd
,
"r"
)))
if
(
!
(
res_file
=
popen
(
cmd
,
"r"
)))
die
(
"popen(
\"
%s
\"
,
\"
r
\"
) failed"
,
cmd
);
die
(
"popen(
\"
%s
\"
,
\"
r
\"
) failed"
,
cmd
);
/* if diff is not present, nothing will be in stdout to increment have_diff */
/* if diff is not present, nothing will be in
* stdout to increment have_diff */
if
(
fgets
(
buf
,
sizeof
(
buf
),
res_file
))
if
(
fgets
(
buf
,
sizeof
(
buf
),
res_file
))
{
{
have_diff
+=
1
;
have_diff
+=
1
;
...
@@ -1377,7 +1379,7 @@ void show_diff(DYNAMIC_STRING* ds,
...
@@ -1377,7 +1379,7 @@ void show_diff(DYNAMIC_STRING* ds,
{
{
DYNAMIC_STRING
ds_tmp
;
DYNAMIC_STRING
ds_tmp
;
int
have_diff
=
0
;
const
char
*
diff_name
=
0
;
if
(
init_dynamic_string
(
&
ds_tmp
,
""
,
256
,
256
))
if
(
init_dynamic_string
(
&
ds_tmp
,
""
,
256
,
256
))
die
(
"Out of memory"
);
die
(
"Out of memory"
);
...
@@ -1390,15 +1392,20 @@ void show_diff(DYNAMIC_STRING* ds,
...
@@ -1390,15 +1392,20 @@ void show_diff(DYNAMIC_STRING* ds,
the way it's implemented does not work with default 'diff' on Solaris.
the way it's implemented does not work with default 'diff' on Solaris.
*/
*/
#ifdef __WIN__
#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
#else
have_diff
=
1
;
diff_name
=
"diff"
;
// Otherwise always assume it's called diff
#endif
#endif
if
(
have_diff
)
if
(
diff_name
)
{
{
/* First try with unified diff */
/* First try with unified diff */
if
(
run_tool
(
"diff"
,
if
(
run_tool
(
diff_name
,
&
ds_tmp
,
/* Get output from diff in ds_tmp */
&
ds_tmp
,
/* Get output from diff in ds_tmp */
"-u"
,
"-u"
,
filename1
,
filename1
,
...
@@ -1409,7 +1416,7 @@ void show_diff(DYNAMIC_STRING* ds,
...
@@ -1409,7 +1416,7 @@ void show_diff(DYNAMIC_STRING* ds,
dynstr_set
(
&
ds_tmp
,
""
);
dynstr_set
(
&
ds_tmp
,
""
);
/* Fallback to context diff with "diff -c" */
/* 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 */
&
ds_tmp
,
/* Get output from diff in ds_tmp */
"-c"
,
"-c"
,
filename1
,
filename1
,
...
@@ -1417,12 +1424,12 @@ void show_diff(DYNAMIC_STRING* ds,
...
@@ -1417,12 +1424,12 @@ void show_diff(DYNAMIC_STRING* ds,
"2>&1"
,
"2>&1"
,
NULL
)
>
1
)
/* Most "diff" tools return >1 if error */
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
Fallback to dump both files to result file and inform
...
@@ -1432,16 +1439,16 @@ if (!(have_diff))
...
@@ -1432,16 +1439,16 @@ if (!(have_diff))
dynstr_set
(
&
ds_tmp
,
""
);
dynstr_set
(
&
ds_tmp
,
""
);
dynstr_append
(
&
ds_tmp
,
dynstr_append
(
&
ds_tmp
,
"
\n
"
"
\n
"
"The two files differ but it was not possible to execute 'diff' in
\n
"
"The two files differ but it was not possible to execute 'diff' in
\n
"
"order to show only the difference, tried both 'diff -u' or 'diff -c'.
\n
"
"order to show only the difference, tried both 'diff -u' or 'diff -c'.
\n
"
"Instead the whole content of the two files was shown for you to diff manually. ;)
\n\n
"
"Instead the whole content of the two files was shown for you to diff manually. ;)
\n\n
"
"To get a better report you should install 'diff' on your system, which you
\n
"
"To get a better report you should install 'diff' on your system, which you
\n
"
"for example can get from http://www.gnu.org/software/diffutils/diffutils.html
\n
"
"for example can get from http://www.gnu.org/software/diffutils/diffutils.html
\n
"
#ifdef __WIN__
#ifdef __WIN__
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm
\n
"
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm
\n
"
#endif
#endif
"
\n
"
);
"
\n
"
);
dynstr_append
(
&
ds_tmp
,
" --- "
);
dynstr_append
(
&
ds_tmp
,
" --- "
);
dynstr_append
(
&
ds_tmp
,
filename1
);
dynstr_append
(
&
ds_tmp
,
filename1
);
...
...
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