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

tests/epoll_create1.c

index 6e5ef471f83c36f86dbf44af1a89535ee59e9541..79196a4c6ea316ba7a4fc116ccdc419baa511f60 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
  */
 
 #include "tests.h"
+#include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/syscall.h>
 
+#if defined __NR_epoll_create1 && defined O_CLOEXEC
+
 int
 main(void)
 {
-#if defined __NR_epoll_create1 && defined O_CLOEXEC
        (void) close(0);
        if (syscall(__NR_epoll_create1, O_CLOEXEC))
-               return 77;
-       return syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) >= 0;
+               perror_msg_and_skip("epoll_create1 O_CLOEXEC");
+       assert(syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) == -1);
+       return 0;
+}
+
 #else
-        return 77;
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_create1 && O_CLOEXEC")
+
 #endif
-}