summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-04-19 17:30:33 +0200
committerLennart Poettering <lennart@poettering.net>2021-04-19 23:19:52 +0200
commit5a3b86404a65d1f47da2d387fd84cebd1b3418a2 (patch)
tree4f74e22f47e124dd9bb45826fc594f964f58e43d
parentb620bf332f575ba9b8e4cd60c93446a0c35c23e8 (diff)
downloadsystemd-5a3b86404a65d1f47da2d387fd84cebd1b3418a2.tar.gz
test: add test for new repart features
l---------test/TEST-58-REPART/Makefile1
-rwxr-xr-xtest/TEST-58-REPART/test.sh6
-rw-r--r--test/units/testsuite-58.service6
-rwxr-xr-xtest/units/testsuite-58.sh72
4 files changed, 85 insertions, 0 deletions
diff --git a/test/TEST-58-REPART/Makefile b/test/TEST-58-REPART/Makefile
new file mode 120000
index 0000000000..e9f93b1104
--- /dev/null
+++ b/test/TEST-58-REPART/Makefile
@@ -0,0 +1 @@
+../TEST-01-BASIC/Makefile \ No newline at end of file
diff --git a/test/TEST-58-REPART/test.sh b/test/TEST-58-REPART/test.sh
new file mode 100755
index 0000000000..d94a9cbfdc
--- /dev/null
+++ b/test/TEST-58-REPART/test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -e
+TEST_DESCRIPTION="test systemd-repart"
+. $TEST_BASE_DIR/test-functions
+
+do_test "$@" 56
diff --git a/test/units/testsuite-58.service b/test/units/testsuite-58.service
new file mode 100644
index 0000000000..d8ad589ca0
--- /dev/null
+++ b/test/units/testsuite-58.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=TEST-56-EXIT-TYPE
+
+[Service]
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh
new file mode 100755
index 0000000000..772f1b78d4
--- /dev/null
+++ b/test/units/testsuite-58.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+set -eux
+
+export SYSTEMD_LOG_LEVEL=debug
+export PAGER=cat
+
+mkdir -p /tmp/testsuite-58-defs/
+
+# First part: create a disk image and verify its in order
+
+cat > /tmp/testsuite-58-defs/esp.conf <<EOF
+[Partition]
+Type=esp
+SizeMinBytes=10M
+Format=vfat
+EOF
+
+cat > /tmp/testsuite-58-defs/usr.conf <<EOF
+[Partition]
+Type=usr
+SizeMinBytes=10M
+Format=ext4
+ReadOnly=yes
+EOF
+
+cat > /tmp/testsuite-58-defs/root.conf <<EOF
+[Partition]
+Type=root
+SizeMinBytes=10M
+Format=ext4
+MakeDirectories=/usr /efi
+EOF
+
+systemd-repart --definitions=/tmp/testsuite-58-defs/ --empty=create --size=auto --seed=750b6cd5c4ae4012a15e7be3c29e6a47 /var/tmp/testsuite-58.img
+
+sfdisk --dump /var/tmp/testsuite-58.img > /tmp/testsuite-58.dump
+
+grep -qxF '/var/tmp/testsuite-58.img1 : start= 2048, size= 20480, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=39107B09-615D-48FB-BA37-C663885FCE67, name="esp"' /tmp/testsuite-58.dump
+grep -qxF '/var/tmp/testsuite-58.img2 : start= 22528, size= 20480, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=60F33797-1D71-4DCB-AA6F-20564F036CD0, name="root-x86-64"' /tmp/testsuite-58.dump
+grep -qxF '/var/tmp/testsuite-58.img3 : start= 43008, size= 20480, type=8484680C-9521-48C6-9C11-B0720656F69E, uuid=7E3369DD-D653-4513-ADF5-B993A9F20C16, name="usr-x86-64", attrs="GUID:60"' /tmp/testsuite-58.dump
+
+# Second part, duplicate it with CopyBlocks=auto
+
+cat > /tmp/testsuite-58-defs/esp.conf <<EOF
+[Partition]
+Type=esp
+CopyBlocks=auto
+EOF
+
+cat > /tmp/testsuite-58-defs/usr.conf <<EOF
+[Partition]
+Type=usr
+ReadOnly=yes
+CopyBlocks=auto
+EOF
+
+cat > /tmp/testsuite-58-defs/root.conf <<EOF
+[Partition]
+Type=root
+CopyBlocks=auto
+EOF
+
+systemd-repart --definitions=/tmp/testsuite-58-defs/ --empty=create --size=auto --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --image=/var/tmp/testsuite-58.img /var/tmp/testsuite-58.2.img
+
+cmp /var/tmp/testsuite-58.img /var/tmp/testsuite-58.2.img
+
+rm -f /var/tmp/testsuite-58.img /var/tmp/testsuite-58.2.img /tmp/testsuite-58.dump
+rm -rf /tmp/testsuite-58-defs/
+
+echo OK >/testok
+
+exit 0