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
390a0ede
Commit
390a0ede
authored
Apr 05, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect against dying twice
Cleanup exit handling
parent
b5d13fcb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
33 deletions
+52
-33
client/mysqltest.c
client/mysqltest.c
+52
-33
No files found.
client/mysqltest.c
View file @
390a0ede
...
@@ -792,27 +792,65 @@ void free_used_memory()
...
@@ -792,27 +792,65 @@ void free_used_memory()
}
}
static
void
cleanup_and_exit
(
int
exit_code
)
{
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
if
(
!
silent
)
{
switch
(
exit_code
)
{
case
1
:
printf
(
"not ok
\n
"
);
break
;
case
0
:
printf
(
"ok
\n
"
);
break
;
case
62
:
printf
(
"skipped
\n
"
);
break
;
default:
printf
(
"unknown exit code: %d
\n
"
,
exit_code
);
DBUG_ASSERT
(
0
);
}
}
exit
(
exit_code
);
}
void
die
(
const
char
*
fmt
,
...)
void
die
(
const
char
*
fmt
,
...)
{
{
static
int
dying
=
0
;
va_list
args
;
va_list
args
;
DBUG_ENTER
(
"die"
);
DBUG_ENTER
(
"die"
);
DBUG_PRINT
(
"enter"
,
(
"start_lineno: %d"
,
start_lineno
));
DBUG_PRINT
(
"enter"
,
(
"start_lineno: %d"
,
start_lineno
));
/*
Protect against dying twice
first time 'die' is called, try to write log files
second time, just exit
*/
if
(
dying
)
cleanup_and_exit
(
1
);
/* Print the error message */
/* Print the error message */
va_start
(
args
,
fmt
);
if
(
fmt
)
{
fprintf
(
stderr
,
"mysqltest: "
);
fprintf
(
stderr
,
"mysqltest: "
);
if
(
cur_file
&&
cur_file
!=
file_stack
)
if
(
cur_file
&&
cur_file
!=
file_stack
)
fprintf
(
stderr
,
"In included file
\"
%s
\"
: "
,
fprintf
(
stderr
,
"In included file
\"
%s
\"
: "
,
cur_file
->
file_name
);
cur_file
->
file_name
);
if
(
start_lineno
>
0
)
if
(
start_lineno
>
0
)
fprintf
(
stderr
,
"At line %u: "
,
start_lineno
);
fprintf
(
stderr
,
"At line %u: "
,
start_lineno
);
if
(
fmt
)
{
va_start
(
args
,
fmt
);
vfprintf
(
stderr
,
fmt
,
args
);
vfprintf
(
stderr
,
fmt
,
args
);
va_end
(
args
);
}
else
fprintf
(
stderr
,
"unknown error"
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
fflush
(
stderr
);
fflush
(
stderr
);
}
va_end
(
args
);
/* Dump the result that has been accumulated so far to .log file */
/* Dump the result that has been accumulated so far to .log file */
if
(
result_file_name
&&
ds_res
.
length
)
if
(
result_file_name
&&
ds_res
.
length
)
...
@@ -822,14 +860,7 @@ void die(const char *fmt, ...)
...
@@ -822,14 +860,7 @@ void die(const char *fmt, ...)
if
(
result_file_name
&&
ds_warning_messages
.
length
)
if
(
result_file_name
&&
ds_warning_messages
.
length
)
dump_warning_messages
();
dump_warning_messages
();
/* Clean up and exit */
cleanup_and_exit
(
1
);
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
if
(
!
silent
)
printf
(
"not ok
\n
"
);
exit
(
1
);
}
}
...
@@ -862,14 +893,7 @@ void abort_not_supported_test(const char *fmt, ...)
...
@@ -862,14 +893,7 @@ void abort_not_supported_test(const char *fmt, ...)
}
}
va_end
(
args
);
va_end
(
args
);
/* Clean up and exit */
cleanup_and_exit
(
62
);
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
if
(
!
silent
)
printf
(
"skipped
\n
"
);
exit
(
62
);
}
}
...
@@ -6375,14 +6399,9 @@ int main(int argc, char **argv)
...
@@ -6375,14 +6399,9 @@ int main(int argc, char **argv)
dynstr_free
(
&
ds_res
);
dynstr_free
(
&
ds_res
);
timer_output
();
timer_output
();
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
/* Yes, if we got this far the test has suceeded! Sakila smiles */
/* Yes, if we got this far the test has suceeded! Sakila smiles */
if
(
!
silent
)
cleanup_and_exit
(
0
);
printf
(
"ok
\n
"
);
return
0
;
/* Keep compiler happy too */
exit
(
0
);
return
0
;
/* Keep compiler happy */
}
}
...
...
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