[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/5] tests: Ensure that mountpoints are unmounted before exit
From: |
Daniel Kiper |
Subject: |
Re: [PATCH 4/5] tests: Ensure that mountpoints are unmounted before exiting |
Date: |
Thu, 3 Feb 2022 19:16:00 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Wed, Jan 12, 2022 at 09:59:42PM -0600, Glenn Washburn wrote:
> When all tests complete successfully, filesystems mounted by grub-fs-tester
> will be unmounted before exiting. However, on certain test failures the
> tester will exit with a failure code and not unmount previously mounted
> filesystems. Now keep track of mounts and umounts and run an exit handler
> on exit or process interruption that will umount all mounts that haven't
> already been unmounted.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
> tests/util/grub-fs-tester.in | 30 +++++++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
> index a1f3f299b..b39831f27 100644
> --- a/tests/util/grub-fs-tester.in
> +++ b/tests/util/grub-fs-tester.in
> @@ -13,6 +13,17 @@ tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` ||
> # FSLABEL. This is especially needed for the conversion to Joliet UCS-2.
> XORRISOFS_CHARSET="-input-charset UTF-8 -output-charset UTF-8"
>
> +MOUNTS=
> +umount_all() {
I would do s/umount_all/cleanup/ here and avoid rename in the next patch.
> + for MOUNT in $MOUNTS; do
for i in $MOUNTS; do
It is a bit difficult to differentiate MOUNT and MOUNTS.
> + umount "$MOUNT" &&
> + MOUNTS="$(echo ${MOUNTS} | sed "s|$MOUNT||g;")"
I think this is unneeded. Is it?
> + done
> +}
> +trap umount_all EXIT INT
> +# This is for bash, dash and ash do not recognize ERR
> +trap umount_all ERR || :
Daniel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 4/5] tests: Ensure that mountpoints are unmounted before exiting,
Daniel Kiper <=