]> granicus.if.org Git - strace/commitdiff
tests/utime.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 4 Jan 2016 23:58:19 +0000 (23:58 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 00:14:36 +0000 (00:14 +0000)
* tests/utime.c (main): Use assert and perror_msg_and_skip.

tests/utime.c

index 89c5b8ab284342f8725235a38a6445d6dfa91ce2..fa1003deeec0e853e80e28bbbea62eb6bd83a630 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,6 +25,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "tests.h"
+#include <assert.h>
 #include <time.h>
 #include <utime.h>
 #include <errno.h>
@@ -49,8 +51,11 @@ main(void)
        print_tm(p);
        printf(", ");
        print_tm(p);
-       puts("]) = -1 ENOENT (No such file or directory)");
+       printf("]) = -1 ENOENT ");
+       assert(utime("utime\nfilename", &u) == -1);
+       if (ENOENT != errno)
+               perror_msg_and_skip("utime");
+       printf("(%m)\n");
        puts("+++ exited with 0 +++");
-
-       return utime("utime\nfilename", &u) == -1 && errno == ENOENT ? 0 : 77;
+       return 0;
 }