Skip to content

Commit

Permalink
test: Kill processes that keep scsi_debug mounts busy
Browse files Browse the repository at this point in the history
Tests like TestStorageUsed.testTeardownRetry run processes that keep a
scsi_debug block device mount busy. If they fail on some assertion in
the middle, the generic storage cleanup (umount, rmmod scsi_debug)
fails, and the following tests get broken. Add an `fuser` kill loop to
prevent that.

Also show all stdout output from these commands. We don't need it
returned in the code, it's more useful for developers in the test
output.
  • Loading branch information
martinpitt committed Nov 14, 2023
1 parent 1a77cb9 commit a45210a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,10 +1538,12 @@ def cleanup_home_dirs():
"for dev in $(ls /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*:*/block); do "
" for s in /sys/block/*/slaves/${dev}*; do [ -e $s ] || break; "
" d=/dev/$(dirname $(dirname ${s#/sys/block/})); "
" while fuser --mount $d --kill; do sleep 0.1; done; "
" umount $d || true; dmsetup remove --force $d || true; "
" done; "
" umount /dev/$dev 2>/dev/null || true; "
"done; until rmmod scsi_debug; do sleep 0.2; done")
" while fuser --mount /dev/$dev --kill; do sleep 0.1; done; "
" umount /dev/$dev || true; "
"done; until rmmod scsi_debug; do sleep 0.2; done", stdout=None)

def terminate_sessions():
# on OSTree we don't get "web console" sessions with the cockpit/ws container; just SSH; but also, some tests start
Expand Down

0 comments on commit a45210a

Please sign in to comment.