From: Jim Meyering Date: Tue, 16 Jun 2009 10:26:29 +0000 (+0200) Subject: tests: handle SS>512, clean up, add consistency check X-Git-Tag: android-x86-4.4-r1~682 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3e6b7ad01cf39b9e85cf6eb471d3108132152573;p=android-x86%2Fexternal-parted.git tests: handle SS>512, clean up, add consistency check * tests/t5000-tags.sh: Don't fail for sector size of 4096 and greater. --- diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh index 3c8879a..c5afbc2 100755 --- a/tests/t5000-tags.sh +++ b/tests/t5000-tags.sh @@ -19,15 +19,22 @@ test_description="test bios_grub flag in gpt labels" : ${srcdir=.} . $srcdir/test-lib.sh +ss=$sector_size_ dev=loop-file +N=300 # number of sectors -nb=1024 -n_sectors=$(expr $nb '*' 512 / $sector_size_) +part_sectors=128 +start_sector=60 +end_sector=$(expr $start_sector + $part_sectors - 1) + +test_expect_success \ + "setup: reasonable params" \ + 'test $end_sector -lt $N' test_expect_success \ "setup: create zeroed device" \ - 'dd if=/dev/zero bs=512 count=$nb of=$dev' + 'dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null' test_expect_success \ 'create gpt label' \ @@ -43,15 +50,12 @@ test_expect_success \ test_expect_success \ 'check for expected output' \ - 'printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt:;\n" > exp && + 'printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt:;\n" > exp && compare exp out' -part_sectors=128 -start_sector=60 -end_sector=$(expr $start_sector + $part_sectors - 1) test_expect_success \ 'add a partition' \ - 'parted -s $dev mkpart primary ${start_sector}s ${end_sector}s >out 2>&1' + 'parted -s $dev u s mkpart primary ${start_sector} ${end_sector} >out 2>&1' test_expect_success \ 'print the table (before manual modification)' \ @@ -64,7 +68,7 @@ test_expect_success \ # dash's builtin printf doesn't recognize such \xHH hexadecimal escapes. bios_boot_magic='\110\141\150\41\111\144\157\156\164\116\145\145\144\105\106\111' -printf "$bios_boot_magic" | dd of=$dev bs=$sector_size_ seek=2 conv=notrunc +printf "$bios_boot_magic" | dd of=$dev bs=$ss seek=2 conv=notrunc test_expect_success \ 'print the table (after manual modification)' \ @@ -77,10 +81,10 @@ gen_exp() { cat <