From 24f63455051907804030f7f12e87d97a0e86f5a8 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 19 Sep 2016 19:49:59 +0000 Subject: [PATCH] tests/utime.c: rewrite without assert * tests/utime.c: Do not include . (main): Use sprintrc instead of assert. --- tests/utime.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/utime.c b/tests/utime.c index 22862172..ef40d1bd 100644 --- a/tests/utime.c +++ b/tests/utime.c @@ -28,7 +28,6 @@ */ #include "tests.h" -#include #include #include #include @@ -45,23 +44,22 @@ print_tm(const struct tm * const p) int main(void) { - utime("", NULL); - printf("utime(\"\", NULL) = -1 ENOENT (%m)\n"); + int rc = utime("", NULL); + printf("utime(\"\", NULL) = %s\n", sprintrc(rc)); const time_t t = time(NULL); const struct tm * const p = localtime(&t); const struct utimbuf u = { .actime = t, .modtime = t }; const struct utimbuf const *tail_u = tail_memdup(&u, sizeof(u)); + rc = utime("utime\nfilename", tail_u); + const char *errstr = sprintrc(rc); printf("utime(\"utime\\nfilename\", ["); print_tm(p); printf(", "); print_tm(p); - printf("]) = -1 ENOENT "); - assert(utime("utime\nfilename", tail_u) == -1); - if (ENOENT != errno) - perror_msg_and_skip("utime"); - printf("(%m)\n"); + printf("]) = %s\n", errstr); + puts("+++ exited with 0 +++"); return 0; } -- 2.50.1