diff options
author | Lily Foster <lily@lily.flowers> | 2023-01-26 00:52:30 +0100 |
---|---|---|
committer | Lily Foster <lily@lily.flowers> | 2023-01-26 01:05:11 +0100 |
commit | ef0c7ab6ac1ad2a38988fd4aa959aaa0408f2f4b (patch) | |
tree | aab832e3d7056a042a16bc6ccf120e81cf7ccb89 /test | |
parent | fstab-generator: add SYSTEMD_SYSFS_CHECK env var (diff) | |
download | systemd-ef0c7ab6ac1ad2a38988fd4aa959aaa0408f2f4b.tar.xz systemd-ef0c7ab6ac1ad2a38988fd4aa959aaa0408f2f4b.zip |
test: add fstab file support for fstab-generator tests
Diffstat (limited to 'test')
11 files changed, 63 insertions, 1 deletions
diff --git a/test/test-fstab-generator.sh b/test/test-fstab-generator.sh index 7c060dfac7..c86914a107 100755 --- a/test/test-fstab-generator.sh +++ b/test/test-fstab-generator.sh @@ -26,7 +26,11 @@ for f in "$src"/test-*.input; do 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" == *.fstab.input ]]; then + SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD=yes SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=yes root=fstab" SYSTEMD_FSTAB="$f" SYSTEMD_SYSROOT_FSTAB="/dev/null" $generator "$out" "$out" "$out" + else + SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD=yes SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$f")" $generator "$out" "$out" "$out" + fi if [[ -f "$out"/systemd-fsck-root.service ]]; then # For split-usr system diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-fs.target.requires/sysroot-usr.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-fs.target.requires/sysroot-usr.mount new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-fs.target.requires/sysroot-usr.mount diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-root-device.target.d/50-root-device.conf b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-root-device.target.d/50-root-device.conf new file mode 100644 index 0000000000..47c4232223 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.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-17-initrd-sysroot.fstab.expected/initrd-root-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-root-fs.target.requires/sysroot.mount new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-root-fs.target.requires/sysroot.mount diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysroot.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysroot.mount new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysroot.mount diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysusr-usr.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysusr-usr.mount new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/initrd-usr-fs.target.requires/sysusr-usr.mount diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot-usr.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot-usr.mount new file mode 100644 index 0000000000..69be9c17d4 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot-usr.mount @@ -0,0 +1,11 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/etc/fstab +Before=initrd-fs.target + +[Mount] +What=/sysusr/usr +Where=/sysroot/usr +Options=bind diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot.mount new file mode 100644 index 0000000000..0e8a701be9 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysroot.mount @@ -0,0 +1,13 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/etc/fstab +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 diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/systemd-fsck-root.service b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/systemd-fsck-root.service new file mode 100644 index 0000000000..7f914fdd14 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.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-17-initrd-sysroot.fstab.expected/sysusr-usr.mount b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysusr-usr.mount new file mode 100644 index 0000000000..63fcb10340 --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.expected/sysusr-usr.mount @@ -0,0 +1,11 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/etc/fstab +Before=initrd-usr-fs.target +After=blockdev@dev-sdx2.target + +[Mount] +What=/dev/sdx2 +Where=/sysusr/usr diff --git a/test/test-fstab-generator/test-17-initrd-sysroot.fstab.input b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.input new file mode 100644 index 0000000000..1ba9b0624e --- /dev/null +++ b/test/test-fstab-generator/test-17-initrd-sysroot.fstab.input @@ -0,0 +1,2 @@ +/dev/sdx1 /sysroot auto defaults 0 1 +/dev/sdx2 /sysroot/usr auto defaults 0 0 |