[parted-devel] [PATCH] test for gpt-assertion fix

Jim Meyering jim at meyering.net
Wed Feb 18 19:36:00 UTC 2009


Petr Uzel <petr.uzel at suse.cz> wrote:
> attached patch adds test for Jim's fix (failed assertion when creating
> GPT label). My first parted test, so please let me know what you
> think.

Thanks!
Here's a slightly smaller (clearer to me) reproducer:

    dev=file
    dd if=/dev/null of=$dev seek=4001
    ./parted -s $dev mklabel gpt
    dd if=/dev/null of=$dev seek=4000
    ./parted -s $dev mklabel gpt

I'm making these changes to your test:

diff --git a/tests/t0201-gpt.sh b/tests/t0201-gpt.sh
index 0974e1a..0b8a970 100755
--- a/tests/t0201-gpt.sh
+++ b/tests/t0201-gpt.sh
@@ -20,13 +20,10 @@ test_description='avoid failed assertion when creating a GPT on top of an old on
 : ${srcdir=.}
 . $srcdir/test-lib.sh

-N1=10M
-N2=5M
 dev=loop-file
-tmp=loop-file-tmp
 test_expect_success \
-    'create a file large enough to hold a GPT partition table' \
-    'dd if=/dev/null of=$dev bs=1 seek=$N1 2> /dev/null'
+    'create a backing file large enough for a GPT partition table' \
+    'dd if=/dev/null of=$dev seek=4001 2> /dev/null'

 test_expect_success \
     'create a GPT partition table' \
@@ -34,12 +31,12 @@ test_expect_success \
 test_expect_success 'expect no output' 'compare out /dev/null'

 test_expect_success \
-	'shrink the backing file' \
-    'dd if=$dev of=$tmp bs=$N2 count=1 && mv $tmp $dev'
+    'shrink the backing file' \
+    'dd if=/dev/null of=$dev seek=4000 2> /dev/null'

 test_expect_success \
-	'create GPT on top of the shrunken backing file' \
-	'parted -s $dev mklabel gpt > out 2>&1'
+    'create a new GPT table on top of the shrunken backing file' \
+    'parted -s $dev mklabel gpt > out 2>&1'
 test_expect_success 'expect no output' 'compare out /dev/null'

 test_done

---------------------------------------
Plus I changed the log entry to be more like the others,
listing each affected file (ChangeLog style), so here's
what I expect to push:




More information about the parted-devel mailing list