diff mbox series

v4l2-compliance: Kill child after failed streamoff test blocks

Message ID 20200612141107.43344-1-paul.elder@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series v4l2-compliance: Kill child after failed streamoff test blocks | expand

Commit Message

Paul Elder June 12, 2020, 2:11 p.m. UTC
The test to test that a forked child process can do VIDIOC_STREAMOFF
without being blocked does not kill the child in the event of a failure
(ie. the child process blocks on VIDIOC_STREAMOFF). This causes the
video device node to still be in use even after v4l2-compliance
completes execution. Kill the child process after this test fails.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul Elder June 12, 2020, 2:26 p.m. UTC | #1
On Fri, Jun 12, 2020 at 11:11:07PM +0900, Paul Elder wrote:
> The test to test that a forked child process can do VIDIOC_STREAMOFF
> without being blocked does not kill the child in the event of a failure
> (ie. the child process blocks on VIDIOC_STREAMOFF). This causes the
> video device node to still be in use even after v4l2-compliance
> completes execution. Kill the child process after this test fails.

As we just discussed on irc, I'll convert this test to pthreads, so this
patch can be disregarded.


Thanks,

Paul

> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> index fc49fff6..896e8e14 100644
> --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> @@ -2282,6 +2282,8 @@ static int testBlockingDQBuf(struct node *node, cv4l_queue &q)
>  	usleep(250000);
>  	pid = waitpid(pid_streamoff, &wstatus_streamoff, WNOHANG);
>  	kill(pid_dqbuf, SIGKILL);
> +	if (pid != pid_streamoff)
> +		kill(pid_streamoff, SIGKILL);
>  	fail_on_test(pid != pid_streamoff);
>  	/* Test that the second child exited properly */
>  	if (!pid || !WIFEXITED(wstatus_streamoff)) {
> -- 
> 2.27.0
>
diff mbox series

Patch

diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index fc49fff6..896e8e14 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -2282,6 +2282,8 @@  static int testBlockingDQBuf(struct node *node, cv4l_queue &q)
 	usleep(250000);
 	pid = waitpid(pid_streamoff, &wstatus_streamoff, WNOHANG);
 	kill(pid_dqbuf, SIGKILL);
+	if (pid != pid_streamoff)
+		kill(pid_streamoff, SIGKILL);
 	fail_on_test(pid != pid_streamoff);
 	/* Test that the second child exited properly */
 	if (!pid || !WIFEXITED(wstatus_streamoff)) {