benchtests: Set float type on --threshold argument

Message ID 20181004214036.6611-1-leonardo.sandoval.gonzalez@linux.intel.com
State New, archived
Headers

Commit Message

leonardo.sandoval.gonzalez@linux.intel.com Oct. 4, 2018, 9:40 p.m. UTC
  From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

Otherwise, we see the following runtime error when using the parameter:

  File "./glibc/benchtests/scripts/compare_bench.py", line 46, in do_compare
    if d > threshold:
TypeError: '>' not supported between instances of 'float' and 'str'

	* benchtests/scripts/compare_bench.py (main): set float type on
	threshold argument.
---
 benchtests/scripts/compare_bench.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar Oct. 5, 2018, 9:56 a.m. UTC | #1
On 05/10/18 3:10 AM, leonardo.sandoval.gonzalez@linux.intel.com wrote:
> From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
> 
> Otherwise, we see the following runtime error when using the parameter:
> 
>    File "./glibc/benchtests/scripts/compare_bench.py", line 46, in do_compare
>      if d > threshold:
> TypeError: '>' not supported between instances of 'float' and 'str'
> 
> 	* benchtests/scripts/compare_bench.py (main): set float type on
> 	threshold argument.

Looks good to me.

Thanks,
Siddhesh

> ---
>   benchtests/scripts/compare_bench.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/benchtests/scripts/compare_bench.py b/benchtests/scripts/compare_bench.py
> index 88e8911d812..f4b7742f903 100755
> --- a/benchtests/scripts/compare_bench.py
> +++ b/benchtests/scripts/compare_bench.py
> @@ -175,7 +175,7 @@ if __name__ == '__main__':
>       parser.add_argument('--schema',
>                           default=os.path.join(os.path.dirname(os.path.realpath(__file__)),'benchout.schema.json'),
>                           help='JSON file to validate source/dest files (default: %(default)s)')
> -    parser.add_argument('--threshold', default=10.0, help='Only print those with equal or higher threshold (default: %(default)s)')
> +    parser.add_argument('--threshold', default=10.0, type=float, help='Only print those with equal or higher threshold (default: %(default)s)')
>   
>       args = parser.parse_args()
>   
>
  

Patch

diff --git a/benchtests/scripts/compare_bench.py b/benchtests/scripts/compare_bench.py
index 88e8911d812..f4b7742f903 100755
--- a/benchtests/scripts/compare_bench.py
+++ b/benchtests/scripts/compare_bench.py
@@ -175,7 +175,7 @@  if __name__ == '__main__':
     parser.add_argument('--schema',
                         default=os.path.join(os.path.dirname(os.path.realpath(__file__)),'benchout.schema.json'),
                         help='JSON file to validate source/dest files (default: %(default)s)')
-    parser.add_argument('--threshold', default=10.0, help='Only print those with equal or higher threshold (default: %(default)s)')
+    parser.add_argument('--threshold', default=10.0, type=float, help='Only print those with equal or higher threshold (default: %(default)s)')
 
     args = parser.parse_args()