* [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf()
@ 2014-07-09 10:45 Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 2/4] core: Put the requirement failure messages together Damien Lespiau
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Damien Lespiau @ 2014-07-09 10:45 UTC (permalink / raw)
To: intel-gfx
We were leaking a bit.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
lib/igt_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 7ac7ebe..364cdd0 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -591,6 +591,8 @@ void __igt_skip_check(const char *file, const int line,
"Last errno: %i, %s\n"
"Test requirement: (%s)\n%s",
func, file, line, err, strerror(err), check, buf);
+
+ free(buf);
} else {
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Last errno: %i, %s\n"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t 2/4] core: Put the requirement failure messages together
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
@ 2014-07-09 10:45 ` Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 3/4] core: Only display the errno message if errno is set Damien Lespiau
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Damien Lespiau @ 2014-07-09 10:45 UTC (permalink / raw)
To: intel-gfx
The errno message was a bit in the middle here, it makes more sense to
group the messages about why the test requirement wasn't met together.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
lib/igt_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 364cdd0..4dbcb1a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -588,16 +588,16 @@ void __igt_skip_check(const char *file, const int line,
va_end(args);
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
- "Last errno: %i, %s\n"
- "Test requirement: (%s)\n%s",
- func, file, line, err, strerror(err), check, buf);
+ "Test requirement: (%s)\n%s"
+ "Last errno: %i, %s\n",
+ func, file, line, check, buf, err, strerror(err));
free(buf);
} else {
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
- "Last errno: %i, %s\n"
- "Test requirement: (%s)\n",
- func, file, line, err, strerror(err), check);
+ "Test requirement: (%s)\n"
+ "Last errno: %i, %s\n",
+ func, file, line, check, err, strerror(err));
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t 3/4] core: Only display the errno message if errno is set
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 2/4] core: Put the requirement failure messages together Damien Lespiau
@ 2014-07-09 10:45 ` Damien Lespiau
2014-07-09 11:57 ` Daniel Vetter
2014-07-09 10:45 ` [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert() Damien Lespiau
2014-07-09 11:56 ` [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Daniel Vetter
3 siblings, 1 reply; 9+ messages in thread
From: Damien Lespiau @ 2014-07-09 10:45 UTC (permalink / raw)
To: intel-gfx
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
lib/igt_core.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4dbcb1a..e66d096 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -575,6 +575,10 @@ void __igt_skip_check(const char *file, const int line,
{
va_list args;
int err = errno;
+ char *err_str = NULL;
+
+ if (err)
+ asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
if (f) {
static char *buf;
@@ -589,16 +593,18 @@ void __igt_skip_check(const char *file, const int line,
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Test requirement: (%s)\n%s"
- "Last errno: %i, %s\n",
- func, file, line, check, buf, err, strerror(err));
+ "%s",
+ func, file, line, check, buf, err_str ?: "");
free(buf);
} else {
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Test requirement: (%s)\n"
- "Last errno: %i, %s\n",
- func, file, line, check, err, strerror(err));
+ "%s",
+ func, file, line, check, err_str ?: "");
}
+
+ free(err_str);
}
/**
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert()
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 2/4] core: Put the requirement failure messages together Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 3/4] core: Only display the errno message if errno is set Damien Lespiau
@ 2014-07-09 10:45 ` Damien Lespiau
2014-07-09 11:58 ` Daniel Vetter
2014-07-09 11:56 ` [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Daniel Vetter
3 siblings, 1 reply; 9+ messages in thread
From: Damien Lespiau @ 2014-07-09 10:45 UTC (permalink / raw)
To: intel-gfx
Just like the it was done for the requirement message, display the errno
message only if errno is set, and display it at the end of the assert
message.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
lib/igt_core.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index e66d096..53f750a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -682,11 +682,17 @@ void __igt_fail_assert(int exitcode, const char *file,
{
va_list args;
int err = errno;
+ char *err_str = NULL;
+
+ if (err)
+ asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
printf("Test assertion failure function %s, file %s:%i:\n"
- "Last errno: %i, %s\n"
- "Failed assertion: %s\n",
- func, file, line, err, strerror(err), assertion);
+ "Failed assertion: %s\n"
+ "%s",
+ func, file, line, assertion, err_str ?: "");
+
+ free(err_str);
if (f) {
va_start(args, f);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf()
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
` (2 preceding siblings ...)
2014-07-09 10:45 ` [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert() Damien Lespiau
@ 2014-07-09 11:56 ` Daniel Vetter
2014-07-09 12:06 ` Damien Lespiau
3 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2014-07-09 11:56 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx
On Wed, Jul 09, 2014 at 11:45:18AM +0100, Damien Lespiau wrote:
> We were leaking a bit.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> lib/igt_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 7ac7ebe..364cdd0 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -591,6 +591,8 @@ void __igt_skip_check(const char *file, const int line,
> "Last errno: %i, %s\n"
> "Test requirement: (%s)\n%s",
> func, file, line, err, strerror(err), check, buf);
> +
> + free(buf);
igt_skip is noreturn, i.e. this adds dead code. No idea how this fix this
without causing a mess.
/me summons the devil and wishes for a garbage collector
> } else {
> igt_skip("Test requirement not met in function %s, file %s:%i:\n"
> "Last errno: %i, %s\n"
> --
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t 3/4] core: Only display the errno message if errno is set
2014-07-09 10:45 ` [PATCH i-g-t 3/4] core: Only display the errno message if errno is set Damien Lespiau
@ 2014-07-09 11:57 ` Daniel Vetter
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2014-07-09 11:57 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx
On Wed, Jul 09, 2014 at 11:45:20AM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> lib/igt_core.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 4dbcb1a..e66d096 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -575,6 +575,10 @@ void __igt_skip_check(const char *file, const int line,
> {
> va_list args;
> int err = errno;
> + char *err_str = NULL;
> +
> + if (err)
> + asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
>
> if (f) {
> static char *buf;
> @@ -589,16 +593,18 @@ void __igt_skip_check(const char *file, const int line,
>
> igt_skip("Test requirement not met in function %s, file %s:%i:\n"
> "Test requirement: (%s)\n%s"
> - "Last errno: %i, %s\n",
> - func, file, line, check, buf, err, strerror(err));
> + "%s",
> + func, file, line, check, buf, err_str ?: "");
>
> free(buf);
> } else {
> igt_skip("Test requirement not met in function %s, file %s:%i:\n"
> "Test requirement: (%s)\n"
> - "Last errno: %i, %s\n",
> - func, file, line, check, err, strerror(err));
> + "%s",
> + func, file, line, check, err_str ?: "");
> }
> +
> + free(err_str);
Same issue about dead code. But I like the idea.
-Daniel
> }
>
> /**
> --
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert()
2014-07-09 10:45 ` [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert() Damien Lespiau
@ 2014-07-09 11:58 ` Daniel Vetter
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2014-07-09 11:58 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx
On Wed, Jul 09, 2014 at 11:45:21AM +0100, Damien Lespiau wrote:
> Just like the it was done for the requirement message, display the errno
> message only if errno is set, and display it at the end of the assert
> message.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Patches 2&4 are Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>, patch
3 is imo ok with the free dropped.
-Daniel
> ---
> lib/igt_core.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index e66d096..53f750a 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -682,11 +682,17 @@ void __igt_fail_assert(int exitcode, const char *file,
> {
> va_list args;
> int err = errno;
> + char *err_str = NULL;
> +
> + if (err)
> + asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
>
> printf("Test assertion failure function %s, file %s:%i:\n"
> - "Last errno: %i, %s\n"
> - "Failed assertion: %s\n",
> - func, file, line, err, strerror(err), assertion);
> + "Failed assertion: %s\n"
> + "%s",
> + func, file, line, assertion, err_str ?: "");
> +
> + free(err_str);
>
> if (f) {
> va_start(args, f);
> --
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf()
2014-07-09 11:56 ` [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Daniel Vetter
@ 2014-07-09 12:06 ` Damien Lespiau
2014-07-09 12:14 ` Daniel Vetter
0 siblings, 1 reply; 9+ messages in thread
From: Damien Lespiau @ 2014-07-09 12:06 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx
On Wed, Jul 09, 2014 at 01:56:02PM +0200, Daniel Vetter wrote:
> On Wed, Jul 09, 2014 at 11:45:18AM +0100, Damien Lespiau wrote:
> > We were leaking a bit.
> >
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> > ---
> > lib/igt_core.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 7ac7ebe..364cdd0 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -591,6 +591,8 @@ void __igt_skip_check(const char *file, const int line,
> > "Last errno: %i, %s\n"
> > "Test requirement: (%s)\n%s",
> > func, file, line, err, strerror(err), check, buf);
> > +
> > + free(buf);
>
> igt_skip is noreturn, i.e. this adds dead code. No idea how this fix this
> without causing a mess.
>
> /me summons the devil and wishes for a garbage collector
Oh well, if it's no return it'll be freed for us anwyay. Will push the
other ones with the free removed in the last one.
--
Damien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf()
2014-07-09 12:06 ` Damien Lespiau
@ 2014-07-09 12:14 ` Daniel Vetter
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2014-07-09 12:14 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx
On Wed, Jul 09, 2014 at 01:06:08PM +0100, Damien Lespiau wrote:
> On Wed, Jul 09, 2014 at 01:56:02PM +0200, Daniel Vetter wrote:
> > On Wed, Jul 09, 2014 at 11:45:18AM +0100, Damien Lespiau wrote:
> > > We were leaking a bit.
> > >
> > > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> > > ---
> > > lib/igt_core.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 7ac7ebe..364cdd0 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -591,6 +591,8 @@ void __igt_skip_check(const char *file, const int line,
> > > "Last errno: %i, %s\n"
> > > "Test requirement: (%s)\n%s",
> > > func, file, line, err, strerror(err), check, buf);
> > > +
> > > + free(buf);
> >
> > igt_skip is noreturn, i.e. this adds dead code. No idea how this fix this
> > without causing a mess.
> >
> > /me summons the devil and wishes for a garbage collector
>
> Oh well, if it's no return it'll be freed for us anwyay. Will push the
> other ones with the free removed in the last one.
Well it does a longjump and will continue execution with the next subtest.
It's only a process exit if this isn't a subtest igt binary.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-07-09 12:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 2/4] core: Put the requirement failure messages together Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 3/4] core: Only display the errno message if errno is set Damien Lespiau
2014-07-09 11:57 ` Daniel Vetter
2014-07-09 10:45 ` [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert() Damien Lespiau
2014-07-09 11:58 ` Daniel Vetter
2014-07-09 11:56 ` [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Daniel Vetter
2014-07-09 12:06 ` Damien Lespiau
2014-07-09 12:14 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox