mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-23 09:56:02 +00:00
lib: Capture errno on entry
When printing the errno, it is important that we capture the user errno before we make any library calls - as they may alter the value. References: https://bugs.freedesktop.org/show_bug.cgi?id=74007 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
be22e10885
commit
48ad03ca0c
@ -1038,6 +1038,7 @@ void __igt_skip_check(const char *file, const int line,
|
|||||||
const char *f, ...)
|
const char *f, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
int err = errno;
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
static char *buf;
|
static char *buf;
|
||||||
@ -1053,12 +1054,12 @@ void __igt_skip_check(const char *file, const int line,
|
|||||||
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
|
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
|
||||||
"Last errno: %i, %s\n"
|
"Last errno: %i, %s\n"
|
||||||
"Test requirement: (%s)\n%s",
|
"Test requirement: (%s)\n%s",
|
||||||
func, file, line, errno, strerror(errno), check, buf);
|
func, file, line, err, strerror(err), check, buf);
|
||||||
} else {
|
} else {
|
||||||
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
|
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
|
||||||
"Last errno: %i, %s\n"
|
"Last errno: %i, %s\n"
|
||||||
"Test requirement: (%s)\n",
|
"Test requirement: (%s)\n",
|
||||||
func, file, line, errno, strerror(errno), check);
|
func, file, line, err, strerror(err), check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,11 +1111,12 @@ void __igt_fail_assert(int exitcode, const char *file,
|
|||||||
const char *f, ...)
|
const char *f, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
int err = errno;
|
||||||
|
|
||||||
printf("Test assertion failure function %s, file %s:%i:\n"
|
printf("Test assertion failure function %s, file %s:%i:\n"
|
||||||
"Last errno: %i, %s\n"
|
"Last errno: %i, %s\n"
|
||||||
"Failed assertion: %s\n",
|
"Failed assertion: %s\n",
|
||||||
func, file, line, errno, strerror(errno), assertion);
|
func, file, line, err, strerror(err), assertion);
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
va_start(args, f);
|
va_start(args, f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user