[Piglit] [PATCH] generated_tests/builtin_function.py: hide RuntimeWarnings
Vinson Lee
vlee at freedesktop.org
Tue Nov 10 12:37:31 PST 2015
On Fri, Nov 6, 2015 at 12:35 PM, <baker.dylan.c at gmail.com> wrote:
> From: Dylan Baker <baker.dylan.c at gmail.com>
>
> These warnings are expected, it's better to hide expected warnings and
> provide a comment about them being expected than to have them clutter
> the output of the build system.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>
> The fact that these are expected is based off of a comment Paul Berry
> made to me in the past, not of my personal knowledge of the generators.
> Since he wrote this module I expect that he knew what he was talking
> about.
>
> generated_tests/builtin_function.py | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
> index 2b69c49..40ef70f 100644
> --- a/generated_tests/builtin_function.py
> +++ b/generated_tests/builtin_function.py
> @@ -52,6 +52,7 @@ from __future__ import print_function, division, absolute_import
> import collections
> import itertools
> import functools
> +import warnings
>
> from six.moves import range
> import numpy as np
> @@ -1279,10 +1280,13 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
> [floats+vecs+mats+ints+ivecs+uints+uvecs,
> floats+vecs+mats+ints+ivecs+uints+uvecs],
> template='{0};\n result += {1}')
> - f('op-assign-sub', 2, 110, lambda x, y: x - y, match_assignment_operators,
> - [floats+vecs+mats+ints+ivecs+uints+uvecs,
> - floats+vecs+mats+ints+ivecs+uints+uvecs],
> - template='{0};\n result -= {1}')
> + # This can generate an overflow warning, this is expected
> + with warnings.catch_warnings(RuntimeWarning):
> + f('op-assign-sub', 2, 110,
> + lambda x, y: x - y, match_assignment_operators,
> + [floats+vecs+mats+ints+ivecs+uints+uvecs,
> + floats+vecs+mats+ints+ivecs+uints+uvecs],
> + template='{0};\n result -= {1}')
> f('op-assign-mult', 2, 110, _multiply, match_assignment_multiply,
> [floats+vecs+mats+ints+ivecs+uints+uvecs,
> floats+vecs+mats+ints+ivecs+uints+uvecs],
> @@ -1321,10 +1325,12 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
> [floats+vecs+mats+ints+ivecs+uints+uvecs,
> floats+vecs+mats+ints+ivecs+uints+uvecs],
> template='({0} + {1})')
> - f('op-sub', 2, 110, lambda x, y: x - y, match_simple_binop,
> - [floats+vecs+mats+ints+ivecs+uints+uvecs,
> - floats+vecs+mats+ints+ivecs+uints+uvecs],
> - template='({0} - {1})')
> + # This can generate an overflow warning, this is expected
> + with warnings.catch_warnings(RuntimeWarning):
> + f('op-sub', 2, 110, lambda x, y: x - y, match_simple_binop,
> + [floats+vecs+mats+ints+ivecs+uints+uvecs,
> + floats+vecs+mats+ints+ivecs+uints+uvecs],
> + template='({0} - {1})')
> f('op-mult', 2, 110, _multiply, match_multiply,
> [floats+vecs+mats+ints+ivecs+uints+uvecs,
> floats+vecs+mats+ints+ivecs+uints+uvecs],
> --
> 2.6.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
I found this comment about the warning.
https://bugs.freedesktop.org/show_bug.cgi?id=40697#c5
Reviewed-by: Vinson Lee <vlee at freedesktop.org>
More information about the Piglit
mailing list