[systemd-devel] [PATCH 1/3] Added test for unit file state returned by unit_file_get_state and unit_file_get_list.

Ken Sedgwick ksedgwic at bonsai.com
Tue Oct 7 12:10:49 PDT 2014


---
 .gitignore                                         |   1 +
 Makefile.am                                        |  44 ++++++-
 src/test/test-enabled.c                            | 143 +++++++++++++++++++++
 .../etc/systemd/system/masked.service              |   1 +
 .../etc/systemd/system/maskedstatic.service        |   1 +
 .../etc/systemd/system/some.target                 |  15 +++
 .../system/some.target.wants/aliased.service       |   1 +
 .../system/some.target.wants/also_masked.service   |   1 +
 .../system/some.target.wants/another.service       |   1 +
 .../system/some.target.wants/different.service     |   1 +
 .../system/some.target.wants/masked.service        |   1 +
 .../some.target.wants/templating at four.service      |   1 +
 .../some.target.wants/templating at one.service       |   1 +
 .../some.target.wants/templating at three.service     |   1 +
 .../some.target.wants/templating at two.service       |   1 +
 .../run/systemd/system/maskedruntime.service       |   1 +
 .../run/systemd/system/maskedruntimestatic.service |   1 +
 .../run/systemd/system/other.target                |  15 +++
 .../system/other.target.wants/runtime.service      |   1 +
 .../usr/lib/systemd/system/another.service         |  12 ++
 .../usr/lib/systemd/system/disabled.service        |  12 ++
 .../usr/lib/systemd/system/invalid.service         |   1 +
 .../usr/lib/systemd/system/masked.service          |  12 ++
 .../usr/lib/systemd/system/maskedruntime.service   |  12 ++
 .../lib/systemd/system/maskedruntimestatic.service |   9 ++
 .../usr/lib/systemd/system/maskedstatic.service    |   9 ++
 .../usr/lib/systemd/system/runtime.service         |  12 ++
 .../usr/lib/systemd/system/static.service          |   9 ++
 .../usr/lib/systemd/system/templating at .service     |  12 ++
 .../lib/systemd/system/templating at three.service    |  12 ++
 .../usr/lib/systemd/system/templating at two.service  |  12 ++
 .../usr/lib/systemd/system/unique.service          |  12 ++
 32 files changed, 365 insertions(+), 3 deletions(-)
 create mode 100644 src/test/test-enabled.c
 create mode 120000 test/test-enabled-root/etc/systemd/system/masked.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/maskedstatic.service
 create mode 100644 test/test-enabled-root/etc/systemd/system/some.target
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/aliased.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/also_masked.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/another.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/different.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/masked.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/templating at four.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/templating at one.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/templating at three.service
 create mode 120000
test/test-enabled-root/etc/systemd/system/some.target.wants/templating at two.service
 create mode 120000
test/test-enabled-root/run/systemd/system/maskedruntime.service
 create mode 120000
test/test-enabled-root/run/systemd/system/maskedruntimestatic.service
 create mode 100644 test/test-enabled-root/run/systemd/system/other.target
 create mode 120000
test/test-enabled-root/run/systemd/system/other.target.wants/runtime.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/another.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/disabled.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/invalid.service
 create mode 100644 test/test-enabled-root/usr/lib/systemd/system/masked.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/maskedruntime.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/maskedruntimestatic.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/maskedstatic.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/runtime.service
 create mode 100644 test/test-enabled-root/usr/lib/systemd/system/static.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/templating at .service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/templating at three.service
 create mode 100644
test/test-enabled-root/usr/lib/systemd/system/templating at two.service
 create mode 100644 test/test-enabled-root/usr/lib/systemd/system/unique.service

diff --git a/.gitignore b/.gitignore
index f119b57..97b2b2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -173,6 +173,7 @@
 /test-icmp6-rs
 /test-ellipsize
 /test-engine
+/test-enabled
 /test-env-replace
 /test-event
 /test-fdset
diff --git a/Makefile.am b/Makefile.am
index 60011b7..3d782fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1355,7 +1355,8 @@ tests += \
  test-ratelimit \
  test-condition-util \
  test-uid-range \
- test-bus-policy
+ test-bus-policy \
+ test-enabled

 EXTRA_DIST += \
  test/a.service \
@@ -1391,8 +1392,36 @@ EXTRA_DIST += \
  test/bus-policy/hello.conf \
  test/bus-policy/methods.conf \
  test/bus-policy/ownerships.conf \
