summaryrefslogtreecommitdiffstats
path: root/src/partition/test-repart.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-30 16:03:53 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-30 16:03:53 +0200
commite4ec8b1f51b7a0c793297eb41f3bbc41165933be (patch)
treea0cb5e6f7f2d4abee4000e9a3b182559570a3342 /src/partition/test-repart.sh
parentrepart: adjust --help and test output width (diff)
downloadsystemd-e4ec8b1f51b7a0c793297eb41f3bbc41165933be.tar.xz
systemd-e4ec8b1f51b7a0c793297eb41f3bbc41165933be.zip
test-repart: also print json output
This doesn't really "test" anything, but a human can look at it.
Diffstat (limited to '')
-rwxr-xr-xsrc/partition/test-repart.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/partition/test-repart.sh b/src/partition/test-repart.sh
index bfb9bcb4c9..730f9cc9c3 100755
--- a/src/partition/test-repart.sh
+++ b/src/partition/test-repart.sh
@@ -10,6 +10,8 @@ mkdir -p $D/definitions
SEED=e2a40bf9-73f1-4278-9160-49c031e7aef8
+echo "### Testing systemd-repart --empty=create ###"
+
$repart $D/zzz --empty=create --size=1G --seed=$SEED
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/empty
@@ -23,6 +25,8 @@ first-lba: 2048
last-lba: 2097118
EOF
+echo "### Testing with root, root2, home, & swap ###"
+
cat >$D/definitions/root.conf <<EOF
[Partition]
Type=root-x86-64
@@ -61,6 +65,8 @@ $D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FB
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
EOF
+echo "### Testing with root, root2, home, swap, & another partition ###"
+
cat >$D/definitions/swap.conf <<EOF
[Partition]
Type=swap
@@ -95,6 +101,8 @@ $D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-09
$D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=A0A1A2A3-A4A5-A6A7-A8A9-AAABACADAEAF, name="custom_label"
EOF
+echo "### Resizing to 2G ###"
+
$repart $D/zzz --size=2G --dry-run=no --seed=$SEED --definitions=$D/definitions
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated3
@@ -115,6 +123,8 @@ EOF
dd if=/dev/urandom of=$D/block-copy bs=4096 count=10240
+echo "### Testing with root, root2, home, swap, another partition, & partition copy ###"
+
cat >$D/definitions/extra2.conf <<EOF
[Partition]
Type=linux-generic
@@ -143,3 +153,8 @@ $D/zzz6 : start= 4194264, size= 2097152, type=0FC63DAF-8483-4772-8E79-3D
EOF
cmp --bytes=41943040 --ignore-initial=0:$((512*4194264)) $D/block-copy $D/zzz
+
+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
+$repart $D/zzz --size=3G --dry-run=no --seed=$SEED --definitions=$D/definitions --json=short