From: Frantisek Sumsal Date: Fri, 12 May 2023 15:59:54 +0000 (+0200) Subject: test: merge machinectl edit/cat tests into TEST-13 X-Git-Tag: v254-rc1~489^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a1ff1ac273d765d70aa2ba5dc996536aaa02de0a;p=thirdparty%2Fsystemd.git test: merge machinectl edit/cat tests into TEST-13 --- diff --git a/test/units/testsuite-13.machinectl.sh b/test/units/testsuite-13.machinectl.sh index 9ca6f5f02bf..50dc716230a 100755 --- a/test/units/testsuite-13.machinectl.sh +++ b/test/units/testsuite-13.machinectl.sh @@ -13,6 +13,7 @@ at_exit() { machinectl status long-running >/dev/null && machinectl kill --signal=KILL long-running mountpoint -q /var/lib/machines && timeout 10 sh -c "while ! umount /var/lib/machines; do sleep .5; done" + [[ -n "${NSPAWN_FRAGMENT:-}" ]] && rm -f "/etc/systemd/nspawn/$NSPAWN_FRAGMENT" "/var/lib/machines/$NSPAWN_FRAGMENT" } trap at_exit EXIT @@ -182,6 +183,24 @@ rm -fr /tmp/container.dir timeout 10 sh -c "while ! machinectl clean --all; do sleep .5; done" +NSPAWN_FRAGMENT="machinectl-test-$RANDOM.nspawn" +cat >"/var/lib/machines/$NSPAWN_FRAGMENT" </tmp/fragment.nspawn <"/var/lib/machines/$NSPAWN_NAME" <<\EOF -[Exec] -Boot=true -EOF - -EDITOR='true' script -ec 'machinectl edit "$NSPAWN_NAME"' /dev/null -[ -f "/etc/systemd/nspawn/$NSPAWN_NAME" ] -cmp "/var/lib/machines/$NSPAWN_NAME" "/etc/systemd/nspawn/$NSPAWN_NAME" - -cat >new <<\EOF -[Exec] -Boot=false -EOF - -script -ec 'machinectl cat "$PWD/new"' /dev/null - -EDITOR='mv new' script -ec 'machinectl edit "$NSPAWN_NAME"' /dev/null -printf '%s\n' '[Exec]' 'Boot=false' | cmp - "/etc/systemd/nspawn/$NSPAWN_NAME"