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))
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