diff --git a/test/test-fstab-generator.sh b/test/test-fstab-generator.sh index 24a2533f16..f6173a0310 100755 --- a/test/test-fstab-generator.sh +++ b/test/test-fstab-generator.sh @@ -67,15 +67,15 @@ test_one() ( # .deb packager seems to dislike files named with backslash. So, as a workaround, we store files # without backslash in .expected. - for i in "$out"/**/*\\*.{mount,swap}; do + for i in "$out"/**/*\\*.{mount,swap,automount}; do k="${i//\\/}" if [[ "$i" != "$k" ]]; then - if [[ -f "$i" ]]; then - mv "$i" "$k" - elif [[ -L "$i" ]]; then + if [[ -L "$i" ]]; then dest=$(readlink "$i") rm "$i" ln -s "${dest//\\/}" "$k" + elif [[ -f "$i" ]]; then + mv "$i" "$k" fi fi done @@ -130,8 +130,7 @@ test_one() ( for f in "$src"/test-*.input; do # If /mnt is a symlink, then the expected output from this # test scenario will not match the actual output - if test "$f" = "$src/test-18-options.fstab.input" -a "$(readlink /mnt)" != "/mnt" - then + if [[ "$f" == "$src/test-18-options.fstab.input" && -L /mnt ]]; then echo "Skip $f because /mnt is a symlink" continue fi diff --git a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedby-automount.automount b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedby-automount.automount deleted file mode 120000 index 14fd395672..0000000000 --- a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedby-automount.automount +++ /dev/null @@ -1 +0,0 @@ -../mnt-wantedby-automount.automount \ No newline at end of file diff --git a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedbyx2dautomount.automount b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedbyx2dautomount.automount new file mode 120000 index 0000000000..97b5f69861 --- /dev/null +++ b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/foo.service.wants/mnt-wantedbyx2dautomount.automount @@ -0,0 +1 @@ +../mnt-wantedbyx2dautomount.automount \ No newline at end of file diff --git a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-requires.mount b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-requires.mount index 8386616593..f2aa83939b 100644 --- a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-requires.mount +++ b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-requires.mount @@ -3,8 +3,8 @@ [Unit] Documentation=man:fstab(5) man:systemd-fstab-generator(8) SourcePath=/etc/fstab -After=foo.service Requires=foo.service +After=foo.service Before=local-fs.target After=blockdev@dev-sdx5.target diff --git a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedby-automount.automount b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedbyx2dautomount.automount similarity index 100% rename from test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedby-automount.automount rename to test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedbyx2dautomount.automount diff --git a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedby-automount.mount b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedbyx2dautomount.mount similarity index 91% rename from test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedby-automount.mount rename to test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedbyx2dautomount.mount index d9094767f2..40375bf010 100644 --- a/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedby-automount.mount +++ b/test/test-fstab-generator/test-18-options.fstab.expected.sysroot/mnt-wantedbyx2dautomount.mount @@ -10,5 +10,5 @@ After=blockdev@dev-sdx17.target [Mount] What=/dev/sdx17 -Where=/mnt/wantedby +Where=/mnt/wantedby-automount Options=x-systemd.wanted-by=foo.service,x-systemd.automount diff --git a/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedby-automount.automount b/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedby-automount.automount deleted file mode 120000 index 14fd395672..0000000000 --- a/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedby-automount.automount +++ /dev/null @@ -1 +0,0 @@ -../mnt-wantedby-automount.automount \ No newline at end of file diff --git a/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedbyx2dautomount.automount b/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedbyx2dautomount.automount new file mode 120000 index 0000000000..97b5f69861 --- /dev/null +++ b/test/test-fstab-generator/test-18-options.fstab.expected/foo.service.wants/mnt-wantedbyx2dautomount.automount @@ -0,0 +1 @@ +../mnt-wantedbyx2dautomount.automount \ No newline at end of file diff --git a/test/test-fstab-generator/test-18-options.fstab.expected/mnt-requires.mount b/test/test-fstab-generator/test-18-options.fstab.expected/mnt-requires.mount index 8386616593..f2aa83939b 100644 --- a/test/test-fstab-generator/test-18-options.fstab.expected/mnt-requires.mount +++ b/test/test-fstab-generator/test-18-options.fstab.expected/mnt-requires.mount @@ -3,8 +3,8 @@ [Unit] Documentation=man:fstab(5) man:systemd-fstab-generator(8) SourcePath=/etc/fstab -After=foo.service Requires=foo.service +After=foo.service Before=local-fs.target After=blockdev@dev-sdx5.target diff --git a/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedby-automount.automount b/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedbyx2dautomount.automount similarity index 100% rename from test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedby-automount.automount rename to test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedbyx2dautomount.automount diff --git a/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedby-automount.mount b/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedbyx2dautomount.mount similarity index 91% rename from test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedby-automount.mount rename to test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedbyx2dautomount.mount index d9094767f2..40375bf010 100644 --- a/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedby-automount.mount +++ b/test/test-fstab-generator/test-18-options.fstab.expected/mnt-wantedbyx2dautomount.mount @@ -10,5 +10,5 @@ After=blockdev@dev-sdx17.target [Mount] What=/dev/sdx17 -Where=/mnt/wantedby +Where=/mnt/wantedby-automount Options=x-systemd.wanted-by=foo.service,x-systemd.automount