summaryrefslogtreecommitdiffstats
path: root/src/test/test-specifier.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-11-20 15:15:24 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-11-25 06:13:02 +0100
commit2824aa0796abbba718505bd5d4132dc6a6e179e8 (patch)
tree170f362b239c2011327d00f41621e1e9d0d40ec9 /src/test/test-specifier.c
parentMerge pull request #17706 from ddstreet/test-move-pam-systemd-user (diff)
downloadsystemd-2824aa0796abbba718505bd5d4132dc6a6e179e8.tar.xz
systemd-2824aa0796abbba718505bd5d4132dc6a6e179e8.zip
specifiers: introduce common macros for generating specifier tables
In many cases the tables are largely the same, hence define a common set of macros to generate the common parts. This adds in a couple of missing specifiers here and there, so is more thant just refactoring: it actually fixes accidental omissions. Note that some entries that look like they could be unified under these macros can't really be unified, since they are slightly different. For example in the DNSSD service logic we want to use the DNSSD hostname for %H rather than the unmodified kernel one.
Diffstat (limited to 'src/test/test-specifier.c')
-rw-r--r--src/test/test-specifier.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/test/test-specifier.c b/src/test/test-specifier.c
index b1e8a61021..2648c1c3f5 100644
--- a/src/test/test-specifier.c
+++ b/src/test/test-specifier.c
@@ -47,25 +47,12 @@ static void test_specifier_escape_strv(void) {
/* Any specifier functions which don't need an argument. */
static const Specifier specifier_table[] = {
- { 'm', specifier_machine_id, NULL },
- { 'b', specifier_boot_id, NULL },
- { 'H', specifier_host_name, NULL },
- { 'l', specifier_short_host_name, NULL },
- { 'v', specifier_kernel_release, NULL },
- { 'a', specifier_architecture, NULL },
- { 'o', specifier_os_id, NULL },
- { 'w', specifier_os_version_id, NULL },
- { 'B', specifier_os_build_id, NULL },
- { 'W', specifier_os_variant_id, NULL },
-
- { 'g', specifier_group_name, NULL },
- { 'G', specifier_group_id, NULL },
- { 'U', specifier_user_id, NULL },
- { 'u', specifier_user_name, NULL },
+ COMMON_SYSTEM_SPECIFIERS,
+
+ COMMON_CREDS_SPECIFIERS,
{ 'h', specifier_user_home, NULL },
- { 'T', specifier_tmp_dir, NULL },
- { 'V', specifier_var_tmp_dir, NULL },
+ COMMON_TMP_SPECIFIERS,
{}
};