[parted-devel] [PATCH 3/3] tests: add test for partitionable loop devices

Jim Meyering jim at meyering.net
Thu Sep 29 14:46:08 UTC 2011


Petr Uzel wrote:

> * tests/t8001-loop-blkpg.sh: New file.
> * tests/Makefile.am: Add test.
> ---
>  tests/Makefile.am         |    1 +
>  tests/t8001-loop-blkpg.sh |   65 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+), 0 deletions(-)
>  create mode 100755 tests/t8001-loop-blkpg.sh
>
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index e721f88..903ca64 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -43,6 +43,7 @@ TESTS = \
>    t6000-dm.sh \
>    t7000-scripting.sh \
>    t8000-loop.sh \
> +  t8001-loop-blkpg.sh \

Oh, one more addition:
While trying to see why this test failed, I added code
to print the partition table when the "loop0p1" did not match:

diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
index a521309..f6e37ce 100755
--- a/tests/t8001-loop-blkpg.sh
+++ b/tests/t8001-loop-blkpg.sh
@@ -51,7 +51,7 @@ udevadm settle --timeout=5 || fail=1

 # Verify that the partition appeared in /proc/partitions
 entry=`basename "$loopdev"p1`
-grep "$entry" /proc/partitions || fail=1
+grep "$entry" /proc/partitions || { cat /proc/partitions; fail=1; }

 # Remove the partition
 parted -s "$loopdev" rm 1 > err 2>&1 || fail=1

It showed loop0 in the list of partition names.



More information about the parted-devel mailing list