[parted-devel] many partitions test

Jim Meyering jim at meyering.net
Mon Jan 23 20:49:11 UTC 2012


Phillip Susi wrote:

> On 1/23/2012 3:37 PM, Jim Meyering wrote:
>> It stopped at 60 for a good reason.
>> From the comments:
>>
>>   # 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.
>>   $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 180 < d;"\
>>   ' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \
>>       || fail=1
>>
>> However, I can do better by making it more like today's test
>> and not exec'ing parted once for each partition.
>> In addition, we need not use 256 sectors per partition
>> when just one will do.
>> And finally, I don't really care if it takes a long time
>> to run on a kernel that is that old.
>>
>> Patch for that below.
>>
>> I've also adjusted the preceding test:
>> * do initialize the shell variable, "cmd"
>>   (could have had nasty consequences for test runners with a
>>   pathologically chosen value of the cmd envvar)
>> * don't use seq, for the sake of portability
>>
>> From fd9fe8fa65019e62c80f87b68aa1dda46b63ecf8 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering at redhat.com>
>> Date: Mon, 23 Jan 2012 20:01:30 +0100
>> Subject: [PATCH 1/2] tests: exercise today's bug fix, creating a GPT table
>>  with 128 entries
>>
>> * tests/t0212-gpt-many-partitions.sh: New test.
>> * tests/Makefile.am (TESTS): Add it.
>
> Why make a new test instead of modifying the existing one?

Several reasons:

  - one requires scsi_debug and exercises the kernel-mount-new-partition
    code paths.  Hence it is run only by root, and it won't be run as often.

  - the other operates on a regular file and hence can be run by a
    non-privileged user and thus exercises slightly different code paths.
    Anyone can run this test.

  - I prefer to keep them in separate tests so that when I run tests in
    parallel (almost always), these longer-running tests can run
    simultaneously. Though given the way the tests work with scsi_debug,
    no two scsi_debug-using tests can be run in parallel.



More information about the parted-devel mailing list