From: Franck Bui Date: Fri, 27 Jan 2017 15:02:22 +0000 (+0100) Subject: tests: add dropin dependency tests X-Git-Tag: v233~143^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5231%2Fhead;p=thirdparty%2Fsystemd.git tests: add dropin dependency tests [zj: tests assertions adjusted to the different logic in which masking of a dependency through one name, does not forbid the dependency being added through another name.] --- diff --git a/test/TEST-15-DROPIN/Makefile b/test/TEST-15-DROPIN/Makefile new file mode 120000 index 00000000000..e9f93b1104c --- /dev/null +++ b/test/TEST-15-DROPIN/Makefile @@ -0,0 +1 @@ +../TEST-01-BASIC/Makefile \ No newline at end of file diff --git a/test/TEST-15-DROPIN/test-dropin.sh b/test/TEST-15-DROPIN/test-dropin.sh new file mode 100755 index 00000000000..9d8af99ac48 --- /dev/null +++ b/test/TEST-15-DROPIN/test-dropin.sh @@ -0,0 +1,274 @@ +#! /bin/bash + +set -e +set -x + +_clear_service () { + systemctl stop $1.service 2>/dev/null || : + rm -f /{etc,run,usr/lib}/systemd/system/$1.service + rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d + rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires} +} + +clear_services () { + for u in $*; do + _clear_service $u + done + systemctl daemon-reload +} + +create_service () { + clear_services $1 + + cat >/etc/systemd/system/$1.service</usr/lib/systemd/system/a.service.d/wants-b.conf</dev/null + + # mask some services that we do not want to run in these tests + ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket + ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service + + # import the test scripts in the rootfs and plug them in systemd + cp testsuite.service $initdir/etc/systemd/system/ + cp test-dropin.sh $initdir/ + setup_testsuite + + # create dedicated rootfs for nspawn (located in $TESTDIR/nspawn-root) + setup_nspawn_root +} + +test_cleanup() { + return 0 +} + +do_test "$@" diff --git a/test/TEST-15-DROPIN/testsuite.service b/test/TEST-15-DROPIN/testsuite.service new file mode 100644 index 00000000000..d9790c26102 --- /dev/null +++ b/test/TEST-15-DROPIN/testsuite.service @@ -0,0 +1,7 @@ +[Unit] +Description=Testsuite service +After=multi-user.target + +[Service] +ExecStart=/test-dropin.sh +Type=oneshot