X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=tests%2Ft9040-many-partitions.sh;h=db065f4247b39f5aea4f26c6e1490e9924f6ed93;hb=cd280c622f5f5f8708ace2f04118d80d9a2c6a8f;hp=c77628c0981ea673662dd39d6c2c629863655206;hpb=fd9fe8fa65019e62c80f87b68aa1dda46b63ecf8;p=android-x86%2Fexternal-parted.git diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh index c77628c..db065f4 100644 --- a/tests/t9040-many-partitions.sh +++ b/tests/t9040-many-partitions.sh @@ -25,9 +25,9 @@ grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || skip_ 'this system lacks a new-enough libblkid' ss=$sector_size_ -partition_sectors=256 # sectors per partition -n_partitions=60 # how many partitions to create -start=2048 # start sector for the first partition +partition_sectors=1 # sectors per partition +n_partitions=128 # how many partitions to create +start=34 # start sector for the first partition gpt_slop=34 # sectors at end of disk reserved for GPT n_sectors=$(($start + n_partitions * partition_sectors + gpt_slop)) @@ -43,29 +43,35 @@ n=$((n_MiB * sectors_per_MiB)) printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug;\n" \ > exp || fail=1 -parted -s $scsi_dev mklabel gpt || fail=1 -parted -s $scsi_dev u s p || fail=1 - +cmd= i=1 -t0=$(date +%s.%N) while :; do - end=$((start + partition_sectors - 1)) - parted -s $scsi_dev mkpart p$i ${start}s ${end}s || fail=1 - printf "$i:${start}s:${end}s:${partition_sectors}s::p$i:;\n" >> exp - test $i = $n_partitions && break - start=$((start + partition_sectors)) - i=$((i+1)) + s=$((start + i - 1)) + e=$((s + partition_sectors - 1)) + cmd="$cmd mkpart p$i ${s}s ${e}s" + test $i = $n_partitions && break; i=$((i+1)) done + +# Time the actual command: +t0=$(date +%s.%N) +parted -m -a min -s $scsi_dev mklabel gpt $cmd u s p > out 2>&1 || fail=1 t_final=$(date +%s.%N) +i=1 +while :; do + s=$((start + i - 1)) + e=$((s + partition_sectors - 1)) + printf "$i:${s}s:${e}s:${partition_sectors}s::p$i:;\n" >> exp + test $i = $n_partitions && break; i=$((i+1)) +done + # Fail the test if it takes too long. -# On Fedora 13, it takes about 15 seconds. -# With older kernels, it typically takes more than 150 seconds. +# On Fedora 16, this takes about 10 seconds for me. +# With Fedora-12-era kernels, it typically took more than 150 seconds. $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\ ' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \ || fail=1 -parted -m -s $scsi_dev u s p > out || fail=1 compare exp out || fail=1 Exit $fail