Skip to content

Commit

Permalink
Removing the escape sequence from the output of get_cpu_count()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Anushree-Mathur committed Jan 17, 2025
1 parent a9b09f4 commit 7fa2481
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion virttest/virt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 7fa2481

Please sign in to comment.