summaryrefslogtreecommitdiffstats
path: root/test/test-fstab-generator
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/test-fstab-generator.sh47
-rw-r--r--test/test-fstab-generator/.gitattributes1
-rw-r--r--test/test-fstab-generator/test-01-dev-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-01-dev-nfs.input1
-rw-r--r--test/test-fstab-generator/test-02-dhcp.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-02-dhcp.input1
-rw-r--r--test/test-fstab-generator/test-03-dhcp6.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-03-dhcp6.input1
-rw-r--r--test/test-fstab-generator/test-04-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-04-nfs.input1
-rw-r--r--test/test-fstab-generator/test-05-nfs4.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-05-nfs4.input1
-rw-r--r--test/test-fstab-generator/test-06-ipv4.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-06-ipv4.input1
-rw-r--r--test/test-fstab-generator/test-07-ipv6.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-07-ipv6.input1
-rw-r--r--test/test-fstab-generator/test-08-implicit-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-08-implicit-nfs.input1
-rw-r--r--test/test-fstab-generator/test-09-cifs.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-09-cifs.input1
-rw-r--r--test/test-fstab-generator/test-10-iscsi.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-10-iscsi.input1
-rw-r--r--test/test-fstab-generator/test-11-live.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-11-live.input1
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-device.target.d/50-root-device.conf5
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.expected/sysroot.mount14
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.expected/systemd-fsck-root.service16
-rw-r--r--test/test-fstab-generator/test-12-dev-sdx.input1
-rw-r--r--test/test-fstab-generator/test-13-label.expected/initrd-root-device.target.d/50-root-device.conf5
-rw-r--r--test/test-fstab-generator/test-13-label.expected/initrd-root-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-13-label.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-13-label.expected/sysroot.mount14
-rw-r--r--test/test-fstab-generator/test-13-label.expected/systemd-fsck-root.service16
-rw-r--r--test/test-fstab-generator/test-13-label.input1
-rw-r--r--test/test-fstab-generator/test-14-uuid.expected/initrd-root-device.target.d/50-root-device.conf5
-rw-r--r--test/test-fstab-generator/test-14-uuid.expected/initrd-root-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-14-uuid.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-14-uuid.expected/sysroot.mount14
-rw-r--r--test/test-fstab-generator/test-14-uuid.expected/systemd-fsck-root.service16
-rw-r--r--test/test-fstab-generator/test-14-uuid.input1
-rw-r--r--test/test-fstab-generator/test-15-partuuid.expected/initrd-root-device.target.d/50-root-device.conf5
-rw-r--r--test/test-fstab-generator/test-15-partuuid.expected/initrd-root-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-15-partuuid.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-15-partuuid.expected/sysroot.mount14
-rw-r--r--test/test-fstab-generator/test-15-partuuid.expected/systemd-fsck-root.service16
-rw-r--r--test/test-fstab-generator/test-15-partuuid.input1
-rw-r--r--test/test-fstab-generator/test-16-tmpfs.expected/initrd-root-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-16-tmpfs.expected/initrd-usr-fs.target.requires/sysroot.mount0
-rw-r--r--test/test-fstab-generator/test-16-tmpfs.expected/sysroot.mount12
-rw-r--r--test/test-fstab-generator/test-16-tmpfs.input1
52 files changed, 216 insertions, 0 deletions
diff --git a/test/test-fstab-generator.sh b/test/test-fstab-generator.sh
new file mode 100755
index 0000000..5a166ab
--- /dev/null
+++ b/test/test-fstab-generator.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -e
+
+if [[ -n "$1" ]]; then
+ generator=$1
+elif [[ -x /usr/lib/systemd/system-generators/systemd-fstab-generator ]]; then
+ generator=/usr/lib/systemd/system-generators/systemd-fstab-generator
+elif [[ -x /lib/systemd/system-generators/systemd-fstab-generator ]]; then
+ generator=/lib/systemd/system-generators/systemd-fstab-generator
+else
+ exit 1
+fi
+
+src="$(dirname "$0")/testdata/test-fstab-generator"
+
+# fsck(8) is located in /usr/sbin on Debian
+PATH=$PATH:/usr/sbin
+
+# systemd-pcrfs@.service could be enabled or not, depending on the host state
+# of the host system. Override the measurement to avoid the issue.
+export SYSTEMD_FORCE_MEASURE=0
+
+for f in "$src"/test-*.input; do
+ echo "*** Running $f"
+
+ (
+ out=$(mktemp --tmpdir --directory "test-fstab-generator.XXXXXXXXXX")
+ # shellcheck disable=SC2064
+ trap "rm -rf '$out'" EXIT INT QUIT PIPE
+
+ # shellcheck disable=SC2046
+ SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD=yes SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$f")" $generator "$out" "$out" "$out"
+
+ if [[ -f "$out"/systemd-fsck-root.service ]]; then
+ # For split-usr system
+ sed -i -e 's:ExecStart=/lib/systemd/systemd-fsck:ExecStart=/usr/lib/systemd/systemd-fsck:' "$out"/systemd-fsck-root.service
+ fi
+
+ # We store empty files rather than symlinks, so that they don't get pruned when packaged up, so compare
+ # the list of filenames rather than their content
+ if ! diff -u <(find "$out" -printf '%P\n' | sort) <(find "${f%.input}.expected" -printf '%P\n' | sort); then
+ echo "**** Unexpected output for $f"
+ exit 1
+ fi
+ ) || exit 1
+done
diff --git a/test/test-fstab-generator/.gitattributes b/test/test-fstab-generator/.gitattributes
new file mode 100644
index 0000000..6df434f
--- /dev/null
+++ b/test/test-fstab-generator/.gitattributes
@@ -0,0 +1 @@
+* generated
diff --git a/test/test-fstab-generator/test-01-dev-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-01-dev-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-01-dev-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-01-dev-nfs.input b/test/test-fstab-generator/test-01-dev-nfs.input
new file mode 100644
index 0000000..50a1230
--- /dev/null
+++ b/test/test-fstab-generator/test-01-dev-nfs.input
@@ -0,0 +1 @@
+root=/dev/nfs nfsroot=192.168.0.1:/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-02-dhcp.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-02-dhcp.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-02-dhcp.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-02-dhcp.input b/test/test-fstab-generator/test-02-dhcp.input
new file mode 100644
index 0000000..5aa159b
--- /dev/null
+++ b/test/test-fstab-generator/test-02-dhcp.input
@@ -0,0 +1 @@
+root=dhcp
diff --git a/test/test-fstab-generator/test-03-dhcp6.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-03-dhcp6.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-03-dhcp6.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-03-dhcp6.input b/test/test-fstab-generator/test-03-dhcp6.input
new file mode 100644
index 0000000..f4c998e
--- /dev/null
+++ b/test/test-fstab-generator/test-03-dhcp6.input
@@ -0,0 +1 @@
+root=dhcp6
diff --git a/test/test-fstab-generator/test-04-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-04-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-04-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-04-nfs.input b/test/test-fstab-generator/test-04-nfs.input
new file mode 100644
index 0000000..6d2fb39
--- /dev/null
+++ b/test/test-fstab-generator/test-04-nfs.input
@@ -0,0 +1 @@
+root=nfs:/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-05-nfs4.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-05-nfs4.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-05-nfs4.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-05-nfs4.input b/test/test-fstab-generator/test-05-nfs4.input
new file mode 100644
index 0000000..0584069
--- /dev/null
+++ b/test/test-fstab-generator/test-05-nfs4.input
@@ -0,0 +1 @@
+root=nfs4:/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-06-ipv4.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-06-ipv4.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-06-ipv4.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-06-ipv4.input b/test/test-fstab-generator/test-06-ipv4.input
new file mode 100644
index 0000000..a486663
--- /dev/null
+++ b/test/test-fstab-generator/test-06-ipv4.input
@@ -0,0 +1 @@
+root=192.168.0.1:/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-07-ipv6.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-07-ipv6.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-07-ipv6.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-07-ipv6.input b/test/test-fstab-generator/test-07-ipv6.input
new file mode 100644
index 0000000..92b292c
--- /dev/null
+++ b/test/test-fstab-generator/test-07-ipv6.input
@@ -0,0 +1 @@
+root=[2001:db8::1]:/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-08-implicit-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-08-implicit-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-08-implicit-nfs.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-08-implicit-nfs.input b/test/test-fstab-generator/test-08-implicit-nfs.input
new file mode 100644
index 0000000..12aaa3f
--- /dev/null
+++ b/test/test-fstab-generator/test-08-implicit-nfs.input
@@ -0,0 +1 @@
+root=/nfsroot/root1:rw
diff --git a/test/test-fstab-generator/test-09-cifs.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-09-cifs.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-09-cifs.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-09-cifs.input b/test/test-fstab-generator/test-09-cifs.input
new file mode 100644
index 0000000..9d4af6a
--- /dev/null
+++ b/test/test-fstab-generator/test-09-cifs.input
@@ -0,0 +1 @@
+root=cifs://username:password@192.168.0.1:/cifsroot
diff --git a/test/test-fstab-generator/test-10-iscsi.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-10-iscsi.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-10-iscsi.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-10-iscsi.input b/test/test-fstab-generator/test-10-iscsi.input
new file mode 100644
index 0000000..99327b1
--- /dev/null
+++ b/test/test-fstab-generator/test-10-iscsi.input
@@ -0,0 +1 @@
+root=iscsi:username:password@servername::::tgt
diff --git a/test/test-fstab-generator/test-11-live.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-11-live.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-11-live.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-11-live.input b/test/test-fstab-generator/test-11-live.input
new file mode 100644
index 0000000..81f60ab
--- /dev/null
+++ b/test/test-fstab-generator/test-11-live.input
@@ -0,0 +1 @@
+root=live:http://example.com/liveboot.img
diff --git a/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-device.target.d/50-root-device.conf b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-device.target.d/50-root-device.conf
new file mode 100644
index 0000000..47c4232
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-device.target.d/50-root-device.conf
@@ -0,0 +1,5 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Requires=dev-sdx1.device
+After=dev-sdx1.device
diff --git a/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-root-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-12-dev-sdx.expected/sysroot.mount b/test/test-fstab-generator/test-12-dev-sdx.expected/sysroot.mount
new file mode 100644
index 0000000..8f8ef48
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.expected/sysroot.mount
@@ -0,0 +1,14 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Documentation=man:fstab(5) man:systemd-fstab-generator(8)
+SourcePath=/proc/cmdline
+Before=initrd-root-fs.target
+Requires=systemd-fsck-root.service
+After=systemd-fsck-root.service
+After=blockdev@dev-sdx1.target
+
+[Mount]
+What=/dev/sdx1
+Where=/sysroot
+Options=ro
diff --git a/test/test-fstab-generator/test-12-dev-sdx.expected/systemd-fsck-root.service b/test/test-fstab-generator/test-12-dev-sdx.expected/systemd-fsck-root.service
new file mode 100644
index 0000000..7f914fd
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.expected/systemd-fsck-root.service
@@ -0,0 +1,16 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Description=File System Check on /dev/sdx1
+Documentation=man:systemd-fsck-root.service(8)
+DefaultDependencies=no
+BindsTo=dev-sdx1.device
+Conflicts=shutdown.target
+After=initrd-root-device.target local-fs-pre.target dev-sdx1.device
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
+TimeoutSec=0
diff --git a/test/test-fstab-generator/test-12-dev-sdx.input b/test/test-fstab-generator/test-12-dev-sdx.input
new file mode 100644
index 0000000..8aa56b5
--- /dev/null
+++ b/test/test-fstab-generator/test-12-dev-sdx.input
@@ -0,0 +1 @@
+root=/dev/sdx1
diff --git a/test/test-fstab-generator/test-13-label.expected/initrd-root-device.target.d/50-root-device.conf b/test/test-fstab-generator/test-13-label.expected/initrd-root-device.target.d/50-root-device.conf
new file mode 100644
index 0000000..eada96c
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.expected/initrd-root-device.target.d/50-root-device.conf
@@ -0,0 +1,5 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Requires=dev-disk-by\x2dlabel-Root.device
+After=dev-disk-by\x2dlabel-Root.device
diff --git a/test/test-fstab-generator/test-13-label.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-13-label.expected/initrd-root-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.expected/initrd-root-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-13-label.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-13-label.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-13-label.expected/sysroot.mount b/test/test-fstab-generator/test-13-label.expected/sysroot.mount
new file mode 100644
index 0000000..98698d5
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.expected/sysroot.mount
@@ -0,0 +1,14 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Documentation=man:fstab(5) man:systemd-fstab-generator(8)
+SourcePath=/proc/cmdline
+Before=initrd-root-fs.target
+Requires=systemd-fsck-root.service
+After=systemd-fsck-root.service
+After=blockdev@dev-disk-by\x2dlabel-Root.target
+
+[Mount]
+What=/dev/disk/by-label/Root
+Where=/sysroot
+Options=ro
diff --git a/test/test-fstab-generator/test-13-label.expected/systemd-fsck-root.service b/test/test-fstab-generator/test-13-label.expected/systemd-fsck-root.service
new file mode 100644
index 0000000..a132739
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.expected/systemd-fsck-root.service
@@ -0,0 +1,16 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Description=File System Check on /dev/disk/by-label/Root
+Documentation=man:systemd-fsck-root.service(8)
+DefaultDependencies=no
+BindsTo=dev-disk-by\x2dlabel-Root.device
+Conflicts=shutdown.target
+After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2dlabel-Root.device
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-label/Root
+TimeoutSec=0
diff --git a/test/test-fstab-generator/test-13-label.input b/test/test-fstab-generator/test-13-label.input
new file mode 100644
index 0000000..75a3696
--- /dev/null
+++ b/test/test-fstab-generator/test-13-label.input
@@ -0,0 +1 @@
+root=LABEL=Root
diff --git a/test/test-fstab-generator/test-14-uuid.expected/initrd-root-device.target.d/50-root-device.conf b/test/test-fstab-generator/test-14-uuid.expected/initrd-root-device.target.d/50-root-device.conf
new file mode 100644
index 0000000..67b8469
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.expected/initrd-root-device.target.d/50-root-device.conf
@@ -0,0 +1,5 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Requires=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+After=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
diff --git a/test/test-fstab-generator/test-14-uuid.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-14-uuid.expected/initrd-root-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.expected/initrd-root-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-14-uuid.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-14-uuid.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-14-uuid.expected/sysroot.mount b/test/test-fstab-generator/test-14-uuid.expected/sysroot.mount
new file mode 100644
index 0000000..999acb0
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.expected/sysroot.mount
@@ -0,0 +1,14 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Documentation=man:fstab(5) man:systemd-fstab-generator(8)
+SourcePath=/proc/cmdline
+Before=initrd-root-fs.target
+Requires=systemd-fsck-root.service
+After=systemd-fsck-root.service
+After=blockdev@dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.target
+
+[Mount]
+What=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+Where=/sysroot
+Options=ro
diff --git a/test/test-fstab-generator/test-14-uuid.expected/systemd-fsck-root.service b/test/test-fstab-generator/test-14-uuid.expected/systemd-fsck-root.service
new file mode 100644
index 0000000..5945560
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.expected/systemd-fsck-root.service
@@ -0,0 +1,16 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Description=File System Check on /dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+Documentation=man:systemd-fsck-root.service(8)
+DefaultDependencies=no
+BindsTo=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+Conflicts=shutdown.target
+After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+TimeoutSec=0
diff --git a/test/test-fstab-generator/test-14-uuid.input b/test/test-fstab-generator/test-14-uuid.input
new file mode 100644
index 0000000..676246a
--- /dev/null
+++ b/test/test-fstab-generator/test-14-uuid.input
@@ -0,0 +1 @@
+root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
diff --git a/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-device.target.d/50-root-device.conf b/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-device.target.d/50-root-device.conf
new file mode 100644
index 0000000..583f47c
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-device.target.d/50-root-device.conf
@@ -0,0 +1,5 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Requires=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+After=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
diff --git a/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.expected/initrd-root-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-15-partuuid.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-15-partuuid.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-15-partuuid.expected/sysroot.mount b/test/test-fstab-generator/test-15-partuuid.expected/sysroot.mount
new file mode 100644
index 0000000..d10fb6e
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.expected/sysroot.mount
@@ -0,0 +1,14 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Documentation=man:fstab(5) man:systemd-fstab-generator(8)
+SourcePath=/proc/cmdline
+Before=initrd-root-fs.target
+Requires=systemd-fsck-root.service
+After=systemd-fsck-root.service
+After=blockdev@dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.target
+
+[Mount]
+What=/dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+Where=/sysroot
+Options=ro
diff --git a/test/test-fstab-generator/test-15-partuuid.expected/systemd-fsck-root.service b/test/test-fstab-generator/test-15-partuuid.expected/systemd-fsck-root.service
new file mode 100644
index 0000000..aa1d455
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.expected/systemd-fsck-root.service
@@ -0,0 +1,16 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Description=File System Check on /dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+Documentation=man:systemd-fsck-root.service(8)
+DefaultDependencies=no
+BindsTo=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+Conflicts=shutdown.target
+After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
+TimeoutSec=0
diff --git a/test/test-fstab-generator/test-15-partuuid.input b/test/test-fstab-generator/test-15-partuuid.input
new file mode 100644
index 0000000..d59490d
--- /dev/null
+++ b/test/test-fstab-generator/test-15-partuuid.input
@@ -0,0 +1 @@
+root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
diff --git a/test/test-fstab-generator/test-16-tmpfs.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-16-tmpfs.expected/initrd-root-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-16-tmpfs.expected/initrd-root-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-16-tmpfs.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-16-tmpfs.expected/initrd-usr-fs.target.requires/sysroot.mount
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test-fstab-generator/test-16-tmpfs.expected/initrd-usr-fs.target.requires/sysroot.mount
diff --git a/test/test-fstab-generator/test-16-tmpfs.expected/sysroot.mount b/test/test-fstab-generator/test-16-tmpfs.expected/sysroot.mount
new file mode 100644
index 0000000..6bd9a07
--- /dev/null
+++ b/test/test-fstab-generator/test-16-tmpfs.expected/sysroot.mount
@@ -0,0 +1,12 @@
+# Automatically generated by systemd-fstab-generator
+
+[Unit]
+Documentation=man:fstab(5) man:systemd-fstab-generator(8)
+SourcePath=/proc/cmdline
+Before=initrd-root-fs.target
+
+[Mount]
+What=rootfs
+Where=/sysroot
+Type=tmpfs
+Options=rw
diff --git a/test/test-fstab-generator/test-16-tmpfs.input b/test/test-fstab-generator/test-16-tmpfs.input
new file mode 100644
index 0000000..0d36184
--- /dev/null
+++ b/test/test-fstab-generator/test-16-tmpfs.input
@@ -0,0 +1 @@
+root=tmpfs