- test/bus-policy/signals.conf
-
+ test/bus-policy/signals.conf \
+ test/test-enabled-root/usr/lib/systemd/system/masked.service \
+ test/test-enabled-root/usr/lib/systemd/system/runtime.service \
+ test/test-enabled-root/usr/lib/systemd/system/maskedruntime.service \
+ test/test-enabled-root/usr/lib/systemd/system/another.service \
+ test/test-enabled-root/usr/lib/systemd/system/templating at three.service \
+ test/test-enabled-root/usr/lib/systemd/system/maskedstatic.service \
+ test/test-enabled-root/usr/lib/systemd/system/invalid.service \
+ test/test-enabled-root/usr/lib/systemd/system/disabled.service \
+ test/test-enabled-root/usr/lib/systemd/system/templating at two.service \
+ test/test-enabled-root/usr/lib/systemd/system/unique.service \
+ test/test-enabled-root/usr/lib/systemd/system/templating at .service \
+ test/test-enabled-root/usr/lib/systemd/system/static.service \
+ test/test-enabled-root/usr/lib/systemd/system/maskedruntimestatic.service \
+ test/test-enabled-root/run/systemd/system/other.target.wants/runtime.service \
+ test/test-enabled-root/run/systemd/system/maskedruntime.service \
+ test/test-enabled-root/run/systemd/system/other.target \
+ test/test-enabled-root/run/systemd/system/maskedruntimestatic.service \
+ test/test-enabled-root/etc/systemd/system/masked.service \
+ test/test-enabled-root/etc/systemd/system/some.target.wants/masked.service \
+ test/test-enabled-root/etc/systemd/system/some.target.wants/another.service \
+ test/test-enabled-root/etc/systemd/system/some.target.wants/templating at three.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/templating at one.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/templating at two.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/templating at four.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/also_masked.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/different.service
\
+ test/test-enabled-root/etc/systemd/system/some.target.wants/aliased.service \
+ test/test-enabled-root/etc/systemd/system/maskedstatic.service \
+ test/test-enabled-root/etc/systemd/system/some.target

 EXTRA_DIST += \
  src/test/test-helper.h
@@ -1779,6 +1808,15 @@ test_install_LDADD = \
  libsystemd-shared.la \
  libsystemd-internal.la

+test_enabled_SOURCES = \
+ src/test/test-enabled.c
+
+test_enabled_LDADD = \
+ libsystemd-units.la \
+ libsystemd-label.la \
+ libsystemd-shared.la \
+ libsystemd-internal.la
+
 test_watchdog_SOURCES = \
  src/test/test-watchdog.c

diff --git a/src/test/test-enabled.c b/src/test/test-enabled.c
new file mode 100644
index 0000000..607f68c
--- /dev/null
+++ b/src/test/test-enabled.c
@@ -0,0 +1,143 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright 2014 Pantheon, Inc.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "util.h"
+#include "path-util.h"
+#include "unit-name.h"
+#include "install.h"
+
+/*
+.
+├── etc
+│   └── systemd
+│       └── system
+│           ├── masked.service -> /dev/null
+│           ├── maskedstatic.service -> /dev/null
+│           ├── some.target
+│           └── some.target.wants
+│               ├── another.service ->
../../../../usr/lib/systemd/system/another.service
+│               ├── aliased.service ->
../../../../usr/lib/systemd/system/another.service
+│               ├── different.service ->
../../../../usr/lib/systemd/system/unique.service
+│               ├── masked.service ->
../../../../usr/lib/systemd/system/masked.service
+│               ├── also_masked.service ->
../../../../usr/lib/systemd/system/masked.service
+│               ├── templating at one.service ->
../../../../usr/lib/systemd/system/templating at .service
+│               ├── templating at two.service ->
../../../../usr/lib/systemd/system/templating at two.service
+│               ├── templating at three.service ->
../../../../usr/lib/systemd/system/templating at .service
+│               └── templating at four.service ->
../../../../usr/lib/systemd/system/templating at four.service
+├── run
+│   └── systemd
+│       └── system
+│           ├── maskedruntime.service -> /dev/null
+│           ├── maskedruntimestatic.service -> /dev/null
+│           ├── other.target
+│           └── other.target.wants
+│               └── runtime.service ->
../../../../usr/lib/systemd/system/runtime.service
+└── usr
+    └── lib
+        └── systemd
+            └── system
+                ├── invalid.service
+                ├── disabled.service
+                ├── another.service
+                ├── runtime.service
+                ├── masked.service
+                ├── maskedruntime.service
+                ├── static.service
+                ├── maskedstatic.service
+                ├── maskedruntimestatic.service
+                ├── templating at .service
+                ├── templating at two.service
+                ├── templating at three.service
+                └── unique.service
+*/
+
+
+const char *subdir = "/test-enabled-root";
+char root_dir[UNIT_NAME_MAX + 2 + 1] = TEST_DIR;
+
+#define confirm_unit_state(unit, expected)                              \
+        assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root_dir,
unit) == expected)
+
+static void test_enabled(int argc, char* argv[]) {
+        Hashmap *h;
+        UnitFileList *p;
+        Iterator i;
+        int r;
+
+        strncat(root_dir, subdir, strlen(subdir));
+
+        confirm_unit_state("nonexistent.service", -ENOENT);
+        confirm_unit_state("invalid.service", -EBADMSG);
+        confirm_unit_state("disabled.service", UNIT_FILE_DISABLED);
+        confirm_unit_state("another.service", UNIT_FILE_ENABLED);
+        confirm_unit_state("runtime.service", UNIT_FILE_ENABLED_RUNTIME);
+        confirm_unit_state("masked.service", UNIT_FILE_MASKED);
+        confirm_unit_state("maskedruntime.service", UNIT_FILE_MASKED_RUNTIME);
+        confirm_unit_state("static.service", UNIT_FILE_STATIC);
+        confirm_unit_state("maskedstatic.service", UNIT_FILE_MASKED);
+        confirm_unit_state("maskedruntimestatic.service",
UNIT_FILE_MASKED_RUNTIME);
+        confirm_unit_state("templating at .service", UNIT_FILE_ENABLED);
+        confirm_unit_state("templating at two.service", UNIT_FILE_ENABLED);
+        confirm_unit_state("templating at three.service", UNIT_FILE_ENABLED);
+        confirm_unit_state("unique.service", UNIT_FILE_ENABLED);
+
+        h = hashmap_new(&string_hash_ops);
+        r = unit_file_get_list(UNIT_FILE_SYSTEM, root_dir, h);
+        assert_se(r >= 0);
+
+        HASHMAP_FOREACH(p, h, i) {
+                UnitFileState s;
+
+                s = unit_file_get_state(UNIT_FILE_SYSTEM, root_dir,
+                                        basename(p->path));
+
+                /* unit_file_get_list and unit_file_get_state are
+                 * a little different in some cases.  Handle these
+                 * cases here ...
+                 */
+                switch ((int)s) {
+                case UNIT_FILE_ENABLED_RUNTIME:
+                        assert_se(p->state == UNIT_FILE_ENABLED);
+                        break;
+                case -EBADMSG:
+                        assert_se(p->state == UNIT_FILE_INVALID);
+                        break;
+                default:
+                        assert_se(p->state == s);
+                        break;
+                }
+
+                fprintf(stderr, "%s (%s)\n",
+                        p->path,
+                        unit_file_state_to_string(p->state));
+        }
+        unit_file_list_free(h);
+}
+
+int main(int argc, char* argv[]) {
+        test_enabled(argc, argv);
+        return 0;
+}
diff --git a/test/test-enabled-root/etc/systemd/system/masked.service
b/test/test-enabled-root/etc/systemd/system/masked.service
new file mode 120000
index 0000000..dc1dc0c
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/masked.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/maskedstatic.service
b/test/test-enabled-root/etc/systemd/system/maskedstatic.service
new file mode 120000
index 0000000..dc1dc0c
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/maskedstatic.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target
b/test/test-enabled-root/etc/systemd/system/some.target
new file mode 100644
index 0000000..a2c4532
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target
@@ -0,0 +1,15 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Graphical Interface
+Documentation=man:systemd.special(7)
+Requires=multi-user.target
+After=multi-user.target
+Conflicts=rescue.target
+Wants=display-manager.service
+AllowIsolate=yes
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/aliased.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/aliased.service
new file mode 120000
index 0000000..fec3d43
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/aliased.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/another.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/also_masked.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/also_masked.service
new file mode 120000
index 0000000..322a87b
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/also_masked.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/masked.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/another.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/another.service
new file mode 120000
index 0000000..fec3d43
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/another.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/another.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/different.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/different.service
new file mode 120000
index 0000000..40b36c8
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/different.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/unique.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/masked.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/masked.service
new file mode 120000
index 0000000..322a87b
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/masked.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/masked.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at four.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at four.service
new file mode 120000
index 0000000..7ccde6b
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at four.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/templating at four.service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at one.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at one.service
new file mode 120000
index 0000000..16f781d
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at one.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/templating at .service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at three.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at three.service
new file mode 120000
index 0000000..16f781d
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at three.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/templating at .service
\ No newline at end of file
diff --git a/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at two.service
b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at two.service
new file mode 120000
index 0000000..ee2c510
--- /dev/null
+++ b/test/test-enabled-root/etc/systemd/system/some.target.wants/templating at two.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/templating at two.service
\ No newline at end of file
diff --git a/test/test-enabled-root/run/systemd/system/maskedruntime.service
b/test/test-enabled-root/run/systemd/system/maskedruntime.service
new file mode 120000
index 0000000..dc1dc0c
--- /dev/null
+++ b/test/test-enabled-root/run/systemd/system/maskedruntime.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/test/test-enabled-root/run/systemd/system/maskedruntimestatic.service
b/test/test-enabled-root/run/systemd/system/maskedruntimestatic.service
new file mode 120000
index 0000000..dc1dc0c
--- /dev/null
+++ b/test/test-enabled-root/run/systemd/system/maskedruntimestatic.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/test/test-enabled-root/run/systemd/system/other.target
b/test/test-enabled-root/run/systemd/system/other.target
new file mode 100644
index 0000000..a2c4532
--- /dev/null
+++ b/test/test-enabled-root/run/systemd/system/other.target
@@ -0,0 +1,15 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Graphical Interface
+Documentation=man:systemd.special(7)
+Requires=multi-user.target
+After=multi-user.target
+Conflicts=rescue.target
+Wants=display-manager.service
+AllowIsolate=yes
diff --git a/test/test-enabled-root/run/systemd/system/other.target.wants/runtime.service
b/test/test-enabled-root/run/systemd/system/other.target.wants/runtime.service
new file mode 120000
index 0000000..a28ebda
--- /dev/null
+++ b/test/test-enabled-root/run/systemd/system/other.target.wants/runtime.service
@@ -0,0 +1 @@
+../../../../usr/lib/systemd/system/runtime.service
\ No newline at end of file
diff --git a/test/test-enabled-root/usr/lib/systemd/system/another.service
b/test/test-enabled-root/usr/lib/systemd/system/another.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/another.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/disabled.service
b/test/test-enabled-root/usr/lib/systemd/system/disabled.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/disabled.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/invalid.service
b/test/test-enabled-root/usr/lib/systemd/system/invalid.service
new file mode 100644
index 0000000..e420fe4
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/invalid.service
@@ -0,0 +1 @@
+INVALID
diff --git a/test/test-enabled-root/usr/lib/systemd/system/masked.service
b/test/test-enabled-root/usr/lib/systemd/system/masked.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/masked.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/maskedruntime.service
b/test/test-enabled-root/usr/lib/systemd/system/maskedruntime.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/maskedruntime.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/maskedruntimestatic.service
b/test/test-enabled-root/usr/lib/systemd/system/maskedruntimestatic.service
new file mode 100644
index 0000000..0fcfc12
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/maskedruntimestatic.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
diff --git a/test/test-enabled-root/usr/lib/systemd/system/maskedstatic.service
b/test/test-enabled-root/usr/lib/systemd/system/maskedstatic.service
new file mode 100644
index 0000000..0fcfc12
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/maskedstatic.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
diff --git a/test/test-enabled-root/usr/lib/systemd/system/runtime.service
b/test/test-enabled-root/usr/lib/systemd/system/runtime.service
new file mode 100644
index 0000000..5fcdd66
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/runtime.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=other.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/static.service
b/test/test-enabled-root/usr/lib/systemd/system/static.service
new file mode 100644
index 0000000..0fcfc12
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/static.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
diff --git a/test/test-enabled-root/usr/lib/systemd/system/templating at .service
b/test/test-enabled-root/usr/lib/systemd/system/templating at .service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/templating at .service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/templating at three.service
b/test/test-enabled-root/usr/lib/systemd/system/templating at three.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/templating at three.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/templating at two.service
b/test/test-enabled-root/usr/lib/systemd/system/templating at two.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/templating at two.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
diff --git a/test/test-enabled-root/usr/lib/systemd/system/unique.service
b/test/test-enabled-root/usr/lib/systemd/system/unique.service
new file mode 100644
index 0000000..669548a
--- /dev/null
+++ b/test/test-enabled-root/usr/lib/systemd/system/unique.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+RemainAfterExit=yes
+
+[Install]
+WantedBy=some.target
-- 
1.9.3


More information about the systemd-devel mailing list