[parted-devel] [PATCH 6/8] tests: t3310-flags.sh: Add test for mac table flags
Mike Fleetwood
mike.fleetwood at googlemail.com
Sat Oct 1 08:32:13 UTC 2016
On 30 September 2016 at 18:00, Brian C. Lane <bcl at redhat.com> wrote:
> On Tue, Aug 16, 2016 at 08:42:40PM +0100, Mike Fleetwood wrote:
>> MAC partition table reserves partition 1 for the partition map
>> partition, so the created test partition will be number 2. Adapt
>> accordingly.
>>
>> Setting flags 'root' and 'swap' also sets the partition name to 'root'
>> and 'swap' respectively, so no longer match the partition name in
>> extract_flags().
>>
>> Don't test lvm and raid flags as they fail to be cleared with a single
>> set off command. See FIXME comment in the test for more details.
>> ---
>> tests/t3310-flags.sh | 22 ++++++++++++++++++----
>> 1 files changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
>> index d20d6d4..7f1f65b 100644
>> --- a/tests/t3310-flags.sh
>> +++ b/tests/t3310-flags.sh
>> @@ -22,10 +22,11 @@ dev=dev-file
>>
>> extract_flags()
>> {
>> - perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
>> + perl -nle '/^[^:]*:2048s:4095s:2048s::[^:]*:(.+);$/ and print $1' "$@"
>> }
>
> Isn't this going to drop setting $1 as the partition name?
No it's not. $1 was always, and still is, set to the flags in the last
field by "(.+)". The "?:" bit in this fragment "(?:PTNNAME)?" is a
non-capturing grouping. man perlretut.
(Have to stop matching the partition name column as either "PTNNAME" or
"" because of the reason discussed in the FIXME comment for the mac
table; setting root or swap flag also sets the partition name to the
same).
Thanks,
Mike
More information about the parted-devel
mailing list