Skip to content

Commit 28b3cdd

Browse files
committed
refactor(test): add more debugging for "jailer id still used"
Clean up the error messages we print when running into the "firecracker pid was killed, but process with its jailer id still exists" case: Also print the PID of the offending process, as well as filter out non-firecracker processes at the command-running stage (otherwise the error message always contained the grep process itself, which was confusing). Note that `cmd` must be the last column, as otherwise ps will truncate it. Signed-off-by: Patrick Roy <[email protected]>
1 parent 10dfa03 commit 28b3cdd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/framework/microvm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ def kill(self):
333333
# https://github.com/firecracker-microvm/firecracker/pull/4442/commits/d63eb7a65ffaaae0409d15ed55d99ecbd29bc572
334334

335335
# filter ps results for the jailer's unique id
336-
_, stdout, stderr = utils.check_output(
337-
f"ps ax -o cmd -ww | grep {self.jailer.jailer_id}"
336+
_, stdout, stderr = utils.run_cmd(
337+
f"ps ax -o pid,cmd -ww | grep {self.jailer.jailer_id} | grep firecracker"
338338
)
339339
# make sure firecracker was killed
340340
assert (
341-
stderr == "" and "firecracker" not in stdout
341+
not stderr and not stdout
342342
), f"Firecracker reported its pid {self.firecracker_pid}, which was killed, but there still exist processes using the supposedly dead Firecracker's jailer_id: {stdout}"
343343

344344
if self.uffd_handler and self.uffd_handler.is_running():

0 commit comments

Comments
 (0)