Message ID | 20240325175248.1499046-6-linux@roeck-us.net (mailing list archive) |
---|---|
State | Awaiting Upstream |
Headers | show |
Series | Add support for suppressing warning backtraces | expand |
Hi Guenter, On 3/25/24 14:52, Guenter Roeck wrote: > The drm_test_rect_calc_hscale and drm_test_rect_calc_vscale unit tests > intentionally trigger warning backtraces by providing bad parameters to > the tested functions. What is tested is the return value, not the existence > of a warning backtrace. Suppress the backtraces to avoid clogging the > kernel log. > > Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> > Acked-by: Dan Carpenter <dan.carpenter@linaro.org> > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > - Rebased to v6.9-rc1 > - Added Tested-by:, Acked-by:, and Reviewed-by: tags > > drivers/gpu/drm/tests/drm_rect_test.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c > index 76332cd2ead8..75614cb4deb5 100644 > --- a/drivers/gpu/drm/tests/drm_rect_test.c > +++ b/drivers/gpu/drm/tests/drm_rect_test.c > @@ -406,22 +406,28 @@ KUNIT_ARRAY_PARAM(drm_rect_scale, drm_rect_scale_cases, drm_rect_scale_case_desc > > static void drm_test_rect_calc_hscale(struct kunit *test) > { > + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); > const struct drm_rect_scale_case *params = test->param_value; > int scaling_factor; > > + START_SUPPRESSED_WARNING(drm_calc_scale); I'm not sure if it is not that obvious only to me, but it would be nice to have a comment here, remembering that we provide bad parameters in some test cases. Best Regards, - Maíra > scaling_factor = drm_rect_calc_hscale(¶ms->src, ¶ms->dst, > params->min_range, params->max_range); > + END_SUPPRESSED_WARNING(drm_calc_scale); > > KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); > } > > static void drm_test_rect_calc_vscale(struct kunit *test) > { > + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); > const struct drm_rect_scale_case *params = test->param_value; > int scaling_factor; > > + START_SUPPRESSED_WARNING(drm_calc_scale); > scaling_factor = drm_rect_calc_vscale(¶ms->src, ¶ms->dst, > params->min_range, params->max_range); > + END_SUPPRESSED_WARNING(drm_calc_scale); > > KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); > }
Hi, On Mon, Mar 25, 2024 at 04:05:06PM -0300, Maíra Canal wrote: > Hi Guenter, > > On 3/25/24 14:52, Guenter Roeck wrote: > > The drm_test_rect_calc_hscale and drm_test_rect_calc_vscale unit tests > > intentionally trigger warning backtraces by providing bad parameters to > > the tested functions. What is tested is the return value, not the existence > > of a warning backtrace. Suppress the backtraces to avoid clogging the > > kernel log. > > > > Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> > > Acked-by: Dan Carpenter <dan.carpenter@linaro.org> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > --- > > - Rebased to v6.9-rc1 > > - Added Tested-by:, Acked-by:, and Reviewed-by: tags > > > > drivers/gpu/drm/tests/drm_rect_test.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c > > index 76332cd2ead8..75614cb4deb5 100644 > > --- a/drivers/gpu/drm/tests/drm_rect_test.c > > +++ b/drivers/gpu/drm/tests/drm_rect_test.c > > @@ -406,22 +406,28 @@ KUNIT_ARRAY_PARAM(drm_rect_scale, drm_rect_scale_cases, drm_rect_scale_case_desc > > static void drm_test_rect_calc_hscale(struct kunit *test) > > { > > + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); > > const struct drm_rect_scale_case *params = test->param_value; > > int scaling_factor; > > + START_SUPPRESSED_WARNING(drm_calc_scale); > > I'm not sure if it is not that obvious only to me, but it would be nice > to have a comment here, remembering that we provide bad parameters in > some test cases. Sure. Something like this ? /* * drm_rect_calc_hscale() generates a warning backtrace whenever bad * parameters are passed to it. This affects all unit tests with an * error code in expected_scaling_factor. */ Thanks, Guenter
On 3/25/24 16:24, Guenter Roeck wrote: > Hi, > > On Mon, Mar 25, 2024 at 04:05:06PM -0300, Maíra Canal wrote: >> Hi Guenter, >> >> On 3/25/24 14:52, Guenter Roeck wrote: >>> The drm_test_rect_calc_hscale and drm_test_rect_calc_vscale unit tests >>> intentionally trigger warning backtraces by providing bad parameters to >>> the tested functions. What is tested is the return value, not the existence >>> of a warning backtrace. Suppress the backtraces to avoid clogging the >>> kernel log. >>> >>> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> >>> Acked-by: Dan Carpenter <dan.carpenter@linaro.org> >>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>> --- >>> - Rebased to v6.9-rc1 >>> - Added Tested-by:, Acked-by:, and Reviewed-by: tags >>> >>> drivers/gpu/drm/tests/drm_rect_test.c | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c >>> index 76332cd2ead8..75614cb4deb5 100644 >>> --- a/drivers/gpu/drm/tests/drm_rect_test.c >>> +++ b/drivers/gpu/drm/tests/drm_rect_test.c >>> @@ -406,22 +406,28 @@ KUNIT_ARRAY_PARAM(drm_rect_scale, drm_rect_scale_cases, drm_rect_scale_case_desc >>> static void drm_test_rect_calc_hscale(struct kunit *test) >>> { >>> + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); >>> const struct drm_rect_scale_case *params = test->param_value; >>> int scaling_factor; >>> + START_SUPPRESSED_WARNING(drm_calc_scale); >> >> I'm not sure if it is not that obvious only to me, but it would be nice >> to have a comment here, remembering that we provide bad parameters in >> some test cases. > > Sure. Something like this ? > > /* > * drm_rect_calc_hscale() generates a warning backtrace whenever bad > * parameters are passed to it. This affects all unit tests with an > * error code in expected_scaling_factor. > */ > Yeah, perfect. With that, feel free to add my Acked-by: Maíra Canal <mcanal@igalia.com> Best Regards, - Maíra > Thanks, > Guenter
On 3/25/24 18:09, Maíra Canal wrote: > On 3/25/24 16:24, Guenter Roeck wrote: >> Hi, >> >> On Mon, Mar 25, 2024 at 04:05:06PM -0300, Maíra Canal wrote: >>> Hi Guenter, >>> >>> On 3/25/24 14:52, Guenter Roeck wrote: >>>> The drm_test_rect_calc_hscale and drm_test_rect_calc_vscale unit tests >>>> intentionally trigger warning backtraces by providing bad parameters to >>>> the tested functions. What is tested is the return value, not the existence >>>> of a warning backtrace. Suppress the backtraces to avoid clogging the >>>> kernel log. >>>> >>>> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> >>>> Acked-by: Dan Carpenter <dan.carpenter@linaro.org> >>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>>> --- >>>> - Rebased to v6.9-rc1 >>>> - Added Tested-by:, Acked-by:, and Reviewed-by: tags >>>> >>>> drivers/gpu/drm/tests/drm_rect_test.c | 6 ++++++ >>>> 1 file changed, 6 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c >>>> index 76332cd2ead8..75614cb4deb5 100644 >>>> --- a/drivers/gpu/drm/tests/drm_rect_test.c >>>> +++ b/drivers/gpu/drm/tests/drm_rect_test.c >>>> @@ -406,22 +406,28 @@ KUNIT_ARRAY_PARAM(drm_rect_scale, drm_rect_scale_cases, drm_rect_scale_case_desc >>>> static void drm_test_rect_calc_hscale(struct kunit *test) >>>> { >>>> + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); >>>> const struct drm_rect_scale_case *params = test->param_value; >>>> int scaling_factor; >>>> + START_SUPPRESSED_WARNING(drm_calc_scale); >>> >>> I'm not sure if it is not that obvious only to me, but it would be nice >>> to have a comment here, remembering that we provide bad parameters in >>> some test cases. >> >> Sure. Something like this ? >> >> /* >> * drm_rect_calc_hscale() generates a warning backtrace whenever bad >> * parameters are passed to it. This affects all unit tests with an >> * error code in expected_scaling_factor. >> */ >> > > Yeah, perfect. With that, feel free to add my > > Acked-by: Maíra Canal <mcanal@igalia.com> > Thanks! Guenter
diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c index 76332cd2ead8..75614cb4deb5 100644 --- a/drivers/gpu/drm/tests/drm_rect_test.c +++ b/drivers/gpu/drm/tests/drm_rect_test.c @@ -406,22 +406,28 @@ KUNIT_ARRAY_PARAM(drm_rect_scale, drm_rect_scale_cases, drm_rect_scale_case_desc static void drm_test_rect_calc_hscale(struct kunit *test) { + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); const struct drm_rect_scale_case *params = test->param_value; int scaling_factor; + START_SUPPRESSED_WARNING(drm_calc_scale); scaling_factor = drm_rect_calc_hscale(¶ms->src, ¶ms->dst, params->min_range, params->max_range); + END_SUPPRESSED_WARNING(drm_calc_scale); KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); } static void drm_test_rect_calc_vscale(struct kunit *test) { + DEFINE_SUPPRESSED_WARNING(drm_calc_scale); const struct drm_rect_scale_case *params = test->param_value; int scaling_factor; + START_SUPPRESSED_WARNING(drm_calc_scale); scaling_factor = drm_rect_calc_vscale(¶ms->src, ¶ms->dst, params->min_range, params->max_range); + END_SUPPRESSED_WARNING(drm_calc_scale); KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); }