Skip to content

Commit

Permalink
fixed run_cmd_inside_vmm
Browse files Browse the repository at this point in the history
run_cmd_inside_vmm did not return the complete
output if the output size was more than
4096. This fixes it.

Signed-off-by: Ramyak Mehra <ramyak@dyte.io>
  • Loading branch information
ramyak-mehra authored and lauralt committed Aug 11, 2022
1 parent 3e258a7 commit 1f6cdc6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_run_reference_vmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def run_cmd_inside_vm(cmd, vmm_process, prompt, timeout=5):

then = time.time()
giveup_after = timeout
all_output = []
while True:
try:
data = os.read(vmm_process.stdout.fileno(), 4096)
Expand All @@ -238,8 +239,11 @@ def run_cmd_inside_vm(cmd, vmm_process, prompt, timeout=5):
# FIXME: WE get the prompt twice in the output at the end,
# So removing it. No idea why twice?
# First one is 'cmd'
return output_lines[1:-2]


all_output.extend(output_lines[1:-2])
return all_output
else:
all_output.extend(output_lines)
except BlockingIOError as _:
time.sleep(1)
now = time.time()
Expand All @@ -264,7 +268,6 @@ def expect_vcpus(vmm_process, expected_vcpus):
# /proc/cpuinfo displays info about each vCPU
cmd = 'cat /proc/cpuinfo'
output = run_cmd_inside_vm(cmd.encode(), vmm_process, prompt.encode(), timeout=5)

actual_vcpus = 0
for line in output:
if "processor" in line.decode():
Expand Down

0 comments on commit 1f6cdc6

Please sign in to comment.