diff options
author | Iago López Galeiras <iago@endocode.com> | 2014-11-20 21:18:23 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-11-23 16:29:11 -0500 |
commit | 58f10d401f1d3cd76f560e1914147040e8defa76 (patch) | |
tree | cca40c9a99d81cd3a8212115dc986d736c0f7245 | |
parent | f6375e837670911012ea0bd0de39511334d18021 (diff) |
test: support empty environment variables in unit files
Also update TODO, empty environment variables in Environment= and
EnvironmentFile= options work.
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/test/test-unit-file.c | 22 |
2 files changed, 22 insertions, 2 deletions
@@ -191,8 +191,6 @@ Features: * generator that automatically discovers btrfs subvolumes, identifies their purpose based on some xattr on them. -* support setting empty environment variables with Environment= and EnvironmentFile= - * timer units: actually add extra delays to timer units with high AccuracySec values, don't start them already when we are awake... * a way for container managers to turn off getty starting via $container_headless= or so... diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c index 03b3e25939..f31a1bbc9b 100644 --- a/src/test/test-unit-file.c +++ b/src/test/test-unit-file.c @@ -222,6 +222,9 @@ static void test_config_parse_exec(void) { "MODULE_0=coretemp\n" \ "MODULE_1=f71882fg" +#define env_file_5 \ + "a=\n" \ + "b=" static void test_load_env_file_1(void) { _cleanup_strv_free_ char **data = NULL; @@ -300,6 +303,24 @@ static void test_load_env_file_4(void) { unlink(name); } +static void test_load_env_file_5(void) { + _cleanup_strv_free_ char **data = NULL; + int r; + + char name[] = "/tmp/test-load-env-file.XXXXXX"; + _cleanup_close_ int fd; + + fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC); + assert_se(fd >= 0); + assert_se(write(fd, env_file_5, sizeof(env_file_5)) == sizeof(env_file_5)); + + r = load_env_file(NULL, name, NULL, &data); + assert_se(r == 0); + assert_se(streq(data[0], "a=")); + assert_se(streq(data[1], "b=")); + assert_se(data[2] == NULL); + unlink(name); +} static void test_install_printf(void) { char name[] = "name.service", @@ -387,6 +408,7 @@ int main(int argc, char *argv[]) { test_load_env_file_2(); test_load_env_file_3(); test_load_env_file_4(); + test_load_env_file_5(); TEST_REQ_RUNNING_SYSTEMD(test_install_printf()); return r; |