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

tests/xattr.c

index dd940d7a09d59416da1d2c3e524ecd724f60e2ca..7ae13c0d10722926b7c21315b2411277e1ad4700 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
@@ -26,7 +26,9 @@
  */
 
 #include "tests.h"
+
 #ifdef HAVE_SYS_XATTR_H
+
 # include <sys/xattr.h>
 
 int
@@ -34,18 +36,15 @@ main(void)
 {
 #define NAME "strace.test"
 #define VALUE "foo\0bar"
-       if (!removexattr(".", NAME) ||
-           !setxattr(".", NAME, VALUE, sizeof(VALUE), XATTR_CREATE))
-               return 77;
+       if (!removexattr(".", NAME))
+               error_msg_and_skip("removexattr: error expected");
+       if (!setxattr(".", NAME, VALUE, sizeof(VALUE), XATTR_CREATE))
+               error_msg_and_skip("setxattr: error expected");
        return 0;
 }
 
 #else
 
-int
-main(void)
-{
-       return 77;
-}
+SKIP_MAIN_UNDEFINED("HAVE_SYS_XATTR_H")
 
 #endif