From 51fc4ab85319890e7af8cdc3ac1314e8d9e00a6e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 26 Jul 2023 07:37:29 +0900 Subject: [PATCH] test-fstab-generator: add more tests for systemd.mount-extra= and friends (cherry picked from commit 03de154a1ecea1acef36a469157548b6a55921a5) Related: #2190226 --- .../foo-also_in_initrd.mount | 12 ++++++++++++ .../foo-not_in_initrd.mount | 11 +++++++++++ .../foo-also_in_initrd.mount | 1 + .../foo-not_in_initrd.mount | 1 + .../local-fs.target.requires/usr.mount | 1 + .../usr.mount | 11 +++++++++++ .../sysroot-foo-also_in_initrd.mount | 1 + .../initrd-fs.target.requires/sysroot-usr.mount | 1 + .../initrd-usr-fs.target.requires/sysusr-usr.mount | 1 + .../sysroot-foo-also_in_initrd.mount | 13 +++++++++++++ .../sysroot-usr.mount | 11 +++++++++++ .../sysusr-usr.mount | 11 +++++++++++ .../test-19-mounts-from-cmdline.input | 3 +++ .../dev-sdy5.swap | 10 ++++++++++ .../dev-sdy6.swap | 9 +++++++++ .../swap.target.requires/dev-sdy5.swap | 1 + .../swap.target.requires/dev-sdy6.swap | 1 + .../dev-sdy5.swap | 10 ++++++++++ .../swap.target.requires/dev-sdy5.swap | 1 + .../test-20-swap-from-cmdline.input | 2 ++ 20 files changed, 112 insertions(+) create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-also_in_initrd.mount create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-not_in_initrd.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-also_in_initrd.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-not_in_initrd.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/usr.mount create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/usr.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-foo-also_in_initrd.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-usr.mount create mode 120000 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-usr-fs.target.requires/sysusr-usr.mount create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-foo-also_in_initrd.mount create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-usr.mount create mode 100644 test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysusr-usr.mount create mode 100644 test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy5.swap create mode 100644 test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy6.swap create mode 120000 test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy5.swap create mode 120000 test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy6.swap create mode 100644 test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy5.swap create mode 120000 test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy5.swap diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-also_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-also_in_initrd.mount new file mode 100644 index 0000000000..8cc17c5d92 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-also_in_initrd.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=local-fs.target +After=blockdev@dev-sdx6.target + +[Mount] +What=/dev/sdx6 +Where=/foo/also_in_initrd +Options=x-initrd.mount diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-not_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-not_in_initrd.mount new file mode 100644 index 0000000000..8a5e28ebbf --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-not_in_initrd.mount @@ -0,0 +1,11 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/proc/cmdline +Before=local-fs.target +After=blockdev@dev-sdx7.target + +[Mount] +What=/dev/sdx7 +Where=/foo/not_in_initrd diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-also_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-also_in_initrd.mount new file mode 120000 index 0000000000..e4b2711fb9 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-also_in_initrd.mount @@ -0,0 +1 @@ +../foo-also_in_initrd.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-not_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-not_in_initrd.mount new file mode 120000 index 0000000000..85965fe86e --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/foo-not_in_initrd.mount @@ -0,0 +1 @@ +../foo-not_in_initrd.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/usr.mount new file mode 120000 index 0000000000..a570574e46 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/local-fs.target.requires/usr.mount @@ -0,0 +1 @@ +../usr.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/usr.mount new file mode 100644 index 0000000000..ff01ec4fde --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.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=/proc/cmdline +Before=local-fs.target +After=blockdev@dev-sdx5.target + +[Mount] +What=/dev/sdx5 +Where=/usr diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-foo-also_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-foo-also_in_initrd.mount new file mode 120000 index 0000000000..314c46cccf --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-foo-also_in_initrd.mount @@ -0,0 +1 @@ +../sysroot-foo-also_in_initrd.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-usr.mount new file mode 120000 index 0000000000..8bcbb16eae --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-fs.target.requires/sysroot-usr.mount @@ -0,0 +1 @@ +../sysroot-usr.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-usr-fs.target.requires/sysusr-usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-usr-fs.target.requires/sysusr-usr.mount new file mode 120000 index 0000000000..8fb2e18647 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/initrd-usr-fs.target.requires/sysusr-usr.mount @@ -0,0 +1 @@ +../sysusr-usr.mount \ No newline at end of file diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-foo-also_in_initrd.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-foo-also_in_initrd.mount new file mode 100644 index 0000000000..8baf1568b1 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-foo-also_in_initrd.mount @@ -0,0 +1,13 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/proc/cmdline +Before=initrd-fs.target +After=blockdev@dev-sdx6.target + +[Mount] +What=/dev/sdx6 +# Canonicalized from /foo/also_in_initrd +Where=/sysroot/foo/also_in_initrd +Options=x-initrd.mount diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-usr.mount new file mode 100644 index 0000000000..7f6d33cb3d --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.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=/proc/cmdline +Before=initrd-fs.target + +[Mount] +What=/sysusr/usr +Where=/sysroot/usr +Options=bind diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysusr-usr.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysusr-usr.mount new file mode 100644 index 0000000000..f1fedb3775 --- /dev/null +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.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=/proc/cmdline +Before=initrd-usr-fs.target +After=blockdev@dev-sdx5.target + +[Mount] +What=/dev/sdx5 +Where=/sysusr/usr diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.input b/test/test-fstab-generator/test-19-mounts-from-cmdline.input index f2cc6fc075..f16e494ecb 100644 --- a/test/test-fstab-generator/test-19-mounts-from-cmdline.input +++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.input @@ -3,3 +3,6 @@ rd.systemd.mount-extra=/dev/sdx2:/hoge/without_options:auto rd.systemd.mount-extra=/dev/sdx3:/hoge/without_fstype rd.systemd.mount-extra=/dev/sdx4 rd.systemd.mount-extra=//foo\ufffebar:/hoge/with\x20space:cifs:rw,seclabel +systemd.mount-extra=/dev/sdx5:/usr:auto:defaults +systemd.mount-extra=/dev/sdx6:/foo/also_in_initrd:auto:x-initrd.mount +systemd.mount-extra=/dev/sdx7:/foo/not_in_initrd:auto:defaults diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy5.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy5.swap new file mode 100644 index 0000000000..a9009ce3bc --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy5.swap @@ -0,0 +1,10 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/proc/cmdline +After=blockdev@dev-sdy5.target + +[Swap] +What=/dev/sdy5 +Options=x-initrd.mount diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy6.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy6.swap new file mode 100644 index 0000000000..383a8c3865 --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/dev-sdy6.swap @@ -0,0 +1,9 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/proc/cmdline +After=blockdev@dev-sdy6.target + +[Swap] +What=/dev/sdy6 diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy5.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy5.swap new file mode 120000 index 0000000000..04565dbf44 --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy5.swap @@ -0,0 +1 @@ +../dev-sdy5.swap \ No newline at end of file diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy6.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy6.swap new file mode 120000 index 0000000000..3b36226323 --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected.sysroot/swap.target.requires/dev-sdy6.swap @@ -0,0 +1 @@ +../dev-sdy6.swap \ No newline at end of file diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy5.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy5.swap new file mode 100644 index 0000000000..a9009ce3bc --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy5.swap @@ -0,0 +1,10 @@ +# Automatically generated by systemd-fstab-generator + +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/proc/cmdline +After=blockdev@dev-sdy5.target + +[Swap] +What=/dev/sdy5 +Options=x-initrd.mount diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy5.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy5.swap new file mode 120000 index 0000000000..04565dbf44 --- /dev/null +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy5.swap @@ -0,0 +1 @@ +../dev-sdy5.swap \ No newline at end of file diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.input b/test/test-fstab-generator/test-20-swap-from-cmdline.input index d92c5300e2..adde91e180 100644 --- a/test/test-fstab-generator/test-20-swap-from-cmdline.input +++ b/test/test-fstab-generator/test-20-swap-from-cmdline.input @@ -2,3 +2,5 @@ rd.systemd.mount-extra=/dev/sdy1:none:swap rd.systemd.mount-extra=/dev/sdy2:none:swap:x-systemd.makefs rd.systemd.swap-extra=/dev/sdy3:x-systemd.makefs,nofail rd.systemd.swap-extra=/dev/sdy4 +systemd.swap-extra=/dev/sdy5:x-initrd.mount +systemd.swap-extra=/dev/sdy6