mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
test: add test for new repart features
This commit is contained in:
parent
170c982345
commit
f7011e17f1
@ -154,6 +154,57 @@ EOF
|
||||
|
||||
cmp --bytes=41943040 --ignore-initial=0:$((512*4194264)) $D/block-copy $D/zzz
|
||||
|
||||
if [ `id -u` == 0 ] && type -P cryptsetup diff losetup > /dev/null ; then
|
||||
echo "### Testing Format=/Encrypt=/CopyFiles="
|
||||
|
||||
# These tests require privileges unfortunately
|
||||
|
||||
cat >$D/definitions/extra3.conf <<EOF
|
||||
[Partition]
|
||||
Type=linux-generic
|
||||
Label=luks-format-copy
|
||||
UUID=7b93d1f2-595d-4ce3-b0b9-837fbd9e63b0
|
||||
Format=ext4
|
||||
Encrypt=yes
|
||||
CopyFiles=$D/definitions:/def
|
||||
SizeMinBytes=48M
|
||||
EOF
|
||||
|
||||
$repart $D/zzz --size=auto --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated5
|
||||
|
||||
cmp $D/populated5 - <<EOF
|
||||
label: gpt
|
||||
label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
|
||||
device: $D/zzz
|
||||
unit: sectors
|
||||
first-lba: 2048
|
||||
last-lba: 6389726
|
||||
$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home-first"
|
||||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
$D/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=A0A1A2A3-A4A5-A6A7-A8A9-AAABACADAEAF, name="custom_label"
|
||||
$D/zzz6 : start= 4194264, size= 2097152, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=2A1D97E1-D0A3-46CC-A26E-ADC643926617, name="block-copy"
|
||||
$D/zzz7 : start= 6291416, size= 98304, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=7B93D1F2-595D-4CE3-B0B9-837FBD9E63B0, name="luks-format-copy"
|
||||
EOF
|
||||
|
||||
LOOP=`losetup -P --show --find $D/zzz`
|
||||
VOLUME=test-repart-$RANDOM
|
||||
|
||||
touch $D/empty-password
|
||||
cryptsetup open --type=luks2 --key-file=$D/empty-password ${LOOP}p7 $VOLUME
|
||||
mkdir $D/mount
|
||||
mount -t ext4 /dev/mapper/$VOLUME $D/mount
|
||||
diff -r $D/mount/def $D/definitions > /dev/null
|
||||
umount $D/mount
|
||||
cryptsetup close $VOLUME
|
||||
losetup -d $LOOP
|
||||
else
|
||||
echo "### Skipping Format=/Encrypt=/CopyFiles= test, lacking privileges or missing cryptsetup/diff/losetup"
|
||||
fi
|
||||
|
||||
echo "### Testing json output ###"
|
||||
$repart $D/zzz --size=3G --dry-run=no --seed=$SEED --definitions=$D/definitions --json=help
|
||||
$repart $D/zzz --size=3G --dry-run=no --seed=$SEED --definitions=$D/definitions --json=pretty
|
||||
|
Loading…
x
Reference in New Issue
Block a user