Skip to contentSkip to conversation

kselftests: dmabuf-heaps: Fix confused return value on expected error testing

PATCH In review John Stultz 2 participants 2 messages May 8, 2020 – May 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kselftests: dmabuf-heaps: Fix confused return value on expected error testing

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 <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Benjamin Gaignard <[email protected]>
Cc Brian Starkey <[email protected]>
Cc Laura Abbott <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
---
 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c +1 -0
index cd5e1f602ac9..909da9cdda97 100644
@@ -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);
Signature · 1 line
2.17.1
reviewer
#1 lore raw

Hi John,

Quoted 6 lines · John Stultz

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

Quoted 27 lines
Cc Shuah Khan <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Benjamin Gaignard <[email protected]>
Cc Brian Starkey <[email protected]>
Cc Laura Abbott <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
---
 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c +1 -0
index cd5e1f602ac9..909da9cdda97 100644
@@ -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);
Signature · 1 line
2.17.1