diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2014-12-12 19:54:51 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2014-12-12 19:54:51 +0200 |
commit | f47781d88ca6bf69d6b1dd0703b2b283482e5c09 (patch) | |
tree | 6a8f1f74e8fba0a2c20d710848d00b0338f6e341 /test | |
parent | 5eef597e931b0428bb984dc2bf0736d032a9198c (diff) | |
download | systemd-f47781d88ca6bf69d6b1dd0703b2b283482e5c09.tar.gz |
Imported Upstream version 218
Diffstat (limited to 'test')
40 files changed, 347 insertions, 3 deletions
diff --git a/test/basic.target b/test/basic.target index 228f62c4b1..abb63ec560 100644 --- a/test/basic.target +++ b/test/basic.target @@ -8,8 +8,8 @@ [Unit] Description=Basic System Documentation=man:systemd.special(7) + Requires=sysinit.target +After=sysinit.target Wants=sockets.target timers.target paths.target slices.target -After=sysinit.target sockets.target timers.target paths.target slices.target -JobTimeoutSec=15min -JobTimeoutAction=poweroff-force +After=sockets.target paths.target slices.target diff --git a/test/bus-policy/check-own-rules.conf b/test/bus-policy/check-own-rules.conf new file mode 100644 index 0000000000..bc2f415fcb --- /dev/null +++ b/test/bus-policy/check-own-rules.conf @@ -0,0 +1,14 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <user>mybususer</user> + <listen>unix:path=/foo/bar</listen> + <listen>tcp:port=1234</listen> + <servicedir>/usr/share/foo</servicedir> + <policy context="default"> + <allow user="*"/> + <deny own="*"/> + <allow own_prefix="org.freedesktop.ManySystems"/> + </policy> + +</busconfig> diff --git a/test/bus-policy/many-rules.conf b/test/bus-policy/many-rules.conf new file mode 100644 index 0000000000..70dd538c11 --- /dev/null +++ b/test/bus-policy/many-rules.conf @@ -0,0 +1,61 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <user>mybususer</user> + <listen>unix:path=/foo/bar</listen> + <listen>tcp:port=1234</listen> + <includedir>basic.d</includedir> + <standard_session_servicedirs /> + <servicedir>/usr/share/foo</servicedir> + <include ignore_missing="yes">nonexistent.conf</include> + <policy context="default"> + <allow user="*"/> + <deny send_interface="org.freedesktop.System" send_member="Reboot"/> + <deny receive_interface="org.freedesktop.System" receive_member="Reboot"/> + <deny send_path="/foo/bar/SystemObjectThing" send_member="Reboot"/> + <deny own="org.freedesktop.System"/> + <deny own_prefix="org.freedesktop.ManySystems"/> + <deny send_destination="org.freedesktop.System"/> + <deny receive_sender="org.freedesktop.System"/> + <deny user="root"/> + <deny group="bin"/> + <allow send_type="error"/> + <allow send_type="method_call"/> + <allow send_type="method_return"/> + <allow send_type="signal"/> + <deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo"/> + <deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo" send_type="method_call"/> + </policy> + + <policy context="mandatory"> + <allow user="*"/> + <deny send_interface="org.freedesktop.System" send_member="Reboot"/> + <deny receive_interface="org.freedesktop.System" receive_member="Reboot"/> + <deny send_path="/foo/bar/SystemObjectThing" send_member="Reboot"/> + <deny own="org.freedesktop.System"/> + <deny own_prefix="org.freedesktop.ManySystems"/> + <deny send_destination="org.freedesktop.System"/> + <deny receive_sender="org.freedesktop.System"/> + <deny user="root"/> + <deny group="bin"/> + <allow send_type="error"/> + <allow send_type="method_call"/> + <allow send_type="method_return"/> + <allow send_type="signal"/> + <deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo"/> + <deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo" send_type="method_call"/> + </policy> + + <limit name="max_incoming_bytes">5000</limit> + <limit name="max_outgoing_bytes">5000</limit> + <limit name="max_message_size">300</limit> + <limit name="service_start_timeout">5000</limit> + <limit name="auth_timeout">6000</limit> + <limit name="max_completed_connections">50</limit> + <limit name="max_incomplete_connections">80</limit> + <limit name="max_connections_per_user">64</limit> + <limit name="max_pending_service_starts">64</limit> + <limit name="max_names_per_connection">256</limit> + <limit name="max_match_rules_per_connection">512</limit> + +</busconfig> diff --git a/test/bus-policy/test.conf b/test/bus-policy/test.conf new file mode 100644 index 0000000000..ee6afcdfbb --- /dev/null +++ b/test/bus-policy/test.conf @@ -0,0 +1,20 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <!-- The following demonstrates how to punch holes in a default deny-all + policy so that a particular user can own a service, and other + connections can get messages from it --> + + <!-- Only root can own the FooService service, and + this user can only send the one kind of message --> + <policy user="root"> + <allow own="org.foo.FooService"/> + <allow send_interface="org.foo.FooBroadcastInterface"/> + </policy> + + <!-- Allow any connection to receive the message, but + only if the message is sent by the owner of FooService --> + <policy context="default"> + <allow receive_interface="org.foo.FooBroadcastInterface" receive_sender="org.foo.FooService"/> + </policy> +</busconfig> diff --git a/test/exec-environment-empty.service b/test/exec-environment-empty.service new file mode 100644 index 0000000000..0219ca4fd7 --- /dev/null +++ b/test/exec-environment-empty.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for Environment + +[Service] +ExecStart=/bin/sh -c 'exit $(test ! "$VAR1" = "word1 word2") && $(test ! "$VAR2" = word3) && $(test ! "$VAR3" = \'$word 5 6\')' +Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6" +Environment= diff --git a/test/exec-environment-multiple.service b/test/exec-environment-multiple.service new file mode 100644 index 0000000000..479005a5d8 --- /dev/null +++ b/test/exec-environment-multiple.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for Environment + +[Service] +ExecStart=/bin/sh -c 'exit $(test "$VAR1" = "word1 word2") && $(test "$VAR2" = word3) && $(test "$VAR3" = foobar)' +Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6" +Environment="VAR3=foobar" diff --git a/test/exec-environment.service b/test/exec-environment.service new file mode 100644 index 0000000000..4586b4c4a9 --- /dev/null +++ b/test/exec-environment.service @@ -0,0 +1,6 @@ +[Unit] +Description=Test for Environment + +[Service] +ExecStart=/bin/sh -c 'exit $(test "$VAR1" = "word1 word2") && $(test "$VAR2" = word3) && $(test "$VAR3" = \'$word 5 6\')' +Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6" diff --git a/test/exec-group.service b/test/exec-group.service new file mode 100644 index 0000000000..1aa04b5bd2 --- /dev/null +++ b/test/exec-group.service @@ -0,0 +1,6 @@ +[Unit] +Description=Test for Group + +[Service] +ExecStart=/bin/sh -c 'exit $(test $(id -n -g) = nobody)' +Group=nobody diff --git a/test/exec-ignoresigpipe-no.service b/test/exec-ignoresigpipe-no.service new file mode 100644 index 0000000000..69b2e9d8a8 --- /dev/null +++ b/test/exec-ignoresigpipe-no.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for IgnoreSIGPIPE=no + +[Service] +ExecStart=/bin/sh -c 'kill -PIPE 0' +Type=oneshot +IgnoreSIGPIPE=no diff --git a/test/exec-ignoresigpipe-yes.service b/test/exec-ignoresigpipe-yes.service new file mode 100644 index 0000000000..877ec8aed0 --- /dev/null +++ b/test/exec-ignoresigpipe-yes.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for IgnoreSIGPIPE=yes + +[Service] +ExecStart=/bin/sh -c 'kill -PIPE 0' +Type=oneshot +IgnoreSIGPIPE=yes diff --git a/test/exec-personality-x86-64.service b/test/exec-personality-x86-64.service new file mode 100644 index 0000000000..5bb5d910d0 --- /dev/null +++ b/test/exec-personality-x86-64.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for Personality=x86-64 + +[Service] +ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "x86_64")' +Type=oneshot +Personality=x86-64 diff --git a/test/exec-personality-x86.service b/test/exec-personality-x86.service new file mode 100644 index 0000000000..0b370a6480 --- /dev/null +++ b/test/exec-personality-x86.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for Personality=x86 + +[Service] +ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "i686")' +Type=oneshot +Personality=x86 diff --git a/test/exec-privatedevices-no.service b/test/exec-privatedevices-no.service new file mode 100644 index 0000000000..cf4f275fb6 --- /dev/null +++ b/test/exec-privatedevices-no.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for PrivateDev=no + +[Service] +ExecStart=/bin/sh -c 'exit $(test -c /dev/mem)' +Type=oneshot +PrivateDevices=no diff --git a/test/exec-privatedevices-yes.service b/test/exec-privatedevices-yes.service new file mode 100644 index 0000000000..85b3f4f981 --- /dev/null +++ b/test/exec-privatedevices-yes.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for PrivateDev=yes + +[Service] +ExecStart=/bin/sh -c 'exit $(test ! -c /dev/mem)' +Type=oneshot +PrivateDevices=yes diff --git a/test/exec-privatetmp-no.service b/test/exec-privatetmp-no.service new file mode 100644 index 0000000000..d69e552a63 --- /dev/null +++ b/test/exec-privatetmp-no.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for PrivateTmp=no + +[Service] +ExecStart=/bin/sh -c 'exit $(test -f /tmp/test-exec_privatetmp)' +Type=oneshot +PrivateTmp=no diff --git a/test/exec-privatetmp-yes.service b/test/exec-privatetmp-yes.service new file mode 100644 index 0000000000..881a040b87 --- /dev/null +++ b/test/exec-privatetmp-yes.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for PrivateTmp=yes + +[Service] +ExecStart=/bin/sh -c 'exit $(test ! -f /tmp/test-exec_privatetmp)' +Type=oneshot +PrivateTmp=yes diff --git a/test/exec-systemcallerrornumber.service b/test/exec-systemcallerrornumber.service new file mode 100644 index 0000000000..255a8b231a --- /dev/null +++ b/test/exec-systemcallerrornumber.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for SystemCallErrorNumber + +[Service] +ExecStart=/usr/bin/uname -a +SystemCallFilter=~uname +SystemCallErrorNumber=EACCES diff --git a/test/exec-systemcallfilter-failing.service b/test/exec-systemcallfilter-failing.service new file mode 100644 index 0000000000..c6ce9368c9 --- /dev/null +++ b/test/exec-systemcallfilter-failing.service @@ -0,0 +1,8 @@ +[Unit] +Description=Test for SystemCallFilter + +[Service] +ExecStart=/bin/echo "This should not be seen" +SystemCallFilter=ioperm +SystemCallFilter=~ioperm +SystemCallFilter=ioperm diff --git a/test/exec-systemcallfilter-failing2.service b/test/exec-systemcallfilter-failing2.service new file mode 100644 index 0000000000..b7f7c2aff9 --- /dev/null +++ b/test/exec-systemcallfilter-failing2.service @@ -0,0 +1,6 @@ +[Unit] +Description=Test for SystemCallFilter + +[Service] +ExecStart=/bin/echo "This should not be seen" +SystemCallFilter=~write open execve exit_group close mmap munmap fstat DONOTEXIST diff --git a/test/exec-systemcallfilter-not-failing.service b/test/exec-systemcallfilter-not-failing.service new file mode 100644 index 0000000000..feb206ab6d --- /dev/null +++ b/test/exec-systemcallfilter-not-failing.service @@ -0,0 +1,9 @@ +[Unit] +Description=Test for SystemCallFilter + +[Service] +ExecStart=/bin/echo "Foo bar" +SystemCallFilter=~read write open execve ioperm +SystemCallFilter=ioctl +SystemCallFilter=read write open execve +SystemCallFilter=~ioperm diff --git a/test/exec-systemcallfilter-not-failing2.service b/test/exec-systemcallfilter-not-failing2.service new file mode 100644 index 0000000000..cca469aa3d --- /dev/null +++ b/test/exec-systemcallfilter-not-failing2.service @@ -0,0 +1,6 @@ +[Unit] +Description=Test for SystemCallFilter + +[Service] +ExecStart=/bin/echo "Foo bar" +SystemCallFilter= diff --git a/test/exec-user.service b/test/exec-user.service new file mode 100644 index 0000000000..2ca08ebb42 --- /dev/null +++ b/test/exec-user.service @@ -0,0 +1,6 @@ +[Unit] +Description=Test for User + +[Service] +ExecStart=/bin/sh -c 'exit $(test "$USER" = nobody)' +User=nobody diff --git a/test/exec-workingdirectory.service b/test/exec-workingdirectory.service new file mode 100644 index 0000000000..10855d682a --- /dev/null +++ b/test/exec-workingdirectory.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test for WorkingDirectory + +[Service] +ExecStart=/bin/sh -c 'echo $PWD; exit $(test $PWD = "/tmp/test-exec_workingdirectory")' +Type=oneshot +WorkingDirectory=/tmp/test-exec_workingdirectory diff --git a/test/path-changed.path b/test/path-changed.path new file mode 100644 index 0000000000..e58bdd925f --- /dev/null +++ b/test/path-changed.path @@ -0,0 +1,8 @@ +[Unit] +Description=Test PathChanged + +[Path] +PathChanged=/tmp/test-path_changed + +[Install] +WantedBy=multi-user.target diff --git a/test/path-changed.service b/test/path-changed.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-changed.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-directorynotempty.path b/test/path-directorynotempty.path new file mode 100644 index 0000000000..17e599fc0e --- /dev/null +++ b/test/path-directorynotempty.path @@ -0,0 +1,8 @@ +[Unit] +Description=Test DirectoryNotEmpty + +[Path] +DirectoryNotEmpty=/tmp/test-path_directorynotempty/ + +[Install] +WantedBy=multi-user.target diff --git a/test/path-directorynotempty.service b/test/path-directorynotempty.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-directorynotempty.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-exists.path b/test/path-exists.path new file mode 100644 index 0000000000..c4c9105af4 --- /dev/null +++ b/test/path-exists.path @@ -0,0 +1,8 @@ +[Unit] +Description=Test PathExists + +[Path] +PathExists=/tmp/test-path_exists + +[Install] +WantedBy=multi-user.target diff --git a/test/path-exists.service b/test/path-exists.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-exists.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-existsglob.path b/test/path-existsglob.path new file mode 100644 index 0000000000..a058599605 --- /dev/null +++ b/test/path-existsglob.path @@ -0,0 +1,8 @@ +[Unit] +Description=Test PathExistsGlob + +[Path] +PathExistsGlob=/tmp/test-path_existsglob* + +[Install] +WantedBy=multi-user.target diff --git a/test/path-existsglob.service b/test/path-existsglob.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-existsglob.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-makedirectory.path b/test/path-makedirectory.path new file mode 100644 index 0000000000..9408479c0f --- /dev/null +++ b/test/path-makedirectory.path @@ -0,0 +1,10 @@ +[Unit] +Description=Test MakeDirectory & DirectoryMode + +[Path] +DirectoryNotEmpty=/tmp/test-path_makedirectory/ +MakeDirectory=yes +DirectoryMode=0744 + +[Install] +WantedBy=multi-user.target diff --git a/test/path-makedirectory.service b/test/path-makedirectory.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-makedirectory.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-modified.path b/test/path-modified.path new file mode 100644 index 0000000000..18363227ba --- /dev/null +++ b/test/path-modified.path @@ -0,0 +1,8 @@ +[Unit] +Description=Test PathModified + +[Path] +PathModified=/tmp/test-path_modified + +[Install] +WantedBy=multi-user.target diff --git a/test/path-modified.service b/test/path-modified.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-modified.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-mycustomunit.service b/test/path-mycustomunit.service new file mode 100644 index 0000000000..172ac0d0d5 --- /dev/null +++ b/test/path-mycustomunit.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test Path Unit= + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-service.service b/test/path-service.service new file mode 100644 index 0000000000..f8499ec619 --- /dev/null +++ b/test/path-service.service @@ -0,0 +1,6 @@ +[Unit] +Description=Service Test for Path units + +[Service] +ExecStart=/bin/true +Type=oneshot diff --git a/test/path-unit.path b/test/path-unit.path new file mode 100644 index 0000000000..95e572d6d5 --- /dev/null +++ b/test/path-unit.path @@ -0,0 +1,9 @@ +[Unit] +Description=Test Path Unit= + +[Path] +PathExists=/tmp/test-path_unit +Unit=path-mycustomunit.service + +[Install] +WantedBy=multi-user.target diff --git a/test/timers.target b/test/timers.target index 07fda3d9d0..251fa68065 100644 --- a/test/timers.target +++ b/test/timers.target @@ -8,3 +8,6 @@ [Unit] Description=Timers Documentation=man:systemd.special(7) + +DefaultDependencies=no +Conflicts=shutdown.target diff --git a/test/udev-test.pl b/test/udev-test.pl index 14f11df8af..3e05b61777 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -27,6 +27,7 @@ my $udev_dev = "test/dev"; my $udev_run = "test/run"; my $udev_rules_dir = "$udev_run/udev/rules.d"; my $udev_rules = "$udev_rules_dir/udev-test.rules"; +my $EXIT_TEST_SKIP = 77; my @tests = ( { @@ -1485,6 +1486,13 @@ if (!($<==0)) { exit; } +# skip the test when running in a container +system("systemd-detect-virt", "-c", "-q"); +if ($? >> 8 == 0) { + print "Running in a container, skipping the test.\n"; + exit($EXIT_TEST_SKIP); +} + udev_setup(); my $test_num = 1; |