Skip to content

Commit

Permalink
update(qemu-deploy): improve code readability
Browse files Browse the repository at this point in the history
Signed-off-by: Diogo Costa <[email protected]>
  • Loading branch information
Diogo21Costa authored and ESCristiano committed Dec 18, 2023
1 parent 7a7ce68 commit 9dbfa1a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,24 @@ def deploy_test(platform):
run_cmd += " " + arch
run_cmd += " " + flash_bin_path
run_cmd += " " + bao_bin_path
ports_init = connection.scan_pts_ports()

# Get the ports opened before running QEMU
initial_pts_ports = connection.scan_pts_ports()

# Launch QEMU
process = run_command_in_terminal(run_cmd)

ports_aux = connection.scan_pts_ports()
ports_end = ports_aux
# Initially set the end ports as the ports obtained before running QEMU
final_pts_ports = initial_pts_ports

# Continuously scan for ports until the ports after running QEMU differ
# from the initial ports; this retrieves the pts ports opened by QEMU
while final_pts_ports == initial_pts_ports:
final_pts_ports = connection.scan_pts_ports()

while ports_end == ports_aux:
ports_end = connection.scan_pts_ports()
# Find the difference between the initial and final pts ports
diff_ports = connection.diff_ports(initial_pts_ports, final_pts_ports)

diff_ports = connection.diff_ports(ports_init, ports_end)
connection.connect_to_platform_port(diff_ports, test_config['log_echo'])
terminate_children_processes(process)

Expand Down

0 comments on commit 9dbfa1a

Please sign in to comment.