lkml.org 
[lkml]   [2000]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [Announce] Linux Test Project
I've a little fix for the fcntl09 test that was wrongly return a positive.

--- ltp-20000804-alpha/tests/fcntl09.c.~1~ Fri Aug 4 22:48:23 2000
+++ ltp-20000804-alpha/tests/fcntl09.c Sat Aug 12 05:14:25 2000
@@ -155,11 +155,14 @@
* check looping state if -c option given
***************************************************************/
for (lc=0; TEST_LOOPING(lc); lc++) {
+ int type;
+ for (type = 0; type < 2; type ++) {

/* reset Tst_count in case we are looping. */
Tst_count=0;

- flocks.l_type = F_RDLCK | F_WRLCK;
+ flocks.l_type = type ? F_RDLCK : F_WRLCK;
+
/*
* Call fcntl(2) with F_SETLK argument on fname
*/
@@ -169,8 +172,8 @@
if ( TEST_RETURN == -1 ) {
TEST_ERROR_LOG(TEST_ERRNO);
tst_resm(TFAIL,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
+ "fcntl(%s, F_SETLK, &flocks) flocks.l_type = %s Failed, errno=%d : %s",
+ fname, type ? "F_RDLCK" : "F_WRLCK", TEST_ERRNO, strerror(TEST_ERRNO));
} else {

/***************************************************************
@@ -179,8 +182,8 @@
if ( STD_FUNCTIONAL_TEST ) {
/* No Verification test, yet... */
tst_resm(TPASS,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d",
- fname, TEST_RETURN);
+ "fcntl(%s, F_SETLK, &flocks) flocks.l_type = %s returned %d",
+ fname, type ? "F_RDLCK" : "F_WRLCK" ,TEST_RETURN);
}
}

@@ -208,6 +211,7 @@
fname, TEST_RETURN);
}
}
+ }

} /* End for TEST_LOOPING */


You can set the l_type either RDLK or WRLK but not at the same time or
flock_to_posix_lock will rightly fail here (will get the default path).

switch (l->l_type) {
case F_RDLCK:
case F_WRLCK:
case F_UNLCK:
fl->fl_type = l->l_type;
break;
default:
return (0);
}
(the WRITE lock just locks both writes and reads)

I also did an hack to test contention of the lock, but it's not clean
code, if you want it let me know.

Andrea



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2011 Jasper Spaans