From 7fa24813d6d11fc951b45dc7ef8d310c450b83f3 Mon Sep 17 00:00:00 2001 From: Anushree Mathur Date: Fri, 10 Jan 2025 12:17:35 +0530 Subject: [PATCH] Removing the escape sequence from the output of get_cpu_count() The get_cpu_count function is returning the output containing the escape sequence so the checks are failing, I have removed the escape sequence from the output then returned it! Signed-off-by: Anushree Mathur --- virttest/virt_vm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virttest/virt_vm.py b/virttest/virt_vm.py index 679521a57a..36b842d8d4 100644 --- a/virttest/virt_vm.py +++ b/virttest/virt_vm.py @@ -12,6 +12,7 @@ import six from aexpect import remote from aexpect.exceptions import ExpectError, ShellError +from aexpect.utils import astring from avocado.core import exceptions from six.moves import xrange @@ -1564,7 +1565,9 @@ def get_cpu_count(self, check_cmd="cpu_chk_cmd", connect_uri=None): """ cmd = self.params.get(check_cmd) out = self.session.cmd_output_safe(cmd) - return int(re.search("\d+", out, re.M).group()) + # Removing the escape sequence from the output + out_no_escape = astring.strip_console_codes(out) + return int(re.search("\d+", out_no_escape, re.M).group()) def get_memory_size(self, cmd=None, timeout=60): """