diff options
author | Jeremy Allison <jra@samba.org> | 2009-07-15 11:49:33 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-07-15 11:49:33 -0700 |
commit | 1f5aec877fc48ff96b14a0e95f01c68a29dd8718 (patch) | |
tree | 4c3ab1b8c1a1b706531ae3d80969f6d00b0fc29a /source3/torture | |
parent | b76ab511f7238820a4e6ac3a2ae17d103f2bf9b9 (diff) | |
download | samba-1f5aec877fc48ff96b14a0e95f01c68a29dd8718.tar.gz samba-1f5aec877fc48ff96b14a0e95f01c68a29dd8718.tar.bz2 samba-1f5aec877fc48ff96b14a0e95f01c68a29dd8718.zip |
Make cli_unlock and cli_unlock64 async. Fix POSIX lock test.
Jeremy.
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/locktest.c | 4 | ||||
-rw-r--r-- | source3/torture/locktest2.c | 2 | ||||
-rw-r--r-- | source3/torture/torture.c | 44 |
3 files changed, 25 insertions, 25 deletions
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 30b84c073d..a90c2e2dfe 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -341,9 +341,9 @@ static bool test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], case OP_UNLOCK: /* unset a lock */ for (server=0;server<NSERVERS;server++) { - ret[server] = cli_unlock64(cli[server][conn], + ret[server] = NT_STATUS_IS_OK(cli_unlock64(cli[server][conn], fnum[server][conn][f], - start, len); + start, len)); status[server] = cli_nt_error(cli[server][conn]); } if (showall || diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c index 93adcb51a6..5c8a2d8019 100644 --- a/source3/torture/locktest2.c +++ b/source3/torture/locktest2.c @@ -132,7 +132,7 @@ static bool try_unlock(struct cli_state *c, int fstype, switch (fstype) { case FSTYPE_SMB: - return cli_unlock(c, fd, start, len); + return NT_STATUS_IS_OK(cli_unlock(c, fd, start, len)); case FSTYPE_NFS: lock.l_type = F_UNLCK; diff --git a/source3/torture/torture.c b/source3/torture/torture.c index e3c4084e0c..f9192b12b7 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -492,7 +492,7 @@ static bool rw_torture(struct cli_state *c) correct = False; } - if (!cli_unlock(c, fnum2, n*sizeof(int), sizeof(int))) { + if (!NT_STATUS_IS_OK(cli_unlock(c, fnum2, n*sizeof(int), sizeof(int)))) { printf("unlock failed (%s)\n", cli_errstr(c)); correct = False; } @@ -1429,12 +1429,12 @@ static bool run_locktest2(int dummy) printf("lock at 100 failed (%s)\n", cli_errstr(cli)); } cli_setpid(cli, 2); - if (cli_unlock(cli, fnum1, 100, 4)) { + if (NT_STATUS_IS_OK(cli_unlock(cli, fnum1, 100, 4))) { printf("unlock at 100 succeeded! This is a locking bug\n"); correct = False; } - if (cli_unlock(cli, fnum1, 0, 4)) { + if (NT_STATUS_IS_OK(cli_unlock(cli, fnum1, 0, 4))) { printf("unlock1 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1443,7 +1443,7 @@ static bool run_locktest2(int dummy) NT_STATUS_RANGE_NOT_LOCKED)) return False; } - if (cli_unlock(cli, fnum1, 0, 8)) { + if (NT_STATUS_IS_OK(cli_unlock(cli, fnum1, 0, 8))) { printf("unlock2 succeeded! This is a locking bug\n"); correct = False; } else { @@ -1565,14 +1565,14 @@ static bool run_locktest3(int dummy) for (offset=i=0;i<torture_numops;i++) { NEXT_OFFSET; - if (!cli_unlock(cli1, fnum1, offset-1, 1)) { + if (!NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, offset-1, 1))) { printf("unlock1 %d failed (%s)\n", i, cli_errstr(cli1)); return False; } - if (!cli_unlock(cli2, fnum2, offset-2, 1)) { + if (!NT_STATUS_IS_OK(cli_unlock(cli2, fnum2, offset-2, 1))) { printf("unlock2 %d failed (%s)\n", i, cli_errstr(cli1)); @@ -1703,7 +1703,7 @@ static bool run_locktest4(int dummy) ret = cli_lock(cli1, fnum1, 110, 4, 0, READ_LOCK) && cli_lock(cli1, fnum1, 112, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 110, 6); + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 110, 6)); EXPECTED(ret, False); printf("the same process %s coalesce read locks\n", ret?"can":"cannot"); @@ -1721,30 +1721,30 @@ static bool run_locktest4(int dummy) ret = cli_lock(cli1, fnum1, 140, 4, 0, READ_LOCK) && cli_lock(cli1, fnum1, 140, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 140, 4) && - cli_unlock(cli1, fnum1, 140, 4); + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 140, 4)) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 140, 4)); EXPECTED(ret, True); printf("this server %s do recursive read locking\n", ret?"does":"doesn't"); ret = cli_lock(cli1, fnum1, 150, 4, 0, WRITE_LOCK) && cli_lock(cli1, fnum1, 150, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 150, 4) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 150, 4)) && (cli_read(cli2, fnum2, buf, 150, 4) == 4) && !(cli_write(cli2, fnum2, 0, buf, 150, 4) == 4) && - cli_unlock(cli1, fnum1, 150, 4); + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 150, 4)); EXPECTED(ret, True); printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't"); ret = cli_lock(cli1, fnum1, 160, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 160, 4) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 160, 4)) && (cli_write(cli2, fnum2, 0, buf, 160, 4) == 4) && (cli_read(cli2, fnum2, buf, 160, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot"); ret = cli_lock(cli1, fnum1, 170, 4, 0, WRITE_LOCK) && - cli_unlock(cli1, fnum1, 170, 4) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 170, 4)) && (cli_write(cli2, fnum2, 0, buf, 170, 4) == 4) && (cli_read(cli2, fnum2, buf, 170, 4) == 4); EXPECTED(ret, True); @@ -1752,7 +1752,7 @@ static bool run_locktest4(int dummy) ret = cli_lock(cli1, fnum1, 190, 4, 0, WRITE_LOCK) && cli_lock(cli1, fnum1, 190, 4, 0, READ_LOCK) && - cli_unlock(cli1, fnum1, 190, 4) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 190, 4)) && !(cli_write(cli2, fnum2, 0, buf, 190, 4) == 4) && (cli_read(cli2, fnum2, buf, 190, 4) == 4); EXPECTED(ret, True); @@ -1861,7 +1861,7 @@ static bool run_locktest5(int dummy) /* Unlock the first process lock, then check this was the WRITE lock that was removed. */ - ret = cli_unlock(cli1, fnum1, 0, 4) && + ret = NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4)) && cli_lock(cli2, fnum2, 0, 4, 0, READ_LOCK); EXPECTED(ret, True); @@ -1872,15 +1872,15 @@ static bool run_locktest5(int dummy) /* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */ - ret = cli_unlock(cli1, fnum1, 1, 1) && - cli_unlock(cli1, fnum1, 0, 4) && - cli_unlock(cli1, fnum1, 0, 4); + ret = NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 1, 1)) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4)) && + NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4)); EXPECTED(ret, True); printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); /* Ensure the next unlock fails. */ - ret = cli_unlock(cli1, fnum1, 0, 4); + ret = NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 0, 4)); EXPECTED(ret, False); printf("the same process %s count the lock stack\n", !ret?"can":"cannot"); @@ -4296,14 +4296,14 @@ static bool run_simple_posix_open_test(int dummy) } /* Do a POSIX lock/unlock. */ - if (!NT_STATUS_IS_OK(cli_posix_lock(cli1, fnum1, 0, 100, true, WRITE_LOCK))) { - printf("POSIX lock failed\n"); + if (!NT_STATUS_IS_OK(cli_posix_lock(cli1, fnum1, 0, 100, true, READ_LOCK))) { + printf("POSIX lock failed %s\n", cli_errstr(cli1)); goto out; } /* Punch a hole in the locked area. */ if (!NT_STATUS_IS_OK(cli_posix_unlock(cli1, fnum1, 10, 80))) { - printf("POSIX unlock failed\n"); + printf("POSIX unlock failed %s\n", cli_errstr(cli1)); goto out; } |