summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/test
parentb4d23205f238e06aaa31264628e20669e714acad (diff)
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-boot-timestamps.c6
-rw-r--r--src/test/test-ns.c2
-rw-r--r--src/test/test-socket-util.c2
-rw-r--r--src/test/test-watchdog.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/test/test-boot-timestamps.c b/src/test/test-boot-timestamps.c
index 4ede318e38..354307cba1 100644
--- a/src/test/test-boot-timestamps.c
+++ b/src/test/test-boot-timestamps.c
@@ -37,7 +37,7 @@ static int test_acpi_fpdt(void) {
r = acpi_get_boot_usec(&loader_start, &loader_exit);
if (r < 0) {
if (r != -ENOENT)
- log_error("Failed to read ACPI FPDT: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read ACPI FPDT: %m");
return r;
}
@@ -60,7 +60,7 @@ static int test_efi_loader(void) {
r = efi_loader_get_boot_usec(&loader_start, &loader_exit);
if (r < 0) {
if (r != -ENOENT)
- log_error("Failed to read EFI loader data: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read EFI loader data: %m");
return r;
}
@@ -84,7 +84,7 @@ int main(int argc, char* argv[]) {
r = boot_timestamps(NULL, &fw, &l);
if (r < 0) {
- log_error("Failed to read variables: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read variables: %m");
return 1;
}
diff --git a/src/test/test-ns.c b/src/test/test-ns.c
index 7714e49ad9..fa297f9183 100644
--- a/src/test/test-ns.c
+++ b/src/test/test-ns.c
@@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
PROTECT_SYSTEM_NO,
0);
if (r < 0) {
- log_error("Failed to setup namespace: %s", strerror(-r));
+ log_error_errno(-r, "Failed to setup namespace: %m");
return 1;
}
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c
index c2c728bcde..d268423cc4 100644
--- a/src/test/test-socket-util.c
+++ b/src/test/test-socket-util.c
@@ -258,7 +258,7 @@ static void test_nameinfo_pretty(void) {
_cleanup_close_ int sfd = -1, cfd = -1;
r = getnameinfo_pretty(STDIN_FILENO, &stdin_name);
- log_info("No connection remote: %s", strerror(-r));
+ log_info_errno(-r, "No connection remote: %m");
assert_se(r < 0);
diff --git a/src/test/test-watchdog.c b/src/test/test-watchdog.c
index ccb1854708..72e0c03dd7 100644
--- a/src/test/test-watchdog.c
+++ b/src/test/test-watchdog.c
@@ -35,13 +35,13 @@ int main(int argc, char *argv[]) {
r = watchdog_set_timeout(&t);
if (r < 0)
- log_warning("Failed to open watchdog: %s", strerror(-r));
+ log_warning_errno(-r, "Failed to open watchdog: %m");
for (i = 0; i < 5; i++) {
log_info("Pinging...");
r = watchdog_ping();
if (r < 0)
- log_warning("Failed to ping watchdog: %s", strerror(-r));
+ log_warning_errno(-r, "Failed to ping watchdog: %m");
usleep(t/2);
}