diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-26 16:32:40 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 2cefb09ff69c3595e98c55f0da1bd137c612276c (patch) | |
tree | 413850b2eb4d2cd031c2d31ef66b657baf5d66d4 /src/test/test-os-util.c | |
parent | 1049fbda947f856942a693f011fe013a2ee798f0 (diff) |
os-util: add helpers for finding /etc/os-release
Place this new helpers in a new source file os-util.[ch], and move the
existing and related call path_is_os_tree() to it as well.
Diffstat (limited to 'src/test/test-os-util.c')
-rw-r--r-- | src/test/test-os-util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/test-os-util.c b/src/test/test-os-util.c new file mode 100644 index 000000000..1e78f352a --- /dev/null +++ b/src/test/test-os-util.c @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ + +//#include <errno.h> + +//#include "log.h" +//#include "os-util.h" + +static void test_path_is_os_tree(void) { + assert_se(path_is_os_tree("/") > 0); + assert_se(path_is_os_tree("/etc") == 0); + assert_se(path_is_os_tree("/idontexist") == -ENOENT); +} + +int main(int argc, char *argv[]) { + log_set_max_level(LOG_DEBUG); + log_parse_environment(); + log_open(); + + test_path_is_os_tree(); + + return 0; +} |