[Bug 191349] New: Failure with tools/regression/file/flock testcase # 16; testcase doesn't deal with EINTR properly
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jun 24 21:36:05 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191349
Bug ID: 191349
Summary: Failure with tools/regression/file/flock testcase #
16; testcase doesn't deal with EINTR properly
Product: Base System
Version: 10.0-STABLE
Hardware: Any
OS: Any
Status: Needs Triage
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: yaneurabeya at gmail.com
Testcase # 16 of tools/regression/file/flock fails because it doesn't properly
handle EINTR in the test thread:
# git log -n 1 .
commit 4af3a7a23ff67d621a71f1a73ff8ea3f892a07d9
Author: ru <ru at FreeBSD.org>
Date: Thu Feb 25 14:42:26 2010 +0000
Fixed missing or broken library dependencies.
Notes:
svn path=/head/; revision=204311
# ./flock . 16
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
fcntl failed: Interrupted system call
16 - F_SETLKW on locked region by two threads: FAIL ((uintptr_t)res != 0)
# git diff .
diff --git a/tools/regression/file/flock/flock.c
b/tools/regression/file/flock/flock.c
index c411853..cb575d2 100644
--- a/tools/regression/file/flock/flock.c
+++ b/tools/regression/file/flock/flock.c
@@ -27,6 +27,7 @@
* $FreeBSD$
*/
+#include <sys/param.h>
#include <sys/time.h>
#ifdef __FreeBSD__
#include <sys/mount.h>
@@ -55,7 +56,7 @@
#endif
#endif
-int verbose = 0;
+static int verbose = 0;
static int
make_file(const char *pathname, off_t sz)
@@ -1413,7 +1414,11 @@ test16_func(void *tc_in)
uintptr_t error;
struct test_ctx *tc = tc_in;
- error = fcntl(tc->tc_fd, F_SETLKW, &tc->tc_fl);
+ if (fcntl(tc->tc_fd, F_SETLKW, &tc->tc_fl) == -1) {
+ error = errno;
+ perror("fcntl failed");
+ } else
+ error = 0;
pthread_exit((void *)error);
}
@@ -1514,7 +1519,7 @@ struct test {
int intr; /* non-zero if the test interrupts a lock */
};
-struct test tests[] = {
+static struct test tests[] = {
{ test1, 1, 0 },
{ test2, 2, 0 },
{ test3, 3, 1 },
@@ -1532,7 +1537,6 @@ struct test tests[] = {
{ test15, 15, 1 },
{ test16, 16, 1 },
};
-int test_count = sizeof(tests) / sizeof(tests[0]);
int
main(int argc, const char *argv[])
@@ -1540,10 +1544,10 @@ main(int argc, const char *argv[])
int testnum;
int fd;
int nointr;
- int i;
struct sigaction sa;
int test_argc;
const char **test_argv;
+ unsigned int i;
if (argc < 2) {
errx(1, "usage: flock <directory> [test number] ...");
@@ -1578,7 +1582,7 @@ main(int argc, const char *argv[])
}
#endif
- for (i = 0; i < test_count; i++) {
+ for (i = 0; i < nitems(tests); i++) {
if (tests[i].intr && nointr)
continue;
if (!testnum || tests[i].num == testnum)
#
The testcase should be fixed or disabled.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list