Message ID | 20200318132722.3089925-3-niklas.soderlund+renesas@ragnatech.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | v4l2-compliance: add tests for V4L2_CAP_IO_MC | expand |
Hi Niklas, Thank you for the patch. On Wed, Mar 18, 2020 at 02:27:22PM +0100, Niklas Söderlund wrote: > Add tests to check the behavior of VIDIOC_ENUM{INPUT,OUTPUT}, > VIDIOC_G_{INPUT,OUTPUT} and VIDIOC_S_{INPUT,OUTPUT} when the > V4L2_CAP_IO_MC is set. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > utils/v4l2-compliance/v4l2-test-input-output.cpp | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp > index 2bf338e6f6d7ec5a..bf937abec320f88a 100644 > --- a/utils/v4l2-compliance/v4l2-test-input-output.cpp > +++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp > @@ -466,6 +466,13 @@ int testInput(struct node *node) > if (!node->inputs && node->has_inputs) > return fail("no inputs found, but input capabilities set\n"); > fail_on_test(node->is_m2m && node->inputs > 1); > + if (node->g_caps() & V4L2_CAP_IO_MC) { > + if (!node->is_video && !node->is_meta) > + return fail("media device controls none video or meta input\n"); I'm not sure how to parse this message (and the equivalent below). And I think this check belongs to a test dedicated to V4L2_CAP_IO_MC, verifying that only video and metadata nodes set V4L2_CAP_IO_MC isn't related to testing inputs. Same below. > + > + if (!node->is_meta && node->inputs != 1) > + return fail("media device controlled input have %d inputs\n", node->inputs); This part belongs here, but the message needs to be improved, it's both hard to parse, and not very informative for the user. Same below. Good news, with the VIDIOC_ENUM_FMT extension that depends on V4L2_CAP_IO_MC, we'll have more test cases for V4L2_CAP_IO_MC ;-) > + } > return 0; > } > > @@ -836,6 +843,13 @@ int testOutput(struct node *node) > if (!node->outputs && node->has_outputs) > return fail("no outputs found, but output capabilities set\n"); > fail_on_test(node->is_m2m && node->outputs > 1); > + if (node->g_caps() & V4L2_CAP_IO_MC) { > + if (!node->is_video && !node->is_meta) > + return fail("media device controls none video or meta output\n"); > + > + if (!node->is_meta && node->outputs != 1) > + return fail("media device controlled output have %d outputs\n", node->outputs); > + } > return 0; > } >
On 18/03/2020 14:27, Niklas Söderlund wrote: > Add tests to check the behavior of VIDIOC_ENUM{INPUT,OUTPUT}, > VIDIOC_G_{INPUT,OUTPUT} and VIDIOC_S_{INPUT,OUTPUT} when the > V4L2_CAP_IO_MC is set. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > utils/v4l2-compliance/v4l2-test-input-output.cpp | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp > index 2bf338e6f6d7ec5a..bf937abec320f88a 100644 > --- a/utils/v4l2-compliance/v4l2-test-input-output.cpp > +++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp > @@ -466,6 +466,13 @@ int testInput(struct node *node) > if (!node->inputs && node->has_inputs) > return fail("no inputs found, but input capabilities set\n"); > fail_on_test(node->is_m2m && node->inputs > 1); > + if (node->g_caps() & V4L2_CAP_IO_MC) { > + if (!node->is_video && !node->is_meta) > + return fail("media device controls none video or meta input\n"); > + > + if (!node->is_meta && node->inputs != 1) > + return fail("media device controlled input have %d inputs\n", node->inputs); Just replace this with: fail_on_test(!node->is_video && !node->is_meta); fail_on_test(node->inputs != 1); > + } > return 0; > } > > @@ -836,6 +843,13 @@ int testOutput(struct node *node) > if (!node->outputs && node->has_outputs) > return fail("no outputs found, but output capabilities set\n"); > fail_on_test(node->is_m2m && node->outputs > 1); > + if (node->g_caps() & V4L2_CAP_IO_MC) { > + if (!node->is_video && !node->is_meta) > + return fail("media device controls none video or meta output\n"); > + > + if (!node->is_meta && node->outputs != 1) > + return fail("media device controlled output have %d outputs\n", node->outputs); Ditto. > + } > return 0; > } > > Regards, Hans
diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp index 2bf338e6f6d7ec5a..bf937abec320f88a 100644 --- a/utils/v4l2-compliance/v4l2-test-input-output.cpp +++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp @@ -466,6 +466,13 @@ int testInput(struct node *node) if (!node->inputs && node->has_inputs) return fail("no inputs found, but input capabilities set\n"); fail_on_test(node->is_m2m && node->inputs > 1); + if (node->g_caps() & V4L2_CAP_IO_MC) { + if (!node->is_video && !node->is_meta) + return fail("media device controls none video or meta input\n"); + + if (!node->is_meta && node->inputs != 1) + return fail("media device controlled input have %d inputs\n", node->inputs); + } return 0; } @@ -836,6 +843,13 @@ int testOutput(struct node *node) if (!node->outputs && node->has_outputs) return fail("no outputs found, but output capabilities set\n"); fail_on_test(node->is_m2m && node->outputs > 1); + if (node->g_caps() & V4L2_CAP_IO_MC) { + if (!node->is_video && !node->is_meta) + return fail("media device controls none video or meta output\n"); + + if (!node->is_meta && node->outputs != 1) + return fail("media device controlled output have %d outputs\n", node->outputs); + } return 0; }
Add tests to check the behavior of VIDIOC_ENUM{INPUT,OUTPUT}, VIDIOC_G_{INPUT,OUTPUT} and VIDIOC_S_{INPUT,OUTPUT} when the V4L2_CAP_IO_MC is set. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> --- utils/v4l2-compliance/v4l2-test-input-output.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+)