]> granicus.if.org Git - strace/commitdiff
tests/readlinkat.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 5 Jan 2016 23:27:05 +0000 (23:27 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 5 Jan 2016 23:27:05 +0000 (23:27 +0000)
* tests/readlinkat.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

tests/readlinkat.c

index ccfc32dab2ac9b7d2ed2530d6628b5d896d800fc..67cefe99d1ebd70c439a5f35296397142470180e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
- * 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
  */
 
 #include "tests.h"
-#include <stdio.h>
-#include <unistd.h>
 #include <sys/syscall.h>
 
+#ifdef __NR_readlinkat
+
+# include <stdio.h>
+# include <unistd.h>
+
 int
 main(void)
 {
-#ifdef __NR_readlinkat
        static const char fname[] = "readlinkat.link";
        unsigned char buf[31];
        long rc;
@@ -42,7 +44,7 @@ main(void)
 
        rc = syscall(__NR_readlinkat, -100, fname, buf, sizeof(buf));
        if (rc < 0)
-               return 77;
+               perror_msg_and_skip("readlinkat");
 
        printf("readlinkat(AT_FDCWD, \"");
        for (i = 0; fname[i]; ++i)
@@ -54,7 +56,10 @@ main(void)
 
        puts("+++ exited with 0 +++");
        return 0;
+}
+
 #else
-       return 77;
+
+SKIP_MAIN_UNDEFINED("__NR_readlinkat")
+
 #endif
-}