Improve robustness of chroot-related tests

This commit is contained in:
Norman Feske
2012-11-21 20:02:22 +01:00
parent 53529e0eeb
commit deb465e442
3 changed files with 32 additions and 10 deletions

View File

@@ -41,3 +41,27 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
set output $expect_out(buffer)
}
##
# Umount a directory that was bind-mounted beforehand
#
# This function is used by chroot-related tests, e.g., 'os/run/chroot.run',
# 'os/run/chroot_loader.run'.
#
proc umount_and_rmdir { path } {
puts "umounting $path"
#
# Invoke umount until it returns an error. Apparently, the unmounting
# of bind-mounted mount points does not always take immediate effect
# (regardless of the -l option).
#
while {1} {
if {[catch { exec sudo umount -l $path }]} { break; }
sleep 0.25
}
catch { exec rmdir -p $path }
}