Skip to content

Commit

Permalink
refactor(test): prefer os.kill over shelling out
Browse files Browse the repository at this point in the history
Use os.kill in test_serial_io instead of using a shell to invoke `kill`.

Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Jul 4, 2024
1 parent 3543d9e commit 551c0bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/integration_tests/functional/test_serial_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@
import fcntl
import os
import platform
import subprocess
import signal
import termios
import time

Expand Down Expand Up @@ -184,9 184,8 @@ def test_serial_block(uvm_plain_any):
fc_metrics = test_microvm.flush_metrics()
init_count = fc_metrics["uart"]["missed_write_count"]

screen_pid = test_microvm.screen_pid
# Stop `screen` process which captures stdout so we stop consuming stdout.
subprocess.check_call("kill -s STOP {}".format(screen_pid), shell=True)
os.kill(test_microvm.screen_pid, signal.SIGSTOP)

# Generate a random text file.
test_microvm.ssh.check_output(
Expand Down

0 comments on commit 551c0bc

Please sign in to comment.