avocado-vt icon indicating copy to clipboard operation
avocado-vt copied to clipboard

Fixup: Handle when cpu family returns None

Open sathnaga opened this issue 4 years ago • 1 comments

get_family can return None when it could not detect the cpu family and could result in below issues, let's handle such cases.

14:41:45 WARNI| Could not find micro-architecture/family, Error: [Errno 2] No such file or directory: '/sys/devices/cpu/caps/pmu_name'
14:41:45 ERROR|
14:41:45 ERROR| Reproduced traceback from: /usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/avocado_vt/test.py:462
14:41:45 ERROR| Traceback (most recent call last):
14:41:45 ERROR| File "/usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/avocado_vt/test.py", line 421, in _runTest
14:41:45 ERROR| params = env_process.preprocess(self, params, env)
14:41:45 ERROR| File "/usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/virttest/error_context.py", line 135, in new_fn
14:41:45 ERROR| return fn(*args, **kwargs)
14:41:45 ERROR| File "/usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/virttest/env_process.py", line 936, in preprocess
14:41:45 ERROR| if "power" in cpu_family:
14:41:45 ERROR| TypeError: argument of type 'NoneType' is not iterable
14:41:45 ERROR|
14:41:45 ERROR| During handling of the above exception, another exception occurred:
14:41:45 ERROR|
14:41:45 ERROR| Traceback (most recent call last):
14:41:45 ERROR| File "/usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/virttest/error_context.py", line 135, in new_fn
14:41:45 ERROR| return fn(*args, **kwargs)
14:41:45 ERROR| File "/usr/local/lib/python3.6/site-packages/avocado_framework_plugin_vt-82.0-py3.6.egg/virttest/env_process.py", line 1689, in postprocess
14:41:45 ERROR| if "power" in cpu_family:
14:41:45 ERROR| TypeError: argument of type 'NoneType' is not iterable
14:41:45 ERROR|

Reported-by: Qinghua Cheng [email protected] Signed-off-by: Satheesh Rajendran [email protected]

sathnaga avatar Sep 15 '20 10:09 sathnaga

@sathnaga , this patch fixes the issue. LGTM. Thanks for the quick fix.

qcheng-redhat avatar Sep 15 '20 14:09 qcheng-redhat