tests/struct_flock.c: use libtests

* tests/struct_flock.c (create_sample): Return void,
all callers changed.  Use perror_msg_and_fail.
* tests/fcntl.c: Use SKIP_MAIN_UNDEFINED.
* tests/fcntl64.c: Likewise.
diff --git a/tests/fcntl.c b/tests/fcntl.c
index 64e7c9e..a55703c 100644
--- a/tests/fcntl.c
+++ b/tests/fcntl.c
@@ -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
@@ -33,7 +33,7 @@
 # define TEST_SYSCALL_NAME fcntl
 # include "struct_flock.c"
 
-#define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
+# define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
 
 static void
 test_flock64_einval(const int cmd, const char *name)
@@ -67,9 +67,7 @@
 int
 main(void)
 {
-	if (create_sample())
-		return 77;
-
+	create_sample();
 	test_flock();
 	test_flock64();
 
@@ -79,10 +77,6 @@
 
 #else
 
-int
-main(void)
-{
-	return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_fcntl")
 
 #endif
diff --git a/tests/fcntl64.c b/tests/fcntl64.c
index 427630b..960c4dc 100644
--- a/tests/fcntl64.c
+++ b/tests/fcntl64.c
@@ -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
@@ -33,7 +33,7 @@
 # define TEST_SYSCALL_NAME fcntl64
 # include "struct_flock.c"
 
-#define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
+# define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
 
 static void
 test_flock64_einval(const int cmd, const char *name)
@@ -54,10 +54,10 @@
 {
 	TEST_FLOCK64_EINVAL(F_SETLK64);
 	TEST_FLOCK64_EINVAL(F_SETLKW64);
-#ifdef F_OFD_SETLK
+# ifdef F_OFD_SETLK
 	TEST_FLOCK64_EINVAL(F_OFD_SETLK);
 	TEST_FLOCK64_EINVAL(F_OFD_SETLKW);
-#endif
+# endif
 
 	struct_kernel_flock64 fl = {
 		.l_type = F_RDLCK,
@@ -85,9 +85,7 @@
 int
 main(void)
 {
-	if (create_sample())
-		return 77;
-
+	create_sample();
 	test_flock();
 	test_flock64();
 
@@ -97,10 +95,6 @@
 
 #else
 
-int
-main(void)
-{
-	return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_fcntl64")
 
 #endif
diff --git a/tests/struct_flock.c b/tests/struct_flock.c
index 7ab07ed..0acba90 100644
--- a/tests/struct_flock.c
+++ b/tests/struct_flock.c
@@ -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
@@ -87,11 +87,16 @@
 	       TEST_SYSCALL_STR, FILE_LEN);
 }
 
-static int
+static void
 create_sample(void)
 {
 	char fname[] = TEST_SYSCALL_STR "_XXXXXX";
 
 	(void) close(0);
-	return mkstemp(fname) || unlink(fname) || ftruncate(0, FILE_LEN) ? 77 : 0;
+	if (mkstemp(fname))
+		perror_msg_and_fail("mkstemp: %s", fname);
+	if (unlink(fname))
+		perror_msg_and_fail("unlink: %s", fname);
+	if (ftruncate(0, FILE_LEN))
+		perror_msg_and_fail("ftruncate");
 }