diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2016-10-10 20:47:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-10 20:47:25 +0300 |
commit | a0f72a24e0b3454034a87d8a4a4bfd36c34f1d49 (patch) | |
tree | baf791be9d8794ad0b1153f6ad45d78d974e6f9f /src/test/test-path-util.c | |
parent | baed1fedba161d7db89636a417751891831c432a (diff) | |
parent | a8725a06e6c5073325f2f6a7d6ef115c11d30a51 (diff) |
Merge pull request #4310 from keszybz/nspawn-autodetect
Autodetect systemd version in containers started by systemd-nspawn
Diffstat (limited to 'src/test/test-path-util.c')
-rw-r--r-- | src/test/test-path-util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 164a10d8a8..0b10d8e25e 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -511,7 +511,24 @@ static void test_hidden_or_backup_file(void) { assert_se(!hidden_or_backup_file("test.dpkg-old.foo")); } +static void test_systemd_installation_has_version(const char *path) { + int r; + const unsigned versions[] = {0, 231, atoi(PACKAGE_VERSION), 999}; + unsigned i; + + for (i = 0; i < ELEMENTSOF(versions); i++) { + r = systemd_installation_has_version(path, versions[i]); + assert_se(r >= 0); + log_info("%s has systemd >= %u: %s", + path ?: "Current installation", versions[i], yes_no(r)); + } +} + int main(int argc, char **argv) { + log_set_max_level(LOG_DEBUG); + log_parse_environment(); + log_open(); + test_path(); test_find_binary(argv[0]); test_prefixes(); @@ -526,5 +543,7 @@ int main(int argc, char **argv) { test_filename_is_valid(); test_hidden_or_backup_file(); + test_systemd_installation_has_version(argv[1]); /* NULL is OK */ + return 0; } |