[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[LTP] [Fwd: [Announce] Linux Test Project]
I've taken this patch posted by Andrea Arcangeli on lk and integrated it
into fcntl09.c and fcntl10.c. I've discovered that fcntl09 and fcntl10
are _very_ similar. 09 uses F_SETLK and 10 uses F_SETLKW. For purposes
of maintainability, its probably worthwhile to combine them.
Back to Andrea's patch, I like the changes and will check them in soon.
--aaron
Andrea Arcangeli wrote:
>
> 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/
--
Aaron Laffin
Silicon Graphics, Inc. OS Test Development
Email: alaffin@sgi.com Voice: 651-683-5756
USA/MN/CRP/F5233/SSBU