linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kselftests: dmabuf-heaps: Fix confused return value on expected error testing
@ 2020-05-08  4:56 John Stultz
  2020-05-13 10:33 ` Brian Starkey
  0 siblings, 1 reply; 2+ messages in thread
From: John Stultz @ 2020-05-08  4:56 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Shuah Khan, Sumit Semwal, Benjamin Gaignard,
	Brian Starkey, Laura Abbott, Andrew F. Davis, linux-kselftest

When I added the expected error testing, I forgot I need to set
the return to zero when we successfully see an error.

Without this change we only end up testing a single heap
before the test quits.

Cc: Shuah Khan <shuah@kernel.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: "Andrew F. Davis" <afd@ti.com>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
index cd5e1f602ac9..909da9cdda97 100644
--- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
@@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name)
 	}
 
 	printf("Expected error checking passed\n");
+	ret = 0;
 out:
 	if (dmabuf_fd >= 0)
 		close(dmabuf_fd);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kselftests: dmabuf-heaps: Fix confused return value on expected error testing
  2020-05-08  4:56 [PATCH] kselftests: dmabuf-heaps: Fix confused return value on expected error testing John Stultz
@ 2020-05-13 10:33 ` Brian Starkey
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Starkey @ 2020-05-13 10:33 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Shuah Khan, Sumit Semwal, Benjamin Gaignard, Laura Abbott,
	Andrew F. Davis, linux-kselftest, nd

Hi John,

On Fri, May 08, 2020 at 04:56:10AM +0000, John Stultz wrote:
> When I added the expected error testing, I forgot I need to set
> the return to zero when we successfully see an error.
> 
> Without this change we only end up testing a single heap
> before the test quits.
> 

The fix looks fine - feel free to add my r-b.

However taking a new look at the tests, what do you think about
conceptually replacing the 'break's with 'continue's? Is there a
reason to skip all the other heaps if one of them fails a test?

Thanks,
-Brian

> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: "Andrew F. Davis" <afd@ti.com>
> Cc: linux-kselftest@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> index cd5e1f602ac9..909da9cdda97 100644
> --- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> +++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> @@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name)
>  	}
>  
>  	printf("Expected error checking passed\n");
> +	ret = 0;
>  out:
>  	if (dmabuf_fd >= 0)
>  		close(dmabuf_fd);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-13 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  4:56 [PATCH] kselftests: dmabuf-heaps: Fix confused return value on expected error testing John Stultz
2020-05-13 10:33 ` Brian Starkey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).