diff --git a/tests/kolainst/destructive/staged-delay.sh b/tests/kolainst/destructive/staged-delay.sh index a320202f..5671bbea 100755 --- a/tests/kolainst/destructive/staged-delay.sh +++ b/tests/kolainst/destructive/staged-delay.sh @@ -9,9 +9,8 @@ set -xeuo pipefail require_writable_sysroot prepare_tmpdir -n=$(nth_boot) -case "${n}" in -1) +case "${AUTOPKGTEST_REBOOT_MARK:-}" in +"") dropin=/etc/systemd/system/ostree-finalize-staged.service.d/delay.conf mkdir -p $(dirname ${dropin}) cat >"${dropin}" << 'EOF' @@ -21,10 +20,10 @@ ExecStop=/bin/sh -c 'sleep 10 && if ! test -d /boot/loader/entries; then echo er EOF systemctl daemon-reload rpm-ostree kargs --append=somedummykarg=1 -kola_reboot +/tmp/autopkgtest-reboot 2 ;; -2) +"2") journalctl -b -1 -u ostree-finalize-staged > logs.txt assert_file_has_content_literal logs.txt 'ostree-finalize-staged found /boot/loader/entries' # older systemd doesn't output the success message @@ -36,5 +35,6 @@ else fi assert_file_has_content_literal /proc/cmdline somedummykarg=1 ;; +*) fatal "Unexpected AUTOPKGTEST_REBOOT_MARK=${AUTOPKGTEST_REBOOT_MARK}" ;; esac echo ok diff --git a/tests/kolainst/destructive/staged-deploy.sh b/tests/kolainst/destructive/staged-deploy.sh index cc3e7a7e..a5da0119 100755 --- a/tests/kolainst/destructive/staged-deploy.sh +++ b/tests/kolainst/destructive/staged-deploy.sh @@ -6,9 +6,8 @@ set -xeuo pipefail require_writable_sysroot prepare_tmpdir -n=$(nth_boot) -case "${n}" in - 1) +case "${AUTOPKGTEST_REBOOT_MARK:-}" in + "") # Initial cleanup to handle the cosa fast-build case ## TODO remove workaround for https://github.com/coreos/rpm-ostree/pull/2021 mkdir -p /var/lib/rpm-ostree/history @@ -48,9 +47,9 @@ case "${n}" in fatal "Pinned staged deployment" fi assert_file_has_content err.txt 'Cannot pin staged deployment' - kola_reboot + /tmp/autopkgtest-reboot "2" ;; - 2) + "2") # Check that deploy-staged service worked rpm-ostree status # Assert that the previous boot had a journal entry for it @@ -118,5 +117,5 @@ case "${n}" in ostree refs --delete staged-deploy nonstaged-deploy echo "ok cleanup refs" ;; - *) fatal "Unexpected boot count" ;; + *) fatal "Unexpected AUTOPKGTEST_REBOOT_MARK=${AUTOPKGTEST_REBOOT_MARK}" ;; esac diff --git a/tests/kolainst/destructive/var-mount.sh b/tests/kolainst/destructive/var-mount.sh index b3fe3d98..86c69fd1 100755 --- a/tests/kolainst/destructive/var-mount.sh +++ b/tests/kolainst/destructive/var-mount.sh @@ -4,20 +4,19 @@ set -xeuo pipefail . ${KOLA_EXT_DATA}/libinsttest.sh -n=$(nth_boot) -case "${n}" in - 1) +case "${AUTOPKGTEST_REBOOT_MARK:-}" in + "") require_writable_sysroot # Hack this off for now chattr -i /sysroot cp -a /var /sysroot/myvar touch /sysroot/myvar/somenewfile echo '/sysroot/myvar /var none bind 0 0' >> /etc/fstab - kola_reboot + /tmp/autopkgtest-reboot "2" ;; - 2) + "2") systemctl status var.mount test -f /var/somenewfile ;; - *) fatal "Unexpected boot count $n" + *) fatal "Unexpected AUTOPKGTEST_REBOOT_MARK=${AUTOPKGTEST_REBOOT_MARK}" ;; esac diff --git a/tests/kolainst/libinsttest.sh b/tests/kolainst/libinsttest.sh index 2552cf78..bf40a285 100644 --- a/tests/kolainst/libinsttest.sh +++ b/tests/kolainst/libinsttest.sh @@ -66,13 +66,6 @@ nth_boot() { journalctl --list-boots | wc -l } -kola_reboot() { - kill -TERM $$ - sleep 2m - echo "failed to reboot?" 1>&2 - exit 1 -} - # Determine our origin refspec - we'll use this as a test base rpmostree=$(which rpm-ostree 2>/dev/null) if test -z "${rpmostree}"; then