Skip to content

Commit 1f6cdc6

Browse files
ramyak-mehralauralt
authored andcommitted
fixed run_cmd_inside_vmm
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>
1 parent 3e258a7 commit 1f6cdc6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_run_reference_vmm.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def run_cmd_inside_vm(cmd, vmm_process, prompt, timeout=5):
229229

230230
then = time.time()
231231
giveup_after = timeout
232+
all_output = []
232233
while True:
233234
try:
234235
data = os.read(vmm_process.stdout.fileno(), 4096)
@@ -238,8 +239,11 @@ def run_cmd_inside_vm(cmd, vmm_process, prompt, timeout=5):
238239
# FIXME: WE get the prompt twice in the output at the end,
239240
# So removing it. No idea why twice?
240241
# First one is 'cmd'
241-
return output_lines[1:-2]
242-
242+
243+
all_output.extend(output_lines[1:-2])
244+
return all_output
245+
else:
246+
all_output.extend(output_lines)
243247
except BlockingIOError as _:
244248
time.sleep(1)
245249
now = time.time()
@@ -264,7 +268,6 @@ def expect_vcpus(vmm_process, expected_vcpus):
264268
# /proc/cpuinfo displays info about each vCPU
265269
cmd = 'cat /proc/cpuinfo'
266270
output = run_cmd_inside_vm(cmd.encode(), vmm_process, prompt.encode(), timeout=5)
267-
268271
actual_vcpus = 0
269272
for line in output:
270273
if "processor" in line.decode():

0 commit comments

Comments
 (0)