diff options
Diffstat (limited to 'src/libsystemd/sd-device/test-device-util.c')
-rw-r--r-- | src/libsystemd/sd-device/test-device-util.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libsystemd/sd-device/test-device-util.c b/src/libsystemd/sd-device/test-device-util.c new file mode 100644 index 0000000..bc8ab66 --- /dev/null +++ b/src/libsystemd/sd-device/test-device-util.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include "device-util.h" +#include "tests.h" + +TEST(log_device_full) { + int r; + + for (int level = LOG_ERR; level <= LOG_DEBUG; level++) { + log_device_full(NULL, level, "test level=%d: %m", level); + + r = log_device_full_errno(NULL, level, EUCLEAN, "test level=%d errno=EUCLEAN: %m", level); + assert_se(r == -EUCLEAN); + + r = log_device_full_errno(NULL, level, 0, "test level=%d errno=0: %m", level); + assert_se(r == 0); + + r = log_device_full_errno(NULL, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA): %m", level); + assert_se(r == -ENODATA); + } +} + +DEFINE_TEST_MAIN(LOG_INFO); |