[parted-devel] [PATCH 1/3] tests: add one: try to remove a busy partition
Jim Meyering
jim at meyering.net
Wed Jun 30 06:21:41 UTC 2010
Thanks for all the improvements!
The other two patches look fine.
Otavio Salvador wrote:
> This test try to reproduce the issue reported in Debian bug #582818[1].
s/try/tries/
> 1. http://bugs.debian.org/582818
>
> Basically it does:
>
> * create two primary partitions
> * mount the second one
> * remove the first (must works)
s/works/work/
> * try to remove the second (must fail)
>
> * tests/t1101-busy-partition.sh: new file.
> * tests/Makefile.am: add the new test in check target.
Please mention the target name, e.g.,
* tests/Makefile.am (TESTS): Add it.
...
> diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh
...
> +# be sure to unmount upon interrupt, failure, etc.
> +cleanup_() { umount "${dev}2" > /dev/null 2>&1; }
> +
> +mount_point="`pwd`/mnt"
No need for quotes in an assignment like this.
Please use $(...), rather than `...`:
(normally `...` is preferable for portability, but
the test framework ensures that the more modern $(...) works)
mount_point=$(pwd)/mnt
> +mkdir $mount_point || fail=1
> +mount "${dev}2" $mount_point || fail=1
Here, however, quotes around $mount_point would be better,
in case $(pwd) contains anything suspicious.
mount "${dev}2" "$mount_point" || fail=1
> +# removal of unmounted partition, must work.
> +parted -s "$dev" rm 1 > out 2>&1 || fail=1
> +
> +parted -s "$dev" rm 2 > out 2>&1 && fail=1
> +
> +# expect error
> +compare out exp-error
> +
> +Exit $fail
> +
Please don't add blank lines at the end of a file.
More information about the parted-devel
mailing